fix: populate metric Type for exponential histogram queries #9729
+116
−0
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.
Summary
Fixes Query Builder UI returning empty results for ExponentialHistogram metrics. The MetricAggregation.Type field was never being populated from metadata, causing exponential histogram queries to route to the wrong table (samples instead of exp_hist).
Changes
Required: Add Relevant Labels
Reviewers
How to Test
🔍 Related Issues
N/A
Screenshots / Screen Recording (if applicable / mandatory for UI related changes)
Would previously return empty results for ExponentialHistogram.

Checklist
Notes for Reviewers
Root Cause
Solution
Follow the same pattern already used for Temporality enrichment - fetch Type from metadata and populate it before query execution.
Note
Fetches metric
Typefor all referenced metrics and injects it into builder aggregations; addsFetchTypeMultito metadata store with ClickHouse implementation and test mock support.pkg/querier/querier.go):Typefor all referenced metrics viametadataStore.FetchTypeMulti.MetricAggregation.Typefrom fetched metadata alongside existing temporality enrichment.pkg/telemetrymetadata/metadata.go):FetchTypeMultiand underlyingfetchMetricsTypequeryingmetrics_fields(usesargMax(type, last_reported_unix_milli)).metrictypes.Type(e.g., gauge, sum, histogram, exponentialhistogram).pkg/types/telemetrytypes/store.go):MetadataStorewithFetchTypeMulti.pkg/types/telemetrytypes/telemetrytypestest/metadata_store.go):TypeMap,FetchTypeMulti, andSetTypeto mock store.Written by Cursor Bugbot for commit abbd6a5. This will update automatically on new commits. Configure here.