I would like to have the possibility to ignore certain controller#actions in rails.
Reason: I have a route which acts as health check for my rails app and gets hit several times per second to monitor the uptime. This action is quite fast and therefor influences my results/latency heavily in a way that it actually gives me a false result regarding my actual requests per min and my latency.
So what I am looking for is a possibility to ignore requests for a certain action including all the dependent traces (template, db, etc ...)
Best regards,
Dennis
Sure @DennisSchmidt, this is a feature request that definitely makes sense. Indeed we implemented something in the Python client to discard some traces when the given URL matches a specific value. You can see the high level PR (not yet released) here: https://github.com/DataDog/dd-trace-py/pull/303
Also, the implementation is generic, so you can write your own filters.
Considering that our plan is to implement something similar for Ruby, would it help you solving your problem?
That sounds like it would solve my problem.
I made a simple and quick approach, which solves my usecase for now. Of course, yours is more generic and would help more people I guess.
Thx for answering 馃憤
you're welcome! I'll keep this issue opened so that it can be linked to the PR when it will be available! Thanks also for providing your approach! It could help other users till the filtering pipeline is shipped!
IMHO for flexibility this could be part of the tracer API instead of a list of routes, for example tracer.skip, tracer.ignore, etc could be the first thing you call in your controller or be a before_action callback.
@palazzem Are there any general approaches being considered for implementing this feature, or concerns about ones proposed so far?
FWIW, our use case sounds the same as @DennisSchmidt, where we have a single healthcheck action we'd want to exclude
Hello @abstrctn ! Sorry, I forgot to follow-up here! Actually we've implemented a filter to exclude traces if a condition is satisfied. You have two different options:
[trace.ignore] option;SpanFilter class. In the second case, this could be an example:# skipping the health check: if it returns true, the trace is dropped
controller_filter = Datadog::Pipeline::SpanFilter.new do |span|
span.name == "rack.request" && span.get_tag("http.url") == "/healthz"
end
Datadog::Pipeline.before_flush(controller_filter)
Remember that if you drop traces in the client, stats are dropped too. If the healthcheck is not important for your stats, filtering from the client is a good approach. Let me know if it helps and solves your issue!
(the client filter is available from 0.9.0)
Should this issue be closed?
@cabello yes we can consider that one closed. But feel free to re-open it if it doesn't solve your issue! Thanks a lot!
Thanks for the quick response @palazzem! Both of those options look really useful and should handle everything we need.
Most helpful comment
Hello @abstrctn ! Sorry, I forgot to follow-up here! Actually we've implemented a filter to exclude traces if a condition is satisfied. You have two different options:
[trace.ignore]option;SpanFilterclass. In the second case, this could be an example:Remember that if you drop traces in the client, stats are dropped too. If the healthcheck is not important for your stats, filtering from the client is a good approach. Let me know if it helps and solves your issue!
(the client filter is available from 0.9.0)