fix: use toJSONString for metric attribute hashing with JSON schema (#2087)#2118
Open
doyong365 wants to merge 1 commit intohyperdxio:mainfrom
Open
fix: use toJSONString for metric attribute hashing with JSON schema (#2087)#2118doyong365 wants to merge 1 commit intohyperdxio:mainfrom
doyong365 wants to merge 1 commit intohyperdxio:mainfrom
Conversation
|
|
@doyong365 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
PR Review✅ No critical issues found. The implementation is correct and well-tested. A few minor observations:
|
89fb034 to
18c427d
Compare
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.
Summary
When the ClickHouse OTel exporter is configured with
json: true(BETA_CH_OTEL_JSON_SCHEMA_ENABLED), attribute columns (Attributes,ScopeAttributes,ResourceAttributes) are stored asJSONtype instead ofMap(String, String). The existing metric bucketing queries always usedcityHash64(mapConcat(...)), which fails with:This fix detects the column type at query time via
metadata.getColumns()and substitutesmapConcatwithtoJSONString-based hashing when JSON schema is active. The detection falls back to the original Map behaviour if the column lookup fails (e.g. table not yet created). Affected query paths: Gauge, Sum, and Histogram (count + quantile) metrics.Screenshots or video
N/A — backend query generation change only, no UI changes.
How to test locally
BETA_CH_OTEL_JSON_SCHEMA_ENABLED=truein your ClickHouse exporter config (json: true).otel_metrics_gauge,otel_metrics_sum, andotel_metrics_histogramtables.Function mapConcat requires at least one argument of type Maperror.References
{}): Bug: Metric ResourceAttributes and Attributes stored as {} when using JSON schema (ClickStack / BETA_CH_OTEL_JSON_SCHEMA_ENABLED) open-telemetry/opentelemetry-collector-contrib#47582