Skip to content

Refactor Logs SDK Batch Processor#3

Draft
wmdanor wants to merge 4 commits intomainfrom
logs-batch-refactor
Draft

Refactor Logs SDK Batch Processor#3
wmdanor wants to merge 4 commits intomainfrom
logs-batch-refactor

Conversation

@wmdanor
Copy link
Copy Markdown
Owner

@wmdanor wmdanor commented Apr 5, 2025

Implements idea from open-telemetry#6569 (comment).

Refactors Batch Processor to unify logic from bufferExporter and chunkExporter inside itself.

Benchmarks

go test -run=^$ '-bench=BenchmarkProcessor/.*Batch' -benchmem -count=10 > xxx.txt
benchstat base.txt new.txt
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: AMD Ryzen 9 7900X 12-Core Processor            
                                │   base.txt   │               new.txt               │
                                │    sec/op    │   sec/op     vs base                │
Processor/Batch-24                623.3n ±  7%   487.6n ± 5%  -21.77% (p=0.000 n=10)
Processor/BatchDelayExporter-24   492.1n ± 10%   586.3n ± 4%  +19.15% (p=0.000 n=10)
Processor/SetTimestampBatch-24    653.0n ±  4%   463.8n ± 5%  -28.97% (p=0.000 n=10)
Processor/AddAttributesBatch-24   636.4n ±  5%   514.6n ± 8%  -19.13% (p=0.000 n=10)
Processor/SetAttributesBatch-24   584.0n ± 12%   434.4n ± 3%  -25.62% (p=0.000 n=10)
geomean                           594.8n         494.7n       -16.82%

                                │  base.txt   │              new.txt               │
                                │    B/op     │    B/op     vs base                │
Processor/Batch-24                1154.0 ± 3%   617.5 ± 2%  -46.49% (p=0.000 n=10)
Processor/BatchDelayExporter-24    471.5 ± 1%   492.0 ± 0%   +4.35% (p=0.000 n=10)
Processor/SetTimestampBatch-24    1157.0 ± 1%   606.5 ± 1%  -47.58% (p=0.000 n=10)
Processor/AddAttributesBatch-24   1169.0 ± 1%   612.0 ± 1%  -47.65% (p=0.000 n=10)
Processor/SetAttributesBatch-24   1154.5 ± 2%   611.5 ± 1%  -47.03% (p=0.000 n=10)
geomean                            967.9        585.8       -39.48%

                                │  base.txt  │               new.txt               │
                                │ allocs/op  │ allocs/op   vs base                 │
Processor/Batch-24                1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/BatchDelayExporter-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetTimestampBatch-24    1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/AddAttributesBatch-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Processor/SetAttributesBatch-24   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                           1.000        1.000       +0.00%
¹ all samples are equal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant