open-telemetry / open-telemetry/opentelemetry-python

sdk/metrics: performance impact of exemplars support even when configured as `always_off`

Open
#4,243 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

metrics sdk
Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
4d 15h
Merged PRs (30d)
19

Description

After https://github.com/open-telemetry/opentelemetry-python/commit/d5fb2c4189a561bd36186d19923373761d4b3e7a got merged we had a huge drop on iter/sec in metrics SDK benchmark for all metric types:

image

It seems expected when the Exemplars feature is enabled (the default behavior), but according to the spec, setting the exemplar filter to always_off shouldn't introduce any overhead. Running the benchmark locally, we still have the same overhead even when "disabling" (set to always_off) the Exemplars feature.

AlwaysOff
An ExemplarFilter which makes no measurements eligible for being an Exemplar. Using this ExemplarFilter is as good as disabling Exemplar feature.

Benchmark Results Summary
Metric before exemplars https://github.com/open-telemetry/opentelemetry-python/commit/a8aacb0c6f2f06bf19b501d98e62f7c0e667fa4c trace_based (main) always_off (main)
Min (µs) 8.3550 13.1880 13.1440
Max (µs) 23.5780 36.9060 94.2870
Mean (µs) 8.9926 14.4266 16.6942
StdDev (µs) 1.0477 2.6945 10.0739
Median (µs) 8.7910 13.8030 13.9150
IQR (µs) 0.2520 0.5620 0.5935
OPS (Kops/s) 111.2024 69.3162 59.9010
Rounds 690 273 277
Iterations 1 1 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing commit d5fb2c4189a561bd36186d19923373761d4b3e7a and the metrics SDK benchmark described in the issue, comparing the always_off path with the pre-exemplar baseline. Confirm the benchmark under always_off and other filters; done means eliminating avoidable always_off overhead without changing exemplar behavior for other configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.