feat(exporter-metrics-otlp-http): respect OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION - #6874
Open
buzztaiki wants to merge 5 commits into
Open
Conversation
…DEFAULT_HISTOGRAM_AGGREGATION
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6874 +/- ##
=======================================
Coverage 95.08% 95.09%
=======================================
Files 394 394
Lines 13997 14016 +19
Branches 3224 3231 +7
=======================================
+ Hits 13309 13328 +19
Misses 688 688
🚀 New features to boost your workflow:
|
Contributor
|
Please don't forget to include a changelog. |
…_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION
Author
|
@JacksonWeber I've added change log entry for this PR. |
Pull request dashboard statusWaiting on reviewers · refreshed 2026-07-29 01:44 UTC Review the latest changes. Status above doesn't look right?
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATIONwas not respected by the OTLP metric exporters themselves. The env var was only handled byEnvironmentConfigFactory(the declarative config path used bystartNodeSDK), which reads it and passes it explicitly asaggregationPreferenceto the constructor. Code that constructs the exporters without going through that path, includingNodeSDK(class API) used by@opentelemetry/auto-instrumentations-node, silently ignored the env var.Fixes #3920
Short description of the changes
Added
chooseAggregationSelectorFromEnvironment()toOTLPMetricExporterBase, following the same pattern as the existingchooseTemporalitySelectorFromEnvironment()forOTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.aggregationPreferenceis explicitly passed to the constructor, it takes priority (existing behavior unchanged).base2_exponential_bucket_histogramselects exponential histogram for histogram instruments;explicit_bucket_histogram(or unset) selects explicit bucket histogram; invalid values warn and fall back toDEFAULT.Since
OTLPMetricExporterinexporter-metrics-otlp-grpcandexporter-metrics-otlp-protoboth extendOTLPMetricExporterBase, the fix applies to all three exporters.Type of change
How Has This Been Tested?
opentelemetry-exporter-metrics-otlp-http/test/node/OTLPMetricExporter.test.tscovering: default (unset),explicit_bucket_histogram,base2_exponential_bucket_histogram, case-insensitive matching, invalid value (warn + fallback), and constructor option taking priority over env var.Checklist: