Skip to content
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

Add destination spec #435

Merged
merged 6 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions specs/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ You can find details about each of these in the [APM Data Model](https://www.ela
- Tracing
- [Transactions](tracing-transactions.md)
- [Spans](tracing-spans.md)
- [Span destination](tracing-spans-destination.md)
- [Sampling](tracing-sampling.md)
- [Distributed tracing](tracing-distributed-tracing.md)
- [Tracer API](tracing-api.md)
Expand Down
78 changes: 78 additions & 0 deletions specs/agents/tracing-spans-destination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## Span destination

Spans representing an external call MUST have `context.destination` information.
If the span represents a call to an in-memory database, the information SHOULD still be set.

Agents SHOULD have a generic component used in all tests that validates that the destination information is present for exit spans.
Rather than opting into the validation, the testing should provide an opt-out if,
for whatever reason, the destination information can't or shouldn't be collected for a particular exit span.
felixbarny marked this conversation as resolved.
Show resolved Hide resolved

### Destination service fields

#### `context.destination.service.name`

ES field: `span.destination.service.name`

The identifier for the destination service.

For HTTP, use scheme, host, and non-default port (e.g. `http://elastic.co`, `http://apm.example.com:8200`).
For anything else, use `span.subtype` (e.g. `postgresql`, `elasticsearch`).

**Usage**

Currently, this field is not anywhere within the product.
felixbarny marked this conversation as resolved.
Show resolved Hide resolved

#### `context.destination.service.resource`

ES field: `span.destination.service.resource`

Identifies unique destinations for each service.

**Usage**

Each unique resource will result in node on the service map.
felixbarny marked this conversation as resolved.
Show resolved Hide resolved
Also, APM Server will roll up metrics based on the resource.
These metrics are currently used for the [dependencies table](https://www.elastic.co/guide/en/kibana/current/service-overview.html#service-span-duration)
on the service overview page.
There are plans to use the service desination metrics in the service map, too.
felixbarny marked this conversation as resolved.
Show resolved Hide resolved

The metrics are calculated based on the (head-based) sampled span documents that are sent to APM Server.
That's why agents have to send the [`sample_rate`](tracing-sampling.md#effect-on-metrics)
attribute for transactions and spans:
It is used by APM Server to extrapolate the service destination metrics based on the (head-based) sampled spans.

**Cardinality**

To avoid a huge impact on storage requirements for metrics,
and to not "spam" the service map with lots of fine-grained nodes,
the cardinality has to be kept low.
However, the cardinality should, not be too low, either,
so that different clusters, instances, or queues can be displayed separately in the service map.

Generally, the value would look something like `${span.type}/${cluster}`.
The specs for the specific technologies will have more information on how to construct the value for `context.destination.service.resource`.

#### `context.destination.service.type`

ES field: `span.destination.service.type`

Type of the destination service, e.g. `db`, `elasticsearch`.
Should typically be the same as `span.type`.
Used to displaying different icons on the service map. (TODO confirm)
felixbarny marked this conversation as resolved.
Show resolved Hide resolved

### Destination fields

These fields are used within the APM/SIEM integration.
They don't play a role for service maps.

#### `context.destination.address`

ES field: [`destination.address`](https://www.elastic.co/guide/en/ecs/current/ecs-destination.html#_destination_field_details)

Address is the destination network address: hostname (e.g. `localhost`), FQDN (e.g. `elastic.co`), IPv4 (e.g. `127.0.0.1`) IPv6 (e.g. `::11`)
felixbarny marked this conversation as resolved.
Show resolved Hide resolved

#### `context.destination.port`

ES field: [`destination.port`](https://www.elastic.co/guide/en/ecs/current/ecs-destination.html#_destination_field_details)

Port is the destination network port (e.g. 443)