Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/120952.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 120952
summary: Add `_metric_names_hash` field to OTel metric mappings
area: Data streams
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ template:
type: passthrough
dynamic: true
priority: 10
# workaround for https://github.com/elastic/elasticsearch/issues/99123
_metric_names_hash:
type: keyword
Copy link
Member

Choose a reason for hiding this comment

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

Q: will a number be more lightweight, as you're using a 8 digit hex anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment, numbers can't leverage run-length encoding. So it's actually lighter to use a keyword here as all dimensions are incorporated into the _tsid, which we sort by. Therefore, all values for the same tsid are equal and can be compressed very efficiently.

time_series_dimension: true
unit:
type: keyword
time_series_dimension: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,26 @@ Metrics with different scope names are not duplicates:
metrics:
foo.bar: 42
- is_false: errors

---
Metrics with different metric name hashes are not duplicates:
- do:
bulk:
index: metrics-generic.otel-default
refresh: true
body:
- create: {"dynamic_templates":{"metrics.foo":"counter_long"}}
- "@timestamp": 2024-07-18T14:00:00Z
attributes:
foo: bar
metrics:
foo: 42
_metric_names_hash: a9f37ed7
- create: {"dynamic_templates":{"metrics.bar":"counter_long"}}
- "@timestamp": 2024-07-18T14:00:00Z
attributes:
foo: bar
metrics:
bar: 42
_metric_names_hash: 76b77d1a
- is_false: errors