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

Datadog receiver capability to set sampling.priority attribute #34267

Closed
melchiormoulin opened this issue Jul 26, 2024 · 3 comments · Fixed by #34697
Closed

Datadog receiver capability to set sampling.priority attribute #34267

melchiormoulin opened this issue Jul 26, 2024 · 3 comments · Fixed by #34697
Labels
enhancement New feature or request good first issue Good for newcomers receiver/datadog

Comments

@melchiormoulin
Copy link
Contributor

Component(s)

receiver/datadog

Is your feature request related to a problem? Please describe.

Problem:
When using Probabilistic Sampling Processor sampling.priority helps to control the sampling on traces:

For trace spans, this sampler supports probabilistic sampling based on a configured sampling percentage applied to the TraceID. In addition, the sampler recognizes a sampling.priority annotation, which can force the sampler to apply 0% or 100% sampling

When using datadog receiver i can't setup sampling.priority attribute with datadog receiver.

Describe the solution you'd like

x-datadog-sampling-priority is the header in datadog to set sampling priority
It would be nice to parse this HTTP header and set sampling.priority attribute
This HTTP header would allow to force the sampling or not.

Describe alternatives you've considered

No response

Additional context

No response

@melchiormoulin melchiormoulin added enhancement New feature or request needs triage New item requiring triage labels Jul 26, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@jpkrohling
Copy link
Member

Sounds like a valid feature request. Would you like to work on that?

@jpkrohling jpkrohling added the good first issue Good for newcomers label Aug 13, 2024
@melchiormoulin
Copy link
Contributor Author

yes for sure !

jpkrohling pushed a commit that referenced this issue Aug 15, 2024
**Description:** 
Add sampling.priority attribute based on metrics _sampling_priority_v1
for probabilistic_sampler processor


**Link to tracking Issue:** 
resolve
#34267


**Testing:** 
Have a demo app with Datadog SDK
OTEL collector with probabilistic_sampler processor like this config : 
```
receivers:
  datadog:
    endpoint: 0.0.0.0:8080 
    read_timeout: 60s

processors:
  probabilistic_sampler:
    sampling_percentage: 0

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [datadog]
      processors: [probabilistic_sampler]
      exporters: [debug]
```
Perform a test curl on demo app to generate traces
```curl mydemoapp:8080/actuator/metrics -H 'x-datadog-sampling-priority: 1' -H 'x-datadog-parent-id: 0' -H 'x-datadog-trace-id: 123’```
We see the traces in stdout of OTEL collector

**Documentation:** <Describe the documentation added.>
f7o pushed a commit to f7o/opentelemetry-collector-contrib that referenced this issue Sep 12, 2024
)

**Description:** 
Add sampling.priority attribute based on metrics _sampling_priority_v1
for probabilistic_sampler processor


**Link to tracking Issue:** 
resolve
open-telemetry#34267


**Testing:** 
Have a demo app with Datadog SDK
OTEL collector with probabilistic_sampler processor like this config : 
```
receivers:
  datadog:
    endpoint: 0.0.0.0:8080 
    read_timeout: 60s

processors:
  probabilistic_sampler:
    sampling_percentage: 0

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [datadog]
      processors: [probabilistic_sampler]
      exporters: [debug]
```
Perform a test curl on demo app to generate traces
```curl mydemoapp:8080/actuator/metrics -H 'x-datadog-sampling-priority: 1' -H 'x-datadog-parent-id: 0' -H 'x-datadog-trace-id: 123’```
We see the traces in stdout of OTEL collector

**Documentation:** <Describe the documentation added.>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers receiver/datadog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants