-
Notifications
You must be signed in to change notification settings - Fork 377
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
Custom resource names for HTTP requests #277
Comments
I have opened up a PR at least as an example of an approach: #278 |
I would love to see something like this make it into the gem. Knowing what service is responding slow and track historical performance would be very useful. |
This would be very useful to us as well. This is noted as blocked in Community, what is it blocked on? |
+1 for this. |
We are experimenting with this right now to see what's the best way to handle this. Overall, I think we want to provide an option to customize this resource name entirely (within some kind of callback), but we also want to evaluate if we can provide a better default (I think we can), and what that should be. We talked about this a little bit in #387, and I think in one other issue (cannot remember now.) |
It looks like many ducks are in a row for being able to provide this feature, apart from supporting
Is there anything else blocking this at this point, other than needing prioritizing? |
So this came up while discussing instrumentation for Ethon, and I'll more or less repeat that here so everyone has a chance to see it: By default, we only want to set the HTTP method as the resource, e.g. Sounds crazy, and I see the value of including the path. However, the resource is meant to be a In order to provide a better default, we'd require a much smarter quantization strategy that could detect and quantize just the variable/sensitive parts of URIs and not anything else. Needless to say, this would be sophisticated mechanism, and not something that we have in place today in the library. If the omission of path/query as a default behavior is an issue for users (as it clearly and understandably has been raised as one), the alternative we could offer is the option to customize their span and set their own resource using a callback. See HTTP as an example:
We'd rather users have the option to customize their traces for their needs in exchange for assumed responsibility, as opposed to not having the choice at all. If you feel inclined to try it, please do share your feedback so we can incorporate it into any future plans! |
We went ahead and tested an implementation using the I understand this is experimental and not necessarily an explicit feature at this point, so I am wondering how we can proceed to make this useable for our case. |
Can you explain in more detail about how they are gettting filtered? I've run some tests with this, and it seems to work fine from what I can see. What values are you changing in the The only case I can think of where they might be appear to be filtered is if you change the span's name to something else other than If you can share some comparisons between spans that are filtered and those that are not, that would be helpful. |
The implementation is similar to #278 , just setting the resource to the host:port if the service is net/http. If I go to https://app.datadoghq.com/apm/service/net%2Fhttp/, none of the traces show up. On the other hand, if I look at a span representing a controller action, our test net/http spans show up nested inside. The TEST here is me setting the resource, so clearly its not malformed, or being being filtered completely. |
@MaxSechz I see, that's curious. Interesting that it shows up under the parent trace's service, but not the HTTP service. Clearly the span has been ingested and is available, what's unclear is why the HTTP service decides not to show it. Since this seems to concern the backend, I'll have to follow up with the team. To diagnose this better though, it might be a good idea to share your account so we can look at it. To do so you'd want to open a support ticket via the website (to protect any sensitive information about your account) and describe more or less the problem as you did here. Be sure to share any links you have for the traces in question so we can look at the same data you're seeing. You can mention me by name, and the team should expedite/relay it to me so I can investigate further. |
@igorescobar This is the current default behavior, but this comment might explain what's going on here and how to work around it: #277 (comment) |
Hey, @delner! I appreciate your reply! I guess we will wait for an official patch on this. It doesn't make sense for us to be paying thousands of dollars on a tool and in the end, you still have to work on ad-hoc implementations for basic things like this. Our workaround for this is actually not using the |
Hey @igorescobar, using facets, like you posted earlier, should also work with the built-in |
@igorescobar FWIW, I feel the pain too (I think we can do better) and we are working on plans to make improvements to the default behavior; when I have more information to share about that, I will. |
@marcotc Thanks! Unfortunately, this option is only available from the @delner Appreciated your comment! Cheers! |
@delner Is there any chance this hook can be added to the other HTTP clients instrumented by dd-trace-rb? We built our internal HTTP client on top of Excon and so can't use the hook in |
@MXfive It's something we'll consider expanding to other spans as well, including Excon, but isn't on the top of our docket right now. I would like to see more "span hooks" like this in the future, as a general feature to allow users to customize instrumentation. |
@delner I have a question regarding timeouts and the Datadog::Contrib::HTTP::Instrumentation.after_request do |span, _http_instance, req, _res|
host = req.uri.host
case host
when /INTERNAL/ # Internal
Datadog::Analytics.set_measured(span) # Keep all metrics, to better understand our intranet traffic
span.service = ENV['DD_SERVICE']
when /amazonaws/, /169.254.169.254/ # AWS
span.service = 'http-amazonaws.com'
else
org_domain = host.split('.').last(2).join('.')
span.service = "http-#{org_domain}"
end
path = req.path.to_s.split('?').first
path = path.split('/').keep_if { |chunk| chunk[/^[a-z_]+$/i] }.join('/')
span.resource = "#{host}/#{path}##{req.method}"
end The problem here is that the block doesn't get called on timeouts - in which case we get the default service of
|
@dudo I think it probably makes sense that Not sure we want to add a Also, just as a suggestion, we discourage multiplexing service names (having unique service names for different spans) as it has a potential to greatly clutter your services page (especially if your code interacts with subdomains with randomness in them.) If it isn't already possible, we should allow for you to group/filter spans in your service by domain (amazon.com, etc.) in the UI. |
Can we follow the quantize pattern established on other instrumentations, and allow it to be configurable? I'd love to be able to customize my faraday resource names per-domain, and keep them all under the same service_name. |
Closing this as it seems the direction has been to expose domains as services (via We are using the |
Right now the resource names for the auto-instrumented Net::HTTP code are HTTP Methods: GET, POST etc. This is not a useful way for us to see our metrics broken out. As an example, there's no meaningful way for me to sort the Service view. However, if the Resource name was the domain, I could see what services are the most used, and track them over time much better.
If you don't want to change the default, could there either be an extension point (method to override), or a configuration option?
Thanks.
The text was updated successfully, but these errors were encountered: