diff --git a/plugins/inputs/opentelemetry/README.md b/plugins/inputs/opentelemetry/README.md index 2586c5d8c..f1517dab5 100644 --- a/plugins/inputs/opentelemetry/README.md +++ b/plugins/inputs/opentelemetry/README.md @@ -35,6 +35,9 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details. ## Override the default (5s) new connection timeout # timeout = "5s" + ## gRPC Maximum Message Size + # max_msg_size = "4MB" + ## Override the default span attributes to be used as line protocol tags. ## These are always included as tags: ## - trace ID diff --git a/plugins/inputs/opentelemetry/opentelemetry.go b/plugins/inputs/opentelemetry/opentelemetry.go index f34c40158..4bb299c29 100644 --- a/plugins/inputs/opentelemetry/opentelemetry.go +++ b/plugins/inputs/opentelemetry/opentelemetry.go @@ -25,15 +25,15 @@ import ( var sampleConfig string type OpenTelemetry struct { - ServiceAddress string `toml:"service_address"` - SpanDimensions []string `toml:"span_dimensions"` - LogRecordDimensions []string `toml:"log_record_dimensions"` - MetricsSchema string `toml:"metrics_schema"` + ServiceAddress string `toml:"service_address"` + SpanDimensions []string `toml:"span_dimensions"` + LogRecordDimensions []string `toml:"log_record_dimensions"` + MetricsSchema string `toml:"metrics_schema"` + MaxMsgSize config.Size `toml:"max_msg_size"` + Timeout config.Duration `toml:"timeout"` + Log telegraf.Logger `toml:"-"` tls.ServerConfig - Timeout config.Duration `toml:"timeout"` - - Log telegraf.Logger `toml:"-"` listener net.Listener // overridden in tests grpcServer *grpc.Server @@ -59,6 +59,9 @@ func (o *OpenTelemetry) Start(accumulator telegraf.Accumulator) error { if o.Timeout > 0 { grpcOptions = append(grpcOptions, grpc.ConnectionTimeout(time.Duration(o.Timeout))) } + if o.MaxMsgSize > 0 { + grpcOptions = append(grpcOptions, grpc.MaxRecvMsgSize(int(o.MaxMsgSize))) + } logger := &otelLogger{o.Log} influxWriter := &writeToAccumulator{accumulator} diff --git a/plugins/inputs/opentelemetry/sample.conf b/plugins/inputs/opentelemetry/sample.conf index 38d0e2d22..0c7cf7852 100644 --- a/plugins/inputs/opentelemetry/sample.conf +++ b/plugins/inputs/opentelemetry/sample.conf @@ -7,6 +7,9 @@ ## Override the default (5s) new connection timeout # timeout = "5s" + ## gRPC Maximum Message Size + # max_msg_size = "4MB" + ## Override the default span attributes to be used as line protocol tags. ## These are always included as tags: ## - trace ID