Skip to content
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Initialize map with `len(keys)` in `NewAllowKeysFilter` and `NewDenyKeysFilter` to avoid unnecessary allocations in `go.opentelemetry.io/otel/attribute`. (#6455)
- `go.opentelemetry.io/otel/log/logtest` is now a separate Go module. (#6465)
- `go.opentelemetry.io/otel/sdk/log/logtest` is now a separate Go module. (#6466)
- Improve performance of `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` by not exporting when exporter cannot accept more. (#6569)
- Improve performance of `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` by not exporting when exporter cannot accept more. (#6569, #6641)

### Deprecated

Expand Down
4 changes: 3 additions & 1 deletion sdk/log/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (b *BatchProcessor) poll(interval time.Duration) (done chan struct{}) {
global.Warn("dropped log records", "dropped", d)
}

qLen := b.q.Len()
var qLen int
// Don't copy data from queue unless exporter can accept more, it is very expensive.
if b.exporter.Ready() {
qLen = b.q.TryDequeue(buf, func(r []Record) bool {
Expand All @@ -166,6 +166,8 @@ func (b *BatchProcessor) poll(interval time.Duration) (done chan struct{}) {
}
return ok
})
} else {
qLen = b.q.Len()
}

if qLen >= b.batchSize {
Expand Down
Loading