[EXPORTER] add OTLP HTTP metric exporter benchmark#3801
[EXPORTER] add OTLP HTTP metric exporter benchmark#3801lalitb merged 1 commit intoopen-telemetry:mainfrom
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3801 +/- ##
==========================================
+ Coverage 89.91% 89.93% +0.02%
==========================================
Files 225 225
Lines 7163 7163
==========================================
+ Hits 6440 6441 +1
+ Misses 723 722 -1 🚀 New features to boost your workflow:
|
49306b3 to
c21ea2a
Compare
|
@marcalff I’ve fixed the formatting / IWYU issues flagged by CI. |
Introduce a Google Benchmark-based performance benchmark for the OTLP HTTP metric exporter, covering both binary (protobuf) and JSON encodings. Key changes: - Add `otlp_http_metric_exporter_benchmark` target under `WITH_BENCHMARK && WITH_OTLP_HTTP`. - Benchmark `OtlpHttpMetricExporter::Export()` across increasing numbers of metric data points (1 → 10,000). - Measure export cost for both binary and JSON content types. - Disable retries and logging to reduce noise and isolate exporter overhead. This benchmark provides a baseline for evaluating export performance and future optimizations in the OTLP HTTP metric exporter. Fix resource lifetime in OTLP HTTP metric exporter benchmark fix CI build errors in HTTP metric exporter benchmark
c21ea2a to
769f87d
Compare
| static void BM_OtlpHttpMetricExporter_Export_Binary(benchmark::State &state) | ||
| { | ||
| OtlpHttpMetricExporterOptions opts; | ||
| opts.url = "http://localhost:4318/v1/metrics"; |
There was a problem hiding this comment.
Seems this benchmark attempts real HTTP calls that fail immediately with connection refused. Even a failed connection attempt adds ~10-100μs of overhead, which becomes significant when serialization itself takes only nanoseconds (especially for small payloads).
See how gRPC benchmark avoid this be mocking the network layer entirely. Something we can try here ?
There was a problem hiding this comment.
Agreed, even a failed HTTP attempt adds non-trivial overhead for smaller payload sizes, where serialization itself is very cheap.
Unlike gRPC, the HTTP metric exporter doesn’t currently expose a public way to inject a no-send transport. The only existing injection path goes through test-only peers, and I avoided reusing that here since this is a benchmark target and not built with test permissions.
Longer term, possible options could be (1) making the HTTP client injectable via a public API, (2) reusing the existing test peer, or (3) introducing a dedicated benchmark peer. But all of these require changes to exporter headers or test/benchmark boundaries and felt out of scope for this PR. For now, this benchmark measures Export() through the public API with retries and logging disabled.
There was a problem hiding this comment.
Thanks for clarifying. Agree with the constraints. For future, reusing the existing test peer infrastructure might be the most practical option, but that's not necessary for this PR to be valuable. I’m okay with landing this as a first baseline and revisiting injection options in a follow-up.
|
Not tested, but if I understand correctly, one can:
so this is useful already in a dev environment, independently of CI, with zero code changes. Ok to merge. |
marcalff
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution.
exporters/otlp: add HTTP metric exporter benchmark (open-telemetry#3801)
Introduce a Google Benchmark-based performance benchmark for the OTLP HTTP metric exporter, covering both binary (protobuf) and JSON encodings.
Key changes:
otlp_http_metric_exporter_benchmarktarget underWITH_BENCHMARK && WITH_OTLP_HTTP.OtlpHttpMetricExporter::Export()across increasing numbers of metric data points (1 → 10,000).This benchmark provides a baseline for evaluating export performance and future optimizations in the OTLP HTTP metric exporter.
Fixes # (issue)
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes