Skip to content

Commit cb892b8

Browse files
authored
Remove concurrent batch processor in-flight bytes (#247)
This leaves the in-flight metric, which is still useful. Receivers should perform admission control or another form of memory limit should be used.
1 parent a2a35ab commit cb892b8

File tree

8 files changed

+41
-181
lines changed

8 files changed

+41
-181
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
99
## Unreleased
1010

1111
- Concurrent batch processor: tracing improvements. [#238](https://github.com/open-telemetry/otel-arrow/pull/238), [#241](https://github.com/open-telemetry/otel-arrow/pull/241)
12-
- Concurrent batch processor: support disabling in-flight limits. [#243](https://github.com/open-telemetry/otel-arrow/pull/243)
1312
- Update to latest OTel-Collector & OTel-Go dependencies. Remove collector packages now included in collector-contrib/internal/otelarrow. [#245](https://github.com/open-telemetry/otel-arrow/pull/245)
13+
- Concurrent batch processor: remove support for in-flight limits. [#247](https://github.com/open-telemetry/otel-arrow/pull/248)
1414

1515
## [0.25.0](https://github.com/open-telemetry/otel-arrow/releases/tag/v0.24.0) - 2024-07-17
1616

collector/processor/concurrentbatchprocessor/README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ The differences in this component, relative to that component are:
77

88
1. Synchronous pipeline support: this component blocks each producer
99
until the request returns with success or an error status code.
10-
2. Maximim in-flight-bytes setting. This component measures the
11-
in-memory size of each request it admits to the pipeline and
12-
otherwise stalls requests until they timeout. This function is
13-
disabled by `max_in_flight_size_mib: 0`.
14-
3. Unlimited concurrency: this component will start as many goroutines
10+
2. Unlimited concurrency: this component will start as many goroutines
1511
as needed to send batches through the pipeline.
1612

1713
Here is an example configuration:
@@ -22,7 +18,6 @@ Here is an example configuration:
2218
send_batch_max_size: 1500
2319
send_batch_size: 1000
2420
timeout: 1s
25-
max_in_flight_size_mib: 128
2621
```
2722

2823
In this configuration, the component will admit up to 128MiB of

collector/processor/concurrentbatchprocessor/batch_processor.go

-22
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"go.opentelemetry.io/otel/trace"
1919
"go.uber.org/multierr"
2020
"go.uber.org/zap"
21-
"golang.org/x/sync/semaphore"
2221

2322
"go.opentelemetry.io/collector/client"
2423
"go.opentelemetry.io/collector/component"
@@ -70,10 +69,6 @@ type batchProcessor struct {
7069
// batcher will be either *singletonBatcher or *multiBatcher
7170
batcher batcher
7271

73-
// in-flight bytes limit mechanism
74-
limitBytes int64
75-
sem *semaphore.Weighted
76-
7772
tracer trace.TracerProvider
7873
}
7974

@@ -171,8 +166,6 @@ func newBatchProcessor(set processor.Settings, cfg *Config, batchFunc func() bat
171166
}
172167
sort.Strings(mks)
173168

174-
limitBytes := int64(cfg.MaxInFlightSizeMiB) << 20
175-
176169
tp := set.TelemetrySettings.TracerProvider
177170
if tp == nil {
178171
tp = otel.GetTracerProvider()
@@ -188,14 +181,9 @@ func newBatchProcessor(set processor.Settings, cfg *Config, batchFunc func() bat
188181
shutdownC: make(chan struct{}, 1),
189182
metadataKeys: mks,
190183
metadataLimit: int(cfg.MetadataCardinalityLimit),
191-
limitBytes: limitBytes,
192184
tracer: tp,
193185
}
194186

195-
if limitBytes != 0 {
196-
bp.sem = semaphore.NewWeighted(limitBytes)
197-
}
198-
199187
if len(bp.metadataKeys) == 0 {
200188
bp.batcher = &singleShardBatcher{batcher: bp.newShard(nil)}
201189
} else {
@@ -459,9 +447,6 @@ func allSame(x []context.Context) bool {
459447

460448
func (bp *batchProcessor) countAcquire(ctx context.Context, bytes int64) error {
461449
var err error
462-
if bp.sem != nil {
463-
err = bp.sem.Acquire(ctx, bytes)
464-
}
465450
if err == nil && bp.telemetry.batchInFlightBytes != nil {
466451
bp.telemetry.batchInFlightBytes.Add(ctx, bytes, bp.telemetry.processorAttrOption)
467452
}
@@ -472,9 +457,6 @@ func (bp *batchProcessor) countRelease(bytes int64) {
472457
if bp.telemetry.batchInFlightBytes != nil {
473458
bp.telemetry.batchInFlightBytes.Add(context.Background(), -bytes, bp.telemetry.processorAttrOption)
474459
}
475-
if bp.sem != nil {
476-
bp.sem.Release(bytes)
477-
}
478460
}
479461

480462
func (b *shard) consumeAndWait(ctx context.Context, data any) error {
@@ -502,10 +484,6 @@ func (b *shard) consumeAndWait(ctx context.Context, data any) error {
502484
}
503485
bytes := int64(b.batch.sizeBytes(data))
504486

505-
if bytes > b.processor.limitBytes {
506-
return fmt.Errorf("request size exceeds max-in-flight bytes: %d", bytes)
507-
}
508-
509487
err := b.processor.countAcquire(ctx, bytes)
510488
if err != nil {
511489
return err

0 commit comments

Comments
 (0)