Skip to content

Commit 4dec0ad

Browse files
authored
[jaeger] Added WithBatchMaxCount as an option (#931)
1 parent d979977 commit 4dec0ad

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

exporters/trace/jaeger/jaeger.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ type options struct {
4242
// BufferMaxCount defines the total number of traces that can be buffered in memory
4343
BufferMaxCount int
4444

45+
// BatchMaxCount defines the maximum number of spans sent in one batch
46+
BatchMaxCount int
47+
4548
Config *sdktrace.Config
4649

4750
// RegisterGlobal is set to true if the trace provider of the new pipeline should be
@@ -65,6 +68,13 @@ func WithBufferMaxCount(bufferMaxCount int) Option {
6568
}
6669
}
6770

71+
// WithBatchMaxCount defines the maximum number of spans in one batch
72+
func WithBatchMaxCount(batchMaxCount int) Option {
73+
return func(o *options) {
74+
o.BatchMaxCount = batchMaxCount
75+
}
76+
}
77+
6878
// WithSDK sets the SDK config for the exporter pipeline.
6979
func WithSDK(config *sdktrace.Config) Option {
7080
return func(o *options) {
@@ -134,6 +144,11 @@ func NewRawExporter(endpointOption EndpointOption, opts ...Option) (*Exporter, e
134144
bundler.BufferedByteLimit = o.BufferMaxCount
135145
}
136146

147+
// The default value bundler uses is 10, increase to send larger batches
148+
if o.BatchMaxCount != 0 {
149+
bundler.BundleCountThreshold = o.BatchMaxCount
150+
}
151+
137152
e.bundler = bundler
138153
return e, nil
139154
}

0 commit comments

Comments
 (0)