-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Datadog exporter resource behavior and mapping (#5386)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Co-authored-by: bryn <bryn@apollographql.com> Co-authored-by: Bryn Cooke <BrynCooke@gmail.com>
- Loading branch information
1 parent
ceac7ad
commit bc0f8a9
Showing
37 changed files
with
1,047 additions
and
161 deletions.
There are no files selected for viewing
This file contains 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,49 @@ | ||
### Datadog exporter resource behavior and mapping ([Issue #5282](https://github.com/apollographql/router/issues/5282)) | ||
|
||
Users of the Datadog trace exporter may have noticed that span and resource naming is not as expected. | ||
Unlike other APMs, Datadog expects static span names, and then uses resource mapping to provide additional context. | ||
|
||
The default behavior of the Datadog exporter has now been changed to support this and give a better user experience. | ||
|
||
```yaml | ||
telemetry: | ||
exporters: | ||
tracing: | ||
datadog: | ||
enabled: true | ||
# Enables resource mapping, previously disabled by default, but now enabled. | ||
enable_span_mapping: true | ||
# Enables fixed span names, defaults to true. | ||
fixed_span_names: true | ||
|
||
instrumentation: | ||
spans: | ||
mode: spec_compliant | ||
|
||
``` | ||
The following default resource mappings are applied: | ||
| OpenTelemetry Span Name | Datadog Span Operation Name | | ||
|-------------------------|-----------------------------| | ||
| `request` | `http.route` | | ||
| `router` | `http.route` | | ||
| `supergraph` | `graphql.operation.name` | | ||
| `query_planning` | `graphql.operation.name` | | ||
| `subgraph` | `subgraph.name` | | ||
| `subgraph_request` | `graphql.operation.name` | | ||
| `http_request` | `http.route` | | ||
|
||
You can override the default resource mappings by specifying the `resource_mapping` configuration: | ||
|
||
```yaml | ||
exporters: | ||
tracing: | ||
datadog: | ||
enabled: true | ||
resource_mapping: | ||
# Use `my.span.attribute` as the resource name for the `router` span | ||
router: "my.span.attribute" | ||
``` | ||
By [@bnjjj](https://github.com/bnjjj) and [@bryncooke](https://github.com/bryncooke) in https://github.com/apollographql/router/pull/5386 |
This file contains 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 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 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 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 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 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 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,31 @@ | ||
pub(crate) const OTEL_NAME: &str = "otel.name"; | ||
pub(crate) const OTEL_ORIGINAL_NAME: &str = "otel.original_name"; | ||
pub(crate) const OTEL_KIND: &str = "otel.kind"; | ||
pub(crate) const OTEL_STATUS_CODE: &str = "otel.status_code"; | ||
pub(crate) const OTEL_STATUS_MESSAGE: &str = "otel.status_message"; | ||
#[allow(dead_code)] | ||
pub(crate) const OTEL_STATUS_DESCRIPTION: &str = "otel.status_description"; | ||
pub(crate) const OTEL_STATUS_CODE_OK: &str = "OK"; | ||
pub(crate) const OTEL_STATUS_CODE_ERROR: &str = "ERROR"; | ||
|
||
pub(crate) const FIELD_EXCEPTION_MESSAGE: &str = "exception.message"; | ||
pub(crate) const FIELD_EXCEPTION_STACKTRACE: &str = "exception.stacktrace"; | ||
pub(crate) const SUPERGRAPH_SPAN_NAME: &str = "supergraph"; | ||
pub(crate) const SUBGRAPH_SPAN_NAME: &str = "subgraph"; | ||
pub(crate) const ROUTER_SPAN_NAME: &str = "router"; | ||
pub(crate) const EXECUTION_SPAN_NAME: &str = "execution"; | ||
pub(crate) const REQUEST_SPAN_NAME: &str = "request"; | ||
pub(crate) const QUERY_PLANNING_SPAN_NAME: &str = "query_planning"; | ||
pub(crate) const HTTP_REQUEST_SPAN_NAME: &str = "http_request"; | ||
pub(crate) const SUBGRAPH_REQUEST_SPAN_NAME: &str = "subgraph_request"; | ||
|
||
pub(crate) const BUILT_IN_SPAN_NAMES: [&str; 8] = [ | ||
REQUEST_SPAN_NAME, | ||
ROUTER_SPAN_NAME, | ||
SUPERGRAPH_SPAN_NAME, | ||
SUBGRAPH_SPAN_NAME, | ||
SUBGRAPH_REQUEST_SPAN_NAME, | ||
HTTP_REQUEST_SPAN_NAME, | ||
QUERY_PLANNING_SPAN_NAME, | ||
EXECUTION_SPAN_NAME, | ||
]; |
This file contains 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 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 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.