Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/component/otelcol/auth/bearer/bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (args *Arguments) SetToDefault() {
}

func (args Arguments) convert() (otelcomponent.Config, error) {
return &bearertokenauthextension.Config{
Scheme: args.Scheme,
BearerToken: configopaque.String(args.Token),
Header: args.Header,
}, nil
cfg := bearertokenauthextension.NewFactory().CreateDefaultConfig().(*bearertokenauthextension.Config)
cfg.Scheme = args.Scheme
cfg.BearerToken = configopaque.String(args.Token)
cfg.Header = args.Header
return cfg, nil
}

// ConvertClient implements auth.Arguments.
Expand Down
18 changes: 8 additions & 10 deletions internal/component/otelcol/auth/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ func (args Arguments) Validate() error {

// ConvertClient implements auth.Arguments.
func (args Arguments) ConvertClient() (otelcomponent.Config, error) {
return &collectorgoogleauth.Config{
Config: googleclientauthextension.Config{
Project: args.Project,
QuotaProject: args.QuotaProject,
TokenType: args.TokenType,
Audience: args.Audience,
TokenHeader: args.TokenHeader,
Scopes: args.Scopes,
},
}, nil
cfg := collectorgoogleauth.NewFactory().CreateDefaultConfig().(*collectorgoogleauth.Config)
cfg.Config.Project = args.Project
cfg.Config.QuotaProject = args.QuotaProject
cfg.Config.TokenType = args.TokenType
cfg.Config.Audience = args.Audience
cfg.Config.TokenHeader = args.TokenHeader
cfg.Config.Scopes = args.Scopes
return cfg, nil
}

// ConvertServer returns nil since the ouath2 client extension does not support server auth.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
// convertImpl returns the concrete upstream config type so it can be reused by
// both Convert and Validate.
func (args Arguments) convertImpl() *config.Config {
return &config.Config{
Spans: convertMetricInfos(args.Spans),
Datapoints: convertMetricInfos(args.Datapoints),
Logs: convertMetricInfos(args.Logs),
ErrorMode: args.ErrorMode,
}
cfg := signaltometricsconnector.NewFactory().CreateDefaultConfig().(*config.Config)
cfg.Spans = convertMetricInfos(args.Spans)
cfg.Datapoints = convertMetricInfos(args.Datapoints)
cfg.Logs = convertMetricInfos(args.Logs)
cfg.ErrorMode = args.ErrorMode
return cfg
}

// Extensions implements connector.Arguments.
Expand Down
10 changes: 5 additions & 5 deletions internal/component/otelcol/exporter/faro/faro.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
if err != nil {
return nil, err
}
return &faroexporter.Config{
ClientConfig: *convertedClientArgs,
QueueConfig: q,
RetryConfig: *args.Retry.Convert(),
}, nil
cfg := faroexporter.NewFactory().CreateDefaultConfig().(*faroexporter.Config)
cfg.ClientConfig = *convertedClientArgs
cfg.QueueConfig = q
cfg.RetryConfig = *args.Retry.Convert()
return cfg, nil
}

func (args *Arguments) Validate() error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
return nil, err
}

return &loadbalancingexporter.Config{
Protocol: *protocol,
Resolver: args.Resolver.Convert(),
RoutingKey: args.RoutingKey,
TimeoutSettings: exporterhelper.TimeoutConfig{
Timeout: args.Timeout,
},
BackOffConfig: *args.Retry.Convert(),
QueueSettings: q,
}, nil
cfg := loadbalancingexporter.NewFactory().CreateDefaultConfig().(*loadbalancingexporter.Config)
cfg.Protocol = *protocol
cfg.Resolver = args.Resolver.Convert()
cfg.RoutingKey = args.RoutingKey
cfg.TimeoutSettings = exporterhelper.TimeoutConfig{
Timeout: args.Timeout,
}
cfg.BackOffConfig = *args.Retry.Convert()
cfg.QueueSettings = q
return cfg, nil
}

// Protocol holds the individual protocol-specific settings. Only OTLP is supported at the moment.
Expand Down Expand Up @@ -187,14 +187,14 @@ func (oc OtlpConfig) Convert() (*otlpexporter.Config, error) {
return nil, err
}

return &otlpexporter.Config{
TimeoutConfig: exporterhelper.TimeoutConfig{
Timeout: oc.Timeout,
},
QueueConfig: q,
RetryConfig: *oc.Retry.Convert(),
ClientConfig: *clientConfig,
}, nil
cfg := otlpexporter.NewFactory().CreateDefaultConfig().(*otlpexporter.Config)
cfg.TimeoutConfig = exporterhelper.TimeoutConfig{
Timeout: oc.Timeout,
}
cfg.QueueConfig = q
cfg.RetryConfig = *oc.Retry.Convert()
cfg.ClientConfig = *clientConfig
return cfg, nil
}

// ResolverSettings defines the configurations for the backend resolver
Expand Down
14 changes: 6 additions & 8 deletions internal/component/otelcol/exporter/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
if err != nil {
return nil, err
}
return &otlpexporter.Config{
TimeoutConfig: otelpexporterhelper.TimeoutConfig{
Timeout: args.Timeout,
},
QueueConfig: q,
RetryConfig: *args.Retry.Convert(),
ClientConfig: *convertedClientArgs,
}, nil
cfg := otlpexporter.NewFactory().CreateDefaultConfig().(*otlpexporter.Config)
cfg.TimeoutConfig = otelpexporterhelper.TimeoutConfig{Timeout: args.Timeout}
cfg.QueueConfig = q
cfg.RetryConfig = *args.Retry.Convert()
cfg.ClientConfig = *convertedClientArgs
return cfg, nil
}

// Extensions implements exporter.Arguments.
Expand Down
18 changes: 9 additions & 9 deletions internal/component/otelcol/exporter/otlphttp/otlphttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
if err != nil {
return nil, err
}
return &otlphttpexporter.Config{
ClientConfig: *convertedClientArgs,
QueueConfig: q,
RetryConfig: *args.Retry.Convert(),
TracesEndpoint: args.TracesEndpoint,
MetricsEndpoint: args.MetricsEndpoint,
LogsEndpoint: args.LogsEndpoint,
Encoding: otlphttpexporter.EncodingType(args.Encoding),
}, nil
cfg := otlphttpexporter.NewFactory().CreateDefaultConfig().(*otlphttpexporter.Config)
cfg.ClientConfig = *convertedClientArgs
cfg.QueueConfig = q
cfg.RetryConfig = *args.Retry.Convert()
cfg.TracesEndpoint = args.TracesEndpoint
cfg.MetricsEndpoint = args.MetricsEndpoint
cfg.LogsEndpoint = args.LogsEndpoint
cfg.Encoding = otlphttpexporter.EncodingType(args.Encoding)
return cfg, nil
}

// Extensions implements exporter.Arguments.
Expand Down
14 changes: 7 additions & 7 deletions internal/component/otelcol/processor/batch/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &batchprocessor.Config{
Timeout: args.Timeout,
SendBatchSize: args.SendBatchSize,
SendBatchMaxSize: args.SendBatchMaxSize,
MetadataKeys: args.MetadataKeys,
MetadataCardinalityLimit: args.MetadataCardinalityLimit,
}, nil
cfg := batchprocessor.NewFactory().CreateDefaultConfig().(*batchprocessor.Config)
cfg.Timeout = args.Timeout
cfg.SendBatchSize = args.SendBatchSize
cfg.SendBatchMaxSize = args.SendBatchMaxSize
cfg.MetadataKeys = args.MetadataKeys
cfg.MetadataCardinalityLimit = args.MetadataCardinalityLimit
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &deltatocumulativeprocessor.Config{
MaxStale: args.MaxStale,
MaxStreams: args.MaxStreams,
}, nil
cfg := deltatocumulativeprocessor.NewFactory().CreateDefaultConfig().(*deltatocumulativeprocessor.Config)
cfg.MaxStale = args.MaxStale
cfg.MaxStreams = args.MaxStreams
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &groupbyattrsprocessor.Config{
GroupByKeys: args.Keys,
}, nil
cfg := groupbyattrsprocessor.NewFactory().CreateDefaultConfig().(*groupbyattrsprocessor.Config)
cfg.GroupByKeys = args.Keys
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
8 changes: 4 additions & 4 deletions internal/component/otelcol/processor/interval/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &intervalprocessor.Config{
Interval: args.Interval,
PassThrough: args.PassThrough.Convert(),
}, nil
cfg := intervalprocessor.NewFactory().CreateDefaultConfig().(*intervalprocessor.Config)
cfg.Interval = args.Interval
cfg.PassThrough = args.PassThrough.Convert()
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &metricstarttimeprocessor.Config{
Strategy: args.Strategy,
GCInterval: args.GCInterval,
StartTimeMetricRegex: args.StartTimeMetricRegex,
}, nil
cfg := metricstarttimeprocessor.NewFactory().CreateDefaultConfig().(*metricstarttimeprocessor.Config)
cfg.Strategy = args.Strategy
cfg.GCInterval = args.GCInterval
cfg.StartTimeMetricRegex = args.StartTimeMetricRegex
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ func (args *Arguments) Validate() error {

// Convert implements processor.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &probabilisticsamplerprocessor.Config{
SamplingPercentage: args.SamplingPercentage,
HashSeed: args.HashSeed,
Mode: probabilisticsamplerprocessor.SamplerMode(args.Mode),
FailClosed: args.FailClosed,
SamplingPrecision: args.SamplingPrecision,
AttributeSource: probabilisticsamplerprocessor.AttributeSource(args.AttributeSource),
FromAttribute: args.FromAttribute,
SamplingPriority: args.SamplingPriority,
}, nil
cfg := probabilisticsamplerprocessor.NewFactory().CreateDefaultConfig().(*probabilisticsamplerprocessor.Config)
cfg.SamplingPercentage = args.SamplingPercentage
cfg.HashSeed = args.HashSeed
cfg.Mode = probabilisticsamplerprocessor.SamplerMode(args.Mode)
cfg.FailClosed = args.FailClosed
cfg.SamplingPrecision = args.SamplingPrecision
cfg.AttributeSource = probabilisticsamplerprocessor.AttributeSource(args.AttributeSource)
cfg.FromAttribute = args.FromAttribute
cfg.SamplingPriority = args.SamplingPriority
return cfg, nil
}

// Extensions implements processor.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func (args *Arguments) SetToDefault() {

// Convert implements receiver.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &awsecscontainermetricsreceiver.Config{
CollectionInterval: args.CollectionInterval,
}, nil
cfg := awsecscontainermetricsreceiver.NewFactory().CreateDefaultConfig().(*awsecscontainermetricsreceiver.Config)
cfg.CollectionInterval = args.CollectionInterval
return cfg, nil
}

// Extensions implements receiver.Arguments.
Expand Down
6 changes: 3 additions & 3 deletions internal/component/otelcol/receiver/faro/faro.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
return nil, err
}

return &faroreceiver.Config{
ServerConfig: *httpServerConfig,
}, nil
cfg := faroreceiver.NewFactory().CreateDefaultConfig().(*faroreceiver.Config)
cfg.ServerConfig = *httpServerConfig
return cfg, nil
}

// Extensions implements receiver.Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,25 @@ func (args *Arguments) Validate() error {
}

func (args Arguments) Convert() (otelcomponent.Config, error) {
otelConfig := &googlecloudpubsubreceiver.Config{
ProjectID: args.ProjectID,
UserAgent: args.UserAgent,
Endpoint: args.Endpoint,
UniverseDomain: args.UniverseDomain,
Insecure: args.Insecure,
Subscription: args.Subscription,
Encoding: args.Encoding,
Compression: args.Compression,
IgnoreEncodingError: args.IgnoreEncodingError,
ClientID: args.ClientID,
TimeoutSettings: exporterhelper.TimeoutConfig{
Timeout: args.Timeout,
},
FlowControlConfig: googlecloudpubsubreceiver.FlowControlConfig{
TriggerAckBatchDuration: args.FlowControl.TriggerAckBatchDuration,
StreamAckDeadline: args.FlowControl.StreamAckDeadline,
MaxOutstandingMessages: args.FlowControl.MaxOutstandingMessages,
MaxOutstandingBytes: args.FlowControl.MaxOutstandingBytes,
},
otelConfig := googlecloudpubsubreceiver.NewFactory().CreateDefaultConfig().(*googlecloudpubsubreceiver.Config)
otelConfig.ProjectID = args.ProjectID
otelConfig.UserAgent = args.UserAgent
otelConfig.Endpoint = args.Endpoint
otelConfig.UniverseDomain = args.UniverseDomain
otelConfig.Insecure = args.Insecure
otelConfig.Subscription = args.Subscription
otelConfig.Encoding = args.Encoding
otelConfig.Compression = args.Compression
otelConfig.IgnoreEncodingError = args.IgnoreEncodingError
otelConfig.ClientID = args.ClientID
otelConfig.TimeoutSettings = exporterhelper.TimeoutConfig{
Timeout: args.Timeout,
}
otelConfig.FlowControlConfig = googlecloudpubsubreceiver.FlowControlConfig{
TriggerAckBatchDuration: args.FlowControl.TriggerAckBatchDuration,
StreamAckDeadline: args.FlowControl.StreamAckDeadline,
MaxOutstandingMessages: args.FlowControl.MaxOutstandingMessages,
MaxOutstandingBytes: args.FlowControl.MaxOutstandingBytes,
}

return otelConfig, nil
Expand Down
6 changes: 3 additions & 3 deletions internal/component/otelcol/receiver/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
return nil, err
}

return &influxdbreceiver.Config{
ServerConfig: *serverConfig.Get(),
}, nil
cfg := influxdbreceiver.NewFactory().CreateDefaultConfig().(*influxdbreceiver.Config)
cfg.ServerConfig = *serverConfig.Get()
return cfg, nil
}

// Extensions implements receiver.Arguments.
Expand Down
8 changes: 4 additions & 4 deletions internal/component/otelcol/receiver/zipkin/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
if err != nil {
return nil, err
}
return &zipkinreceiver.Config{
ParseStringTags: args.ParseStringTags,
ServerConfig: *httpServerConfig,
}, nil
cfg := zipkinreceiver.NewFactory().CreateDefaultConfig().(*zipkinreceiver.Config)
cfg.ParseStringTags = args.ParseStringTags
cfg.ServerConfig = *httpServerConfig
return cfg, nil
}

// Extensions implements receiver.Arguments.
Expand Down
Loading