@@ -42,51 +42,51 @@ var defaultCompressionAlgorithms = []string{"", "gzip", "zstd", "zlib", "snappy"
42
42
// ClientConfig defines settings for creating an HTTP client.
43
43
type ClientConfig struct {
44
44
// The target URL to send data to (e.g.: http://some.url:9411/v1/traces).
45
- Endpoint string `mapstructure:"endpoint"`
45
+ Endpoint string `mapstructure:"endpoint,omitempty "`
46
46
47
47
// ProxyURL setting for the collector
48
- ProxyURL string `mapstructure:"proxy_url"`
48
+ ProxyURL string `mapstructure:"proxy_url,omitempty "`
49
49
50
50
// TLSSetting struct exposes TLS client configuration.
51
- TLSSetting configtls.ClientConfig `mapstructure:"tls"`
51
+ TLSSetting configtls.ClientConfig `mapstructure:"tls,omitempty "`
52
52
53
53
// ReadBufferSize for HTTP client. See http.Transport.ReadBufferSize.
54
54
// Default is 0.
55
- ReadBufferSize int `mapstructure:"read_buffer_size"`
55
+ ReadBufferSize int `mapstructure:"read_buffer_size,omitempty "`
56
56
57
57
// WriteBufferSize for HTTP client. See http.Transport.WriteBufferSize.
58
58
// Default is 0.
59
- WriteBufferSize int `mapstructure:"write_buffer_size"`
59
+ WriteBufferSize int `mapstructure:"write_buffer_size,omitempty "`
60
60
61
61
// Timeout parameter configures `http.Client.Timeout`.
62
62
// Default is 0 (unlimited).
63
- Timeout time.Duration `mapstructure:"timeout"`
63
+ Timeout time.Duration `mapstructure:"timeout,omitempty "`
64
64
65
65
// Additional headers attached to each HTTP request sent by the client.
66
66
// Existing header values are overwritten if collision happens.
67
67
// Header values are opaque since they may be sensitive.
68
- Headers map [string ]configopaque.String `mapstructure:"headers"`
68
+ Headers map [string ]configopaque.String `mapstructure:"headers,omitempty "`
69
69
70
70
// Auth configuration for outgoing HTTP calls.
71
- Auth * configauth.Authentication `mapstructure:"auth"`
71
+ Auth * configauth.Authentication `mapstructure:"auth,omitempty "`
72
72
73
73
// The compression key for supported compression types within collector.
74
- Compression configcompression.Type `mapstructure:"compression"`
74
+ Compression configcompression.Type `mapstructure:"compression,omitempty "`
75
75
76
76
// Advanced configuration options for the Compression
77
- CompressionParams configcompression.CompressionParams `mapstructure:"compression_params"`
77
+ CompressionParams configcompression.CompressionParams `mapstructure:"compression_params,omitempty "`
78
78
79
79
// MaxIdleConns is used to set a limit to the maximum idle HTTP connections the client can keep open.
80
80
// By default, it is set to 100. Zero means no limit.
81
81
MaxIdleConns int `mapstructure:"max_idle_conns"`
82
82
83
83
// MaxIdleConnsPerHost is used to set a limit to the maximum idle HTTP connections the host can keep open.
84
84
// Default is 0 (unlimited).
85
- MaxIdleConnsPerHost int `mapstructure:"max_idle_conns_per_host"`
85
+ MaxIdleConnsPerHost int `mapstructure:"max_idle_conns_per_host,omitempty "`
86
86
87
87
// MaxConnsPerHost limits the total number of connections per host, including connections in the dialing,
88
88
// active, and idle states. Default is 0 (unlimited).
89
- MaxConnsPerHost int `mapstructure:"max_conns_per_host"`
89
+ MaxConnsPerHost int `mapstructure:"max_conns_per_host,omitempty "`
90
90
91
91
// IdleConnTimeout is the maximum amount of time a connection will remain open before closing itself.
92
92
// By default, it is set to 90 seconds.
@@ -98,25 +98,25 @@ type ClientConfig struct {
98
98
// WARNING: enabling this option can result in significant overhead establishing a new HTTP(S)
99
99
// connection for every request. Before enabling this option please consider whether changes
100
100
// to idle connection settings can achieve your goal.
101
- DisableKeepAlives bool `mapstructure:"disable_keep_alives"`
101
+ DisableKeepAlives bool `mapstructure:"disable_keep_alives,omitempty "`
102
102
103
103
// This is needed in case you run into
104
104
// https://github.com/golang/go/issues/59690
105
105
// https://github.com/golang/go/issues/36026
106
106
// HTTP2ReadIdleTimeout if the connection has been idle for the configured value send a ping frame for health check
107
107
// 0s means no health check will be performed.
108
- HTTP2ReadIdleTimeout time.Duration `mapstructure:"http2_read_idle_timeout"`
108
+ HTTP2ReadIdleTimeout time.Duration `mapstructure:"http2_read_idle_timeout,omitempty "`
109
109
// HTTP2PingTimeout if there's no response to the ping within the configured value, the connection will be closed.
110
110
// If not set or set to 0, it defaults to 15s.
111
- HTTP2PingTimeout time.Duration `mapstructure:"http2_ping_timeout"`
111
+ HTTP2PingTimeout time.Duration `mapstructure:"http2_ping_timeout,omitempty "`
112
112
// Cookies configures the cookie management of the HTTP client.
113
- Cookies * CookiesConfig `mapstructure:"cookies"`
113
+ Cookies * CookiesConfig `mapstructure:"cookies,omitempty "`
114
114
}
115
115
116
116
// CookiesConfig defines the configuration of the HTTP client regarding cookies served by the server.
117
117
type CookiesConfig struct {
118
118
// Enabled if true, cookies from HTTP responses will be reused in further HTTP requests with the same server.
119
- Enabled bool `mapstructure:"enabled"`
119
+ Enabled bool `mapstructure:"enabled,omitempty "`
120
120
}
121
121
122
122
// NewDefaultClientConfig returns ClientConfig type object with
@@ -284,7 +284,7 @@ func (interceptor *headerRoundTripper) RoundTrip(req *http.Request) (*http.Respo
284
284
// ServerConfig defines settings for creating an HTTP server.
285
285
type ServerConfig struct {
286
286
// Endpoint configures the listening address for the server.
287
- Endpoint string `mapstructure:"endpoint"`
287
+ Endpoint string `mapstructure:"endpoint,omitempty "`
288
288
289
289
// TLSSetting struct exposes TLS client configuration.
290
290
TLSSetting * configtls.ServerConfig `mapstructure:"tls"`
@@ -293,20 +293,20 @@ type ServerConfig struct {
293
293
CORS * CORSConfig `mapstructure:"cors"`
294
294
295
295
// Auth for this receiver
296
- Auth * AuthConfig `mapstructure:"auth"`
296
+ Auth * AuthConfig `mapstructure:"auth,omitempty "`
297
297
298
298
// MaxRequestBodySize sets the maximum request body size in bytes. Default: 20MiB.
299
- MaxRequestBodySize int64 `mapstructure:"max_request_body_size"`
299
+ MaxRequestBodySize int64 `mapstructure:"max_request_body_size,omitempty "`
300
300
301
301
// IncludeMetadata propagates the client metadata from the incoming requests to the downstream consumers
302
- IncludeMetadata bool `mapstructure:"include_metadata"`
302
+ IncludeMetadata bool `mapstructure:"include_metadata,omitempty "`
303
303
304
304
// Additional headers attached to each HTTP response sent to the client.
305
305
// Header values are opaque since they may be sensitive.
306
306
ResponseHeaders map [string ]configopaque.String `mapstructure:"response_headers"`
307
307
308
308
// CompressionAlgorithms configures the list of compression algorithms the server can accept. Default: ["", "gzip", "zstd", "zlib", "snappy", "deflate"]
309
- CompressionAlgorithms []string `mapstructure:"compression_algorithms"`
309
+ CompressionAlgorithms []string `mapstructure:"compression_algorithms,omitempty "`
310
310
311
311
// ReadTimeout is the maximum duration for reading the entire
312
312
// request, including the body. A zero or negative value means
@@ -316,7 +316,7 @@ type ServerConfig struct {
316
316
// decisions on each request body's acceptable deadline or
317
317
// upload rate, most users will prefer to use
318
318
// ReadHeaderTimeout. It is valid to use them both.
319
- ReadTimeout time.Duration `mapstructure:"read_timeout"`
319
+ ReadTimeout time.Duration `mapstructure:"read_timeout,omitempty "`
320
320
321
321
// ReadHeaderTimeout is the amount of time allowed to read
322
322
// request headers. The connection's read deadline is reset
@@ -360,7 +360,7 @@ type AuthConfig struct {
360
360
361
361
// RequestParameters is a list of parameters that should be extracted from the request and added to the context.
362
362
// When a parameter is found in both the query string and the header, the value from the query string will be used.
363
- RequestParameters []string `mapstructure:"request_params"`
363
+ RequestParameters []string `mapstructure:"request_params,omitempty "`
364
364
}
365
365
366
366
// ToListener creates a net.Listener.
@@ -517,19 +517,19 @@ type CORSConfig struct {
517
517
// HTTP/JSON requests to an OTLP receiver. An origin may contain a
518
518
// wildcard (*) to replace 0 or more characters (e.g.,
519
519
// "http://*.domain.com", or "*" to allow any origin).
520
- AllowedOrigins []string `mapstructure:"allowed_origins"`
520
+ AllowedOrigins []string `mapstructure:"allowed_origins,omitempty "`
521
521
522
522
// AllowedHeaders sets what headers will be allowed in CORS requests.
523
523
// The Accept, Accept-Language, Content-Type, and Content-Language
524
524
// headers are implicitly allowed. If no headers are listed,
525
525
// X-Requested-With will also be accepted by default. Include "*" to
526
526
// allow any request header.
527
- AllowedHeaders []string `mapstructure:"allowed_headers"`
527
+ AllowedHeaders []string `mapstructure:"allowed_headers,omitempty "`
528
528
529
529
// MaxAge sets the value of the Access-Control-Max-Age response header.
530
530
// Set it to the number of seconds that browsers should cache a CORS
531
531
// preflight response for.
532
- MaxAge int `mapstructure:"max_age"`
532
+ MaxAge int `mapstructure:"max_age,omitempty "`
533
533
}
534
534
535
535
// NewDefaultCORSConfig creates a default cross-origin resource sharing (CORS) configuration.
0 commit comments