Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inputs.opentelemetry): Add option to set max receive message size #15231

Merged
merged 1 commit into from
May 2, 2024
Merged
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
3 changes: 3 additions & 0 deletions plugins/inputs/opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions plugins/inputs/opentelemetry/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions plugins/inputs/opentelemetry/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
## Override the default (5s) new connection timeout
# timeout = "5s"

## gRPC Maximum Message Size
# max_msg_size = "4MB"
srebhan marked this conversation as resolved.
Show resolved Hide resolved

## Override the default span attributes to be used as line protocol tags.
## These are always included as tags:
## - trace ID
Expand Down
Loading