Skip to content

Commit

Permalink
x-pack/plugin/otel-data: Fix dynamic template summary and summary_min…
Browse files Browse the repository at this point in the history
…max (elastic#113868)

<!-- Thank you for your interest in and contributing to Elasticsearch!
There are a few simple things to check before submitting your pull
request that can help with the review process. You should delete these
items from your submission, but they are here to help bring them to your
attention. --> Fix error `failed to parse: class java.lang.String cannot
be cast to class java.util.List (java.lang.String and java.util.List are
in module java.base of loader 'bootstrap')`
  • Loading branch information
carsonip authored and matthewabbott committed Oct 4, 2024
1 parent 70ed0b6 commit 7f198e5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ template:
- summary:
mapping:
type: aggregate_metric_double
metrics: sum, value_count
metrics: [sum, value_count]
default_metric: value_count
- summary_minmax:
mapping:
type: aggregate_metric_double
metrics: sum, value_count, min, max
metrics: [sum, value_count, min, max]
default_metric: value_count
2 changes: 1 addition & 1 deletion x-pack/plugin/otel-data/src/main/resources/resources.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# "version" holds the version of the templates and ingest pipelines installed
# by xpack-plugin otel-data. This must be increased whenever an existing template is
# changed, in order for it to be updated on Elasticsearch upgrade.
version: 1
version: 2

component-templates:
- otel@mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,52 @@ IP dimensions:
search:
index: metrics-generic.otel-default
- length: { hits.hits: 1 }
---
"Dynamic templates":
- do:
bulk:
index: metrics-generic.otel-default
refresh: true
body:
- create: {"dynamic_templates":{"metrics.counter_long":"counter_long","metrics.gauge_long":"gauge_long","metrics.counter_double":"counter_double","metrics.gauge_double":"gauge_double","metrics.summary":"summary","metrics.summary_minmax":"summary_minmax","metrics.histogram":"histogram"}}
- "@timestamp": 2024-07-18T14:48:33.467654000Z
attributes:
foo: bar
metrics:
counter_long: 42
gauge_long: 42
counter_double: 42.42
gauge_double: 42.42
summary:
sum: 42.42
value_count: 42
summary_minmax:
sum: 42.42
value_count: 42
min: 0.42
max: 4.2
histogram:
counts: [1,2]
values: [42,4242]
- is_false: errors
- do:
search:
index: metrics-generic.otel-default
- length: { hits.hits: 1 }

- do:
indices.get_data_stream:
name: metrics-generic.otel-default
- set: { data_streams.0.indices.0.index_name: idx0name }

- do:
indices.get_mapping:
index: $idx0name
expand_wildcards: hidden
- match: { .$idx0name.mappings.properties.metrics.properties.counter_long.type: 'long' }
- match: { .$idx0name.mappings.properties.metrics.properties.gauge_long.type: 'long' }
- match: { .$idx0name.mappings.properties.metrics.properties.counter_double.type: 'double' }
- match: { .$idx0name.mappings.properties.metrics.properties.gauge_double.type: 'double' }
- match: { .$idx0name.mappings.properties.metrics.properties.summary.type: 'aggregate_metric_double' }
- match: { .$idx0name.mappings.properties.metrics.properties.summary_minmax.type: 'aggregate_metric_double' }
- match: { .$idx0name.mappings.properties.metrics.properties.histogram.type: 'histogram' }

0 comments on commit 7f198e5

Please sign in to comment.