-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
experimental_datadog_agent_sampling
This mode will change the behaviour of the router for tracing in the following ways: * Spans are never dropped, instead they are converted to RecordOnly. * Spans that are sent to otlp and datadog exporters will always look like they have been sampled. * The `sampling.priority` attribute is populated on spans. * `psr` is populated in trace state. * `m` is populated in trace state.
- Loading branch information
bryn
committed
Oct 3, 2024
1 parent
e91a612
commit a5f6f0a
Showing
38 changed files
with
2,488 additions
and
331 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.changesets/fix_bryn_datadog_upstream_sampling_decision_test.md
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,48 @@ | ||
### Respect x-datadog-sampling-priority ([PR #6017](https://github.com/apollographql/router/pull/6017)) | ||
|
||
This PR consists of two fixes: | ||
#### Datadog priority sampling resolution is not lost. | ||
|
||
Previously a `x-datadog-sampling-priority` of `-1` would be converted to `0` for downstream requests and `2` would be converted to `1`. | ||
|
||
#### The sampler option in the `telemetry.exporters.tracing.common.sampler` is not datadog aware. | ||
|
||
To get accurate APM metrics all spans must be sent to the datadog agent with a `psr` or `sampling.priority` attribute set appropriately to record the sampling decision. | ||
|
||
`preview_datadog_agent_sampling` option in the router.yaml enables this behavior and should be used when exporting to the datadog agent via OTLP or datadog native. | ||
|
||
```yaml | ||
telemetry: | ||
exporters: | ||
tracing: | ||
common: | ||
# Only 10 percent of spans will be forwarded from the Datadog agent to Datadog. Experiment to find a value that is good for you! | ||
sampler: 0.1 | ||
# Send all spans to the Datadog agent. | ||
preview_datadog_agent_sampling: true | ||
|
||
# Example OTLP exporter configuration | ||
otlp: | ||
enabled: true | ||
# Optional batch processor setting, this will enable the batch processor to send concurrent requests in a high load scenario. | ||
batch_processor: | ||
max_concurrent_exports: 100 | ||
|
||
# Example Datadog native exporter configuration | ||
datadog: | ||
enabled: true | ||
|
||
# Optional batch processor setting, this will enable the batch processor to send concurrent requests in a high load scenario. | ||
batch_processor: | ||
max_concurrent_exports: 100 | ||
``` | ||
By using these options, you can decrease your Datadog bill as you will only be sending a percentage of spans from the Datadog agent to datadog. | ||
> [!IMPORTANT] | ||
> Users must enable `preview_datadog_agent_sampling` to get accurate APM metrics. | ||
|
||
> [!IMPORTANT] | ||
> Sending all spans to the datadog agent may require that you tweak the `batch_processor` settings in your exporter config. This applies to both OTLP and the Datadog native exporter. | ||
|
||
By [@BrynCooke](https://github.com/BrynCooke) in https://github.com/apollographql/router/pull/6017 |
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
11 changes: 11 additions & 0 deletions
11
...lo-router/src/plugins/telemetry/testdata/config.field_instrumentation_sampler.router.yaml
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,11 @@ | ||
telemetry: | ||
instrumentation: | ||
spans: | ||
mode: spec_compliant | ||
apollo: | ||
field_level_instrumentation_sampler: 1.0 | ||
exporters: | ||
tracing: | ||
common: | ||
preview_datadog_agent_sampling: true | ||
sampler: 0.5 |
Oops, something went wrong.