[Metrics] Datapoints follow OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - #1293
[Metrics] Datapoints follow OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE#1293KennanHunter wants to merge 11 commits into
Conversation
…FERENCE in both [otel] section and env var form
and AggregationTemporality easier to read
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Also added support to send the starting timestamp for a metric, in accordance with OTEL spec. |
06bc862 to
bf698cd
Compare
|
Looking at https://docs.datadoghq.com/opentelemetry/guide/otlp_delta_temporality/?tab=python#overview
I don't know quite what "works best" means, but it might be worth going out of spec and using delta as the default to just not break stuff. Weird. |
|
Matching docs update pgdogdev/docs@main...KennanHunter:docs-1:otel-temporality-docs |
|
Nice! I will review tomorrow first thing!
IIRC, last time I tested this with DD, it only worked with delta. So, maybe we can default it it to delta if pgdog/pgdog-config/src/otel.rs Line 55 in e37160d |
|
Great! I'll probably have an hour tonight to add that Datadog behavior, update and PR the documentation, and make any other changes you'd like to see. I also wanted to quickly sneak in something to handle the case where these environment variables are defined but Final thing: Would you be interested in this graphana_prometheus example? I could clean it (currently largely the work of Claude) and throw up a PR. I mostly implemented it for the sweet dopamine release of seeing that locked percent gauge redline. |
I think you should be able to make it a not-Option in
Yes definitely. More examples = better!
I need to test this manually against our DD account. I can do it quick, it's not an issue. The OTEL exporter was developed against datadog (it was me, my friend Claude and a DD dashboard), so I want to double check it still works there. |
|
Sorry for delay here. The day got away from me a bit. I still need to double check this works against Datadog. 👍 |
|
Useful info from https://docs.datadoghq.com/opentelemetry/guide/otlp_delta_temporality/?tab=python#implications-of-using-cumulative-aggregation-temporality:
|
variables fixes issue with missing [otel] section dropping environment variables
|
Trying a new pattern. Let me know how you like it. If you do, we could in the future look at pulling this out and using it in other configuration spots if that proves useful. For every
If we set cumulative explicitly but have datadog's api key present it gives a pretty detailed warning as to why that's a bad idea, silence-able with a env var incase anyone finds a reason to want that behavior. Take your time getting that datadog integration tested. When this does get merged, I'll throw up the PR for the grafana example just to keep history simple. |
Adds a example runnable with a single `docker compose up` that connects a grafana dashboard. <img width="1096" height="679" alt="2026-08-02_08-18" src="https://github.com/user-attachments/assets/60739c7c-e026-41a1-9371-de00f6013f6e" /> Dependent on #1293

Closes #1289
Wires OTEL metric exports up to
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCEso operators can pick delta, cumulative, or low-memory temporality per the spec.Opinions
OtelTemporalityPreferencefrom both the env var and the[otel]config section, aligned with OTEL's spec (env var read, customDeserialize).OpenMetricto a real enum for metric type instead of magic strings, so adding future variants like histogram stays ergonomic (OpenMetricType).value_for_data_point,wrap_data_points,build_attributes).I think before merge some level of integration testing could be nice. How would you go about that @levish0 ? We could also add Prometheus+graphana in the examples folder and include a graphana dashboard script.
The default export has been changed from Delta to Cumulative to match spec. I assume DataDog should have no issue with that, but it might be good for someone familiar with it to test it.