-
Notifications
You must be signed in to change notification settings - Fork 159
Add ECS conversion tables #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
theletterf
merged 26 commits into
main
from
theletterf-describe-ecs-attribute-conversion
Apr 24, 2025
Merged
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3b5dc68
Add ECS conversion tables
theletterf e962838
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf 9e706c5
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf b4e8d6d
Update introduction.md
theletterf 14b2bf6
Edits
theletterf 5f77a1f
Merge branch 'theletterf-describe-ecs-attribute-conversion' of https:…
theletterf 6d70161
Edits
theletterf e6760d1
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf 6e6361e
Remove duplicated para
theletterf eaf8da1
Merge branch 'theletterf-describe-ecs-attribute-conversion' of https:…
theletterf 13f4d2c
Remove redundant heading
theletterf 83c9288
Update solutions/observability/apm/resource-attributes.md
theletterf 2e31f57
Update solutions/observability/apm/resource-attributes.md
theletterf 7e85d56
Edits
theletterf e96485b
Merge branch 'theletterf-describe-ecs-attribute-conversion' of https:…
theletterf 9a1e0c8
Header edit
theletterf 40dddb1
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf 32bdadd
Add scope attributes
theletterf 84ebbf0
Rename page
theletterf 7f78edd
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf d8ca883
Update solutions/observability/apm/attributes.md
theletterf 7bd3a05
Update solutions/observability/apm/attributes.md
theletterf 3acf9bd
Add clarification
theletterf 522249e
Merge branch 'main' into theletterf-describe-ecs-attribute-conversion
theletterf 013942a
Edit
theletterf 757bd40
Merge branch 'theletterf-describe-ecs-attribute-conversion' of https:…
theletterf 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
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
mapped_pages: | ||
- https://www.elastic.co/guide/en/observability/current/apm-open-telemetry-resource-attributes.html | ||
- https://www.elastic.co/guide/en/serverless/current/observability-apm-agents-opentelemetry-resource-attributes.html | ||
applies_to: | ||
stack: | ||
serverless: | ||
--- | ||
|
||
# Attributes and labels [apm-open-telemetry-resource-attributes] | ||
|
||
In OpenTelemetry, an attribute is a key-value pair. Attributes are similar to [labels](/solutions/observability/apm/metadata.md#apm-data-model-labels) in that they add metadata to transactions, spans, and other entities. | ||
|
||
Resource attributes are a type of attribute that contains information about the entities that produce telemetry. Resource attributes map to Elastic Common Schema (ECS) fields like `service.*`, `cloud.*`, `process.*`, and so on. These fields describe the service and its environment. | ||
|
||
For example, Elastic maps the OpenTelemetry `deployment.environment` field to the ECS `service.environment` field on ingestion. | ||
theletterf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Setting resource attributes | ||
|
||
You can set resource attributes through environment variables or by editing the configuration of the resource processor of the OpenTelemetry Collector. | ||
|
||
### OpenTelemetry agent | ||
|
||
Use the `OTEL_RESOURCE_ATTRIBUTES` environment variable to pass resource attributes at process invocation. For example: | ||
|
||
```bash | ||
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=production | ||
``` | ||
|
||
### OpenTelemetry Collector | ||
|
||
Use the [resource processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourceprocessor) to set or apply changes to resource attributes when using the OTel Collector. | ||
|
||
```yaml | ||
... | ||
processors: | ||
resource: | ||
attributes: | ||
- key: deployment.environment | ||
action: insert | ||
value: production | ||
... | ||
``` | ||
|
||
## Handling of unmapped attributes | ||
|
||
When sending telemetry to APM Server, only a subset of OpenTelemetry attributes are directly mapped to ECS fields. If an attribute doesn't have a predefined ECS mapping, the system stores it under `labels.*`, with dots replaced by underscores. | ||
theletterf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
theletterf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
theletterf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
For example, if an OpenTelemetry resource contains: | ||
|
||
```json | ||
{ | ||
"service.name": "user-service", | ||
"deployment.environment": "production", | ||
"otel.library.name": "my-lib", | ||
"custom.attribute.with.dots": "value" | ||
} | ||
``` | ||
|
||
Elastic APM stores the following: | ||
|
||
```json | ||
{ | ||
"service.name": "user-service", | ||
"service.environment": "production", | ||
"labels": { | ||
"otel_library_name": "my-lib", | ||
"custom_attribute_with_dots": "value" | ||
} | ||
} | ||
``` | ||
|
||
## Scope attributes translation | ||
|
||
Scope attributes are translated as follows: | ||
|
||
| OpenTelemetry attribute | Elastic APM field | | ||
|-------------------------|-------------------| | ||
| scope.name | service.framework.name | | ||
| scope.version | service.framework.version | | ||
|
||
Unmapped scope attributes are ignored. |
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.