You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-13 01:00:22 +02:00
[jaeger] Added WithBatchMaxCount as an option (#931)
This commit is contained in:
@ -42,6 +42,9 @@ type options struct {
|
|||||||
// BufferMaxCount defines the total number of traces that can be buffered in memory
|
// BufferMaxCount defines the total number of traces that can be buffered in memory
|
||||||
BufferMaxCount int
|
BufferMaxCount int
|
||||||
|
|
||||||
|
// BatchMaxCount defines the maximum number of spans sent in one batch
|
||||||
|
BatchMaxCount int
|
||||||
|
|
||||||
Config *sdktrace.Config
|
Config *sdktrace.Config
|
||||||
|
|
||||||
// RegisterGlobal is set to true if the trace provider of the new pipeline should be
|
// RegisterGlobal is set to true if the trace provider of the new pipeline should be
|
||||||
@ -65,6 +68,13 @@ func WithBufferMaxCount(bufferMaxCount int) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithBatchMaxCount defines the maximum number of spans in one batch
|
||||||
|
func WithBatchMaxCount(batchMaxCount int) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.BatchMaxCount = batchMaxCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithSDK sets the SDK config for the exporter pipeline.
|
// WithSDK sets the SDK config for the exporter pipeline.
|
||||||
func WithSDK(config *sdktrace.Config) Option {
|
func WithSDK(config *sdktrace.Config) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
@ -134,6 +144,11 @@ func NewRawExporter(endpointOption EndpointOption, opts ...Option) (*Exporter, e
|
|||||||
bundler.BufferedByteLimit = o.BufferMaxCount
|
bundler.BufferedByteLimit = o.BufferMaxCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The default value bundler uses is 10, increase to send larger batches
|
||||||
|
if o.BatchMaxCount != 0 {
|
||||||
|
bundler.BundleCountThreshold = o.BatchMaxCount
|
||||||
|
}
|
||||||
|
|
||||||
e.bundler = bundler
|
e.bundler = bundler
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user