Skip to content

feat(otlp): support OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE#3351

Merged
cijothomas merged 3 commits intoopen-telemetry:mainfrom
codefromthecrypt:temporality
Feb 17, 2026
Merged

feat(otlp): support OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE#3351
cijothomas merged 3 commits intoopen-telemetry:mainfrom
codefromthecrypt:temporality

Conversation

@codefromthecrypt
Copy link
Copy Markdown
Contributor

@codefromthecrypt codefromthecrypt commented Feb 15, 2026

Relates to #3283, #3061

Changes

Add support for OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE environment variable
per the OTLP Metrics Exporter spec.

This env var is supported by Go, Python, .NET, JS, PHP, and Ruby SDKs but was missing
from the Rust SDK, requiring users to manually parse it.

Accepted values (case-insensitive): cumulative (default), delta, lowmemory.
Programmatic .with_temporality() takes priority over the env var.

  • FromStr impl for Temporality in opentelemetry-sdk
  • OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE constant and resolve_temporality() in opentelemetry-otlp
  • MetricExporterBuilder resolves temporality from env when not set programmatically
  • ExporterBuildError::InvalidConfig variant for invalid env var values

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 95.49550% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.2%. Comparing base (7087f65) to head (0baf5dd).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-otlp/src/metric.rs 93.9% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #3351    +/-   ##
======================================
  Coverage   82.2%   82.2%            
======================================
  Files        128     128            
  Lines      24518   24626   +108     
======================================
+ Hits       20161   20267   +106     
- Misses      4357    4359     +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codefromthecrypt codefromthecrypt changed the title feat(otlp): support OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE env var feat(otlp): support OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE Feb 15, 2026
@cijothomas cijothomas closed this Feb 16, 2026
@cijothomas cijothomas reopened this Feb 16, 2026
Comment thread opentelemetry-otlp/src/exporter/mod.rs Outdated
Comment thread opentelemetry-otlp/src/metric.rs Outdated

## vNext

- Add support for `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 nicely written!

Comment thread opentelemetry-sdk/CHANGELOG.md Outdated
Copy link
Copy Markdown
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left few minor nits - could you address them so I can approve and merge.

… env var

Add support for the OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
environment variable per the OTLP Metrics Exporter spec. Accepted
values (case-insensitive): cumulative (default), delta, lowmemory.
Programmatic .with_temporality() takes priority over the env var.

- Add FromStr impl for Temporality in opentelemetry-sdk
- Add resolve_temporality() in opentelemetry-otlp to resolve from
  builder config, env var, or default
- Update MetricExporterBuilder to use Option<Temporality> and resolve
  at build time

Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt
Copy link
Copy Markdown
Contributor Author

I think I got it. thanks for the quick feedback!

Signed-off-by: Adrian Cole <[email protected]>
Copy link
Copy Markdown
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cijothomas cijothomas merged commit a784e16 into open-telemetry:main Feb 17, 2026
27 checks passed
@codefromthecrypt codefromthecrypt deleted the temporality branch March 5, 2026 06:42
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.

2 participants