Skip to content

Commit

Permalink
Merge internal otel distribution spec (#865)
Browse files Browse the repository at this point in the history
* fix typo

* merge internal spec elements

* Update specs/agents/otel-distribution.md

Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>

* Update specs/agents/otel-distribution.md

Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>

---------

Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
  • Loading branch information
3 people authored Jun 4, 2024
1 parent cf2fa0a commit 9a8390a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
4 changes: 2 additions & 2 deletions specs/agents/mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ The mobile specific docs can be found:
* [iOS Agent](https://www.elastic.co/guide/en/apm/agent/swift/0.x/intro.html)
* [Android Agent](https://www.elastic.co/guide/en/apm/agent/android/current/index.html)

## Open Telementry
## OpenTelemetry

The mobile agents are the first agents at Elastic to be built on top of Open-Telementry.
A large portion of the mobile agents' functionality can be attributed to the [opentelementry-swift](https://github.com/open-telemetry/opentelemetry-swift) and [opentelementry-java](https://github.com/open-telemtry/opentelemetry-java) packages.

Expand All @@ -16,7 +17,6 @@ However, the Elastic mobile agents don't set every attribute defined (many only

## Semantic Conventions and APM Server Mappings


### Resource Attributes
Here is a list of resource attributes that are relevant for our mobile agents:

Expand Down
47 changes: 46 additions & 1 deletion specs/agents/otel-distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,51 @@ When introducing new features, the decision between starting with platform-speci
For simplicity the configuration in this specification will use the "environment variable" syntax, some platforms like Java
might also support other ways to configure.

## Identification

### User Agent headers

Per the [OpenTelemetry Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent), OpenTelemetry SDKs are expected to send a `User-Agent` header when exporting data to a backend. At a minimum, this header SHOULD identify the exporter, the language of its implementation, and the version of the exporter.

Elastic distributions SHOULD configure a customized `User-Agent` header when possible[^1].
This allows data exported from a vanilla SDK and an Elastic distribution to be easily distinguished.

[^1]: Some OpenTelemetry SDKs (e.g. .NET) do not provide a mechanism to modify the `User-Agent` header. In this case, we accept their default.

To conform with [RFC7231](https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.3), the existing SDK `User-Agent` should be preceded by a product identifier and version for the Elastic distribution.

```
<repo-name>/<version> <existing-otel-sdk-user-agent>
```

For example, in the .NET distribution, the `User-Agent` header would be configured as follows:

```
elastic-otel-dotnet/1.0.0 OTel-OTLP-Exporter-Dotnet/1.6.0
```

### Telemetry resource attributes

Per the [semantic conventions](https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk), SDKs are expected to include the following resource attributes on captured signals. These are used to identify the SDK where the data was captured and should not be modified.

- `telemetry.sdk.name`
- `telemetry.sdk.version`
- `telemetry.sdk.language`

In the above attributes, the name and version should be the OTel SDK name and version.
The language should be the primary language that the SDK is intended for.
It is expected that the OpenTelemetry SDK sets these values.
Our distros should set them, only if the SDK code does not do so automatically.

Intake currently reads these attributes and uses them to populate the `agent.Name` and `agent.Version` fields.

The semantic conventions also [define two experimental attributes](https://opentelemetry.io/docs/specs/semconv/resource/#telemetry-sdk-experimental) to identify the distribution:

- `telemetry.distro.name`: must be set to `elastic`
- `telemetry.distro.version`: must reflect the distribution version

Distributions SHOULD set these attributes with appropriate values.

## Features

### Inferred spans
Expand Down Expand Up @@ -79,4 +124,4 @@ Implementation is currently platform specific:

Supported platforms: [Java](https://github.com/elastic/elastic-otel-java/tree/main/universal-profiling-integration)

For the configuration options see [this section](universal-profiling-integration.md#configuration-options).
For the configuration options see [this section](universal-profiling-integration.md#configuration-options).

0 comments on commit 9a8390a

Please sign in to comment.