@@ -20,15 +20,14 @@ import (
20
20
21
21
// Config defines configuration for OTLP exporter.
22
22
type Config struct {
23
- exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
24
- exporterhelper.QueueConfig `mapstructure:"sending_queue"`
25
- RetryConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
23
+ TimeoutConfig exporterhelper.TimeoutConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
24
+ QueueConfig exporterhelper.QueueConfig `mapstructure:"sending_queue"`
25
+ RetryConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
26
+ ClientConfig configgrpc.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
26
27
27
28
// Experimental: This configuration is at the early stage of development and may change without backward compatibility
28
29
// until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved
29
30
BatcherConfig exporterbatcher.Config `mapstructure:"batcher"`
30
-
31
- configgrpc.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
32
31
}
33
32
34
33
func (c * Config ) Validate () error {
@@ -51,15 +50,15 @@ func (c *Config) Validate() error {
51
50
52
51
func (c * Config ) sanitizedEndpoint () string {
53
52
switch {
54
- case strings .HasPrefix (c .Endpoint , "http://" ):
55
- return strings .TrimPrefix (c .Endpoint , "http://" )
56
- case strings .HasPrefix (c .Endpoint , "https://" ):
57
- return strings .TrimPrefix (c .Endpoint , "https://" )
58
- case strings .HasPrefix (c .Endpoint , "dns://" ):
53
+ case strings .HasPrefix (c .ClientConfig . Endpoint , "http://" ):
54
+ return strings .TrimPrefix (c .ClientConfig . Endpoint , "http://" )
55
+ case strings .HasPrefix (c .ClientConfig . Endpoint , "https://" ):
56
+ return strings .TrimPrefix (c .ClientConfig . Endpoint , "https://" )
57
+ case strings .HasPrefix (c .ClientConfig . Endpoint , "dns://" ):
59
58
r := regexp .MustCompile ("^dns://[/]?" )
60
- return r .ReplaceAllString (c .Endpoint , "" )
59
+ return r .ReplaceAllString (c .ClientConfig . Endpoint , "" )
61
60
default :
62
- return c .Endpoint
61
+ return c .ClientConfig . Endpoint
63
62
}
64
63
}
65
64
0 commit comments