-
Notifications
You must be signed in to change notification settings - Fork 40
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
Honoring of Sampling Priority Headers #236
Comments
The work done in 9b9248f is not about The behavior of extracting What kind of setup do you have, and which behavior are you looking for? |
We have Nginx with Opentracing module. I was expecting that adding that header and setting value to 1 or 2 would force ingest, but have found that not to be the case. It appears that the DD Agent is still filtering out requests. Do you have another recommended method for forcing trace ingest? |
Yes, there are a few ways that you could do this. If you want to set the probability that any trace is ingested, you can specify the $ cat /etc/nginx/dd-config.json
{
"sample_rate": 1.0
}
$ grep 'opentracing_load_tracer' /etc/nginx/nginx.conf
opentracing_load_tracer /usr/local/lib/libdd_opentracing_plugin.so /etc/nginx/dd-config.json; Here You can do the same thing by setting the DD_TRACE_SAMPLE_RATE environment variable, though then you must be careful to also forward that environment variable to worker processes in the nginx configuration: env DD_TRACE_SAMPLE_RATE; You could even hard-code a value in the configuration: env DD_TRACE_SAMPLE_RATE=1.0; You can also override the sampling decision for a particular http {
# ...
location / {
# Always keep these traces.
opentracing_tag manual.keep 1;
proxy_pass http://upstream;
}
location /healthcheck {
# Never keep these traces.
opentracing_tag manual.drop 1;
proxy_pass http://upstream;
}
} Finally, if you already vary the "operation name" in different locations, then you can define sampling rules that change the sampling probability (sample rate) based on the request's operation name. Note that if you use any of |
I'm aware of the manual.keep and sample rate. At scale our sample rate can be 1 but traces will get dropped by the Agent (rate-limited). I want to ensure that traces that I absolutely need (IE QA testing) are ingested into Datadog. I was hoping that the Sampling Priority header would do that but it does not. My problem with manual keep is I need manual keep : 1 on conditional if a header is present and meets pre determined value. The |
That would have the side-effect of dropping eveything except QA requests. I have a few ideas about workarounds that you could use. First, though, I'll mention that there is a new nginx module specifically for Datadog that is currently in beta: https://github.com/DataDog/nginx-datadog. This module does allow tags to be set in If you don't want to switch over to bleeding edge software, then here are some workarounds to try instead:
map $http_x_internal_thingy $sampling_priority_for_internal_thingy {
QA 2;
default 999;
} Sampling priority 2 corresponds to "manual keep." Sampling priority 999 is bogus, and will not affect sampling, but will produce a line in location / {
# ...
opentracing_propagate_context;
opentracing_tag sampling.priority $sampling_priority_for_internal_thingy;
}
$ cat /etc/nginx/dd-config.json
{
"sampling_rules": [{"name": "handle.request.qa", "sample_rate": 1.0}]
} http {
map $http_x_internal_thingy $operation_name_for_internal_thingy {
QA handle.request.qa;
default handle.request;
}
opentracing_load_tracer ... /etc/nginx/dd-config.json;
# ...
location / {
# ...
opentracing_propagate_context;
opentracing_operation_name $operation_name_for_internal_thingy;
}
# ...
} This is better than the spewing logs, but has the drawback that different requests will have different operation names, which you might not want. Note that option (2) will not work if nginx is not the first service in the trace. (1) would work all the time, but sucks because of the log spew. |
It appears that the work for honoring sample priority headers was added 9b9248f.
Do you have an estimated release time for this? Does it work as expected in NGINX where passing an x-datadog-sampling-priority header will force ingestion?
The text was updated successfully, but these errors were encountered: