Skip to content

Commit

Permalink
Adjust template and pipeline names to convention
Browse files Browse the repository at this point in the history
See elastic#96267 (comment)

- Index templates have a "@template" suffix
- Component templates are split into settings and mappings,
  and have a @settings and @mappings suffix respectively
- Ingest pipelines generally have a @pipeline suffix,
  except for one special case where we use @default-pipeline

We no longer have a component template for every data stream, rather we
have reusable component templates where it makes sense. For example, we
now have metrics-apm@settings and metrics-apm@mappings, which are
included by all APM metrics data streams.

We now set both default_pipeline and final_pipeline in the index
templates, preventing users from overriding them completely. The
default pipeline is always apm@default-pipeline, which performs
some rerouting of legacy data, and invokes user-defined @Custom
pipelines based on the data_stream.type and data_stream.dataset
fields. The final pipeline just performs built-in processing.
  • Loading branch information
axw committed Sep 13, 2023
1 parent bac147f commit db19f78
Show file tree
Hide file tree
Showing 47 changed files with 457 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ protected static boolean isXPackTemplate(String name) {
if (name.startsWith("elastic-connectors")) {
return true;
}
if (name.equals("apm")
if (name.startsWith("apm@")
|| name.startsWith("apm-")
|| name.startsWith("traces-apm")
|| name.startsWith("metrics-apm")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
version: ${xpack.apm.template.version}
template:
settings:
index:
default_pipeline: apm
sort:
field: "@timestamp"
order: desc
mappings:
dynamic: true
dynamic_templates:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: ${xpack.apm.template.version}
template:
settings:
index:
sort:
field: "@timestamp"
order: desc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ version: ${xpack.apm.template.version}
template:
mappings:
properties:
processor.event:
type: constant_keyword
value: error
error.custom:
type: flattened
error.exception.attributes:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
---
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
index:
default_pipeline: metrics-apm
mappings:
_source:
mode: synthetic
properties:
processor.event:
type: constant_keyword
value: metric
metricset.name:
type: constant_keyword
value: service_destination
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
---
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
index:
default_pipeline: metrics-apm
mappings:
_source:
mode: synthetic
properties:
processor.event:
type: constant_keyword
value: metric
metricset.name:
type: constant_keyword
value: service_summary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
index:
default_pipeline: metrics-apm
mappings:
_source:
mode: synthetic
properties:
processor.event:
type: constant_keyword
value: metric
metricset.name:
type: constant_keyword
value: service_transaction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
index:
default_pipeline: metrics-apm
mappings:
_source:
mode: synthetic
properties:
processor.event:
type: constant_keyword
value: metric
metricset.name:
type: constant_keyword
value: transaction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
---
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
index:
default_pipeline: metrics-apm
mappings:
_source:
mode: synthetic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
version: ${xpack.apm.template.version}
template:
settings:
codec: best_compression
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ version: ${xpack.apm.template.version}
template:
mappings:
properties:
data_stream.dataset:
type: constant_keyword
value: apm.rum
transaction.experience.cls:
type: scaled_float
scaling_factor: 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
---
version: ${xpack.apm.template.version}
template:
settings:
index:
default_pipeline: traces-apm
mappings:
properties:
processor.event:
type: keyword
data_stream.type:
type: constant_keyword
value: traces
data_stream.dataset:
type: constant_keyword
value: apm
event.success_count:
type: byte
index: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Mappings and settings that must not be overridden are to be defined
in the index templates, as these will take precedence over component
template mappings and settings. This includes:

- `index.default_pipeline`
- `index.final_pipeline`
- values for `data_stream.*`
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ version: ${xpack.apm.template.version}
index_patterns: ["logs-apm.app.*-*"]
priority: 150
data_stream: {}
allow_auto_create: true
_meta:
description: Index template for logs-apm.app.*-*
managed: true
composed_of:
- logs-mappings
- apm
- apm-retention-10d
- apm@mappings
- apm@settings
- apm-10d@lifecycle
- apm@custom
- logs-apm.app@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- logs-apm.app@custom
- apm@custom
allow_auto_create: true
_meta:
description: Index template for logs-apm.app.*-*
managed: true
template:
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: apm@pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,29 @@ version: ${xpack.apm.template.version}
index_patterns: ["logs-apm.error-*"]
priority: 150
data_stream: {}
allow_auto_create: true
_meta:
description: Index template for logs-apm.error-*
managed: true
composed_of:
- logs-mappings
- apm
- apm-retention-10d
- logs-apm.error
- apm@mappings
- apm@settings
- apm-10d@lifecycle
- logs-apm.error@mappings
- apm@custom
- logs-apm.error@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- logs-apm.error@custom
- apm@custom
allow_auto_create: true
_meta:
description: Index template for logs-apm.error-*
managed: true
template:
mappings:
properties:
processor.event:
type: constant_keyword
value: error
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: apm@pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ version: ${xpack.apm.template.version}
index_patterns: ["metrics-apm.app.*-*"]
priority: 150
data_stream: {}
allow_auto_create: true
_meta:
description: "Index template for metrics-apm.app.*-*"
managed: true
composed_of:
- metrics-mappings
- apm
- apm-retention-90d
- metrics-apm.app
- apm@mappings
- apm@settings
- apm-90d@lifecycle
- metrics-apm@mappings
- metrics-apm@settings
- apm@custom
- metrics-apm.app@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- apm@custom
- metrics-apm.app@custom
allow_auto_create: true
_meta:
description: "Index template for metrics-apm.app.*-*"
managed: true
template:
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: metrics-apm@pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ version: ${xpack.apm.template.version}
index_patterns: ["metrics-apm.internal-*"]
priority: 150
data_stream: {}
allow_auto_create: true
_meta:
description: "Index template for metrics-apm.internal-*"
managed: true
composed_of:
- metrics-mappings
- apm
- apm-retention-90d
- metrics-apm.internal
- apm@mappings
- apm@settings
- apm-90d@lifecycle
- metrics-apm@mappings
- metrics-apm@settings
- apm@custom
- metrics-apm.internal@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- apm@custom
- metrics-apm.internal@custom
allow_auto_create: true
_meta:
description: "Index template for metrics-apm.internal-*"
managed: true
template:
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: metrics-apm@pipeline
mappings:
properties:
data_stream.dataset:
type: constant_keyword
value: apm.internal
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ index_patterns: [metrics-apm.service_destination.10m-*]
priority: 150
data_stream:
hidden: true
allow_auto_create: true
_meta:
description: Index template for metrics-apm.service_destination.10m-*
managed: true
composed_of:
- metrics-mappings
- apm
- apm-retention-180d
- metrics-apm.service_destination
- apm@mappings
- apm@settings
- apm-180d@lifecycle
- metrics-apm@mappings
- metrics-apm@settings
- metrics-apm.service_destination@mappings
- apm@custom
- metrics-apm.service_destination@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- apm@custom
- metrics-apm.service_destination@custom
allow_auto_create: true
_meta:
description: Index template for metrics-apm.service_destination.10m-*
managed: true
template:
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: metrics-apm@pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ version: ${xpack.apm.template.version}
index_patterns: [metrics-apm.service_destination.1m-*]
priority: 150
data_stream: {}
allow_auto_create: true
_meta:
description: Index template for metrics-apm.service_destination.1m-*
managed: true
composed_of:
- metrics-mappings
- apm
- apm-retention-90d
- metrics-apm.service_destination
- apm@mappings
- apm@settings
- apm-90d@lifecycle
- metrics-apm@mappings
- metrics-apm@settings
- metrics-apm.service_destination@mappings
- apm@custom
- metrics-apm.service_destination@custom
- ecs@dynamic_templates
ignore_missing_component_templates:
- apm@custom
- metrics-apm.service_destination@custom
allow_auto_create: true
_meta:
description: Index template for metrics-apm.service_destination.1m-*
managed: true
template:
settings:
index:
default_pipeline: apm@default-pipeline
final_pipeline: metrics-apm@pipeline
Loading

0 comments on commit db19f78

Please sign in to comment.