From 8fcd831c7a304e3715f2f3921df675c640fbc086 Mon Sep 17 00:00:00 2001 From: Greg Kalapos Date: Tue, 25 Mar 2025 19:43:09 +0100 Subject: [PATCH 1/2] Add profiler_stack_trace_ids as counted_keyword to otel-data mappings --- .../traces-otel@mappings.yaml | 7 +++++++ .../rest-api-spec/test/20_traces_tests.yml | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml index 3a1ba435b8f1f..3b52ac7811303 100644 --- a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml +++ b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml @@ -41,6 +41,13 @@ template: unit: nanos dropped_events_count: type: long + attributes: + type: passthrough + dynamic: true + priority: 20 + properties: + transaction.profiler_stack_trace_ids: + type: counted_keyword links: synthetic_source_keep: arrays properties: diff --git a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml index 82d0672438ce5..1eaf2e0a94518 100644 --- a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml +++ b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml @@ -140,3 +140,21 @@ traces@lifecycle: index: $datastream-backing-index - is_true: $datastream-backing-index - match: { .$datastream-backing-index.settings.index.lifecycle.name: "traces@lifecycle" } +--- +"profiler_stack_trace_ids field should have type counted_keyword": + - do: + bulk: + index: traces-generic.otel-default + refresh: true + body: + - create: {} + - '{"@timestamp":"2024-07-18T14:49:33.467654000Z","data_stream":{"dataset":"generic.otel","namespace":"default"}, "span_id":"1", "attributes": {"transaction.profiler_stack_trace_ids": "S7VyNjRieh4zCEmv7MiwwAcaFlvHvn1cleFkExsq-nbA"}}' + - is_false: errors + - do: + indices.get_data_stream: + name: traces-generic.otel-default + - set: { data_streams.0.indices.0.index_name: idx0name } + - do: + indices.get_mapping: + index: $idx0name + - match: { .$idx0name.mappings.properties.attributes.properties.transaction\.profiler_stack_trace_ids.type: 'counted_keyword' } From e3651ca6b68fd166baf8d30c56a896ef1777004e Mon Sep 17 00:00:00 2001 From: Greg Kalapos Date: Wed, 2 Apr 2025 14:32:33 +0200 Subject: [PATCH 2/2] Change prefix for profiler_stack_trace_ids --- .../resources/component-templates/traces-otel@mappings.yaml | 2 +- .../resources/rest-api-spec/test/20_traces_tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml index 3b52ac7811303..fda2e8a756e5e 100644 --- a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml +++ b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml @@ -46,7 +46,7 @@ template: dynamic: true priority: 20 properties: - transaction.profiler_stack_trace_ids: + elastic.profiler_stack_trace_ids: type: counted_keyword links: synthetic_source_keep: arrays diff --git a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml index 1eaf2e0a94518..5e50afeff6e40 100644 --- a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml +++ b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml @@ -148,7 +148,7 @@ traces@lifecycle: refresh: true body: - create: {} - - '{"@timestamp":"2024-07-18T14:49:33.467654000Z","data_stream":{"dataset":"generic.otel","namespace":"default"}, "span_id":"1", "attributes": {"transaction.profiler_stack_trace_ids": "S7VyNjRieh4zCEmv7MiwwAcaFlvHvn1cleFkExsq-nbA"}}' + - '{"@timestamp":"2024-07-18T14:49:33.467654000Z","data_stream":{"dataset":"generic.otel","namespace":"default"}, "span_id":"1", "attributes": {"elastic.profiler_stack_trace_ids": "S7VyNjRieh4zCEmv7MiwwAcaFlvHvn1cleFkExsq-nbA"}}' - is_false: errors - do: indices.get_data_stream: @@ -157,4 +157,4 @@ traces@lifecycle: - do: indices.get_mapping: index: $idx0name - - match: { .$idx0name.mappings.properties.attributes.properties.transaction\.profiler_stack_trace_ids.type: 'counted_keyword' } + - match: { .$idx0name.mappings.properties.attributes.properties.elastic\.profiler_stack_trace_ids.type: 'counted_keyword' }