-
Notifications
You must be signed in to change notification settings - Fork 306
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
HTTP Client resource.name should show method + path #1118
Comments
Had a discussion with our Java team and it looks like they do pattern matching to try to combine similar URLs into groups for HTTP clients. This is definitely something we could implement for Node as well. It would probably be optional however given the potential for high cardinality which could hit quotas and provide a subpar experience depending on the structure of the paths. In the meantime you could group similar paths manually using span hooks. This would likely provide better results anyway since automatic grouping can be hit and miss as it doesn't have any knowledge about the remote routes while your code might. tracer.use('http', {
client: {
hooks: {
request: (span, req, res) => {
const group = groupPathsSomehow(req) // possibly pattern matching using RegExp
span.setTag('resource.name', `${req.method} ${group}`)
}
}
}
}) Please let me know if that helps! |
@rochdev we currently also having the same use case as @bullywhippet. Any plan of having this natively supported for nodejs like java in the near future? |
@rochdev I was trying to use your suggestion with custom client hooks. But I did notice now the
In the APM debug logs, I can see that it wasn't set properly:
I tried switching the order of |
@hong823 There should be only a single So basically: tracer.use('http', {
client: {
service: "my-service-dev",
hooks: {
request: (span, req, res) => {
const group = groupPathsSomehow(req)
span.setTag('resource.name', `${req.method} ${group}`)
}
}
}
}); |
@rochdev thanks, I can now see traces added with proper
However, I did notice metric Do you have any idea? |
@hong823 What version of the tracer are you using? We only added support for measuring HTTP spans with a custom service name recently, so it's possible that by changing the service name stats are no longer calculated properly. If you are not on the latest version, definitely try to update first. I'm also not sure if all stats are still calculated or only a subset when the service name is changed, so if you are using latest I would recommend contacting support who would be able to look into this further. |
@rochdev upgrading from 0.33.2 to 0.35.0 seems to do the tricks, thanks for the tips! |
@rochdev I just noticed |
@hong823 This is supported out of the box and should be using the routes from the calls to |
@rochdev we're using the router as a wildcard like below:
I was able to use the |
@rochdev Sorry for tagging you directly.
Specs - Any suggestions what is wrong? Thank you. |
@YogeshTelawane Are you using the same version of everything in both environments? It's possible that some versions of Express (assuming you use Express) don't set |
Any plans for this feature?? Or the only way, it's by implementing the workaround ? |
Not currently planned, as far as I'm aware. @rochdev should we make a proper feature request for this? |
Hi, In my current team i built this helper for normalice the request
This allows to handle correct path variables like offers/123 or offers/123/reject to offers/:id, offers/:id/reject |
I had an adjacent issue of sorts with Express. My issue here was that the tsx --loader dd-trace/loader-hook.mjs src/app.ts The order of everything is very particular here - make sure your |
Describe the bug
Traces for http-client metrics only show method name, not path so all endpoints are lumped together.
We are unable to create monitors on http-client resource_names using the automatic instrumentation because only the method is tagged on traces and we need to filter at a more granular level (per resource_name)
Example image:
Expected behavior is that the trace shows the method and the path using automatic configuration configuration, like the Java agent does:
Example image:
I believe that this may be the line that needs to be updated to include a path:
https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-http/src/client.js#L62
and https://github.com/DataDog/dd-trace-js/blob/master/packages/datadog-plugin-http2/src/client.js#L177
Environment
8.11.3 and 14.5
dd-trace": "^0.20.0" and "dd-trace": "0.24.0"
7.20.0 and 7.23
The text was updated successfully, but these errors were encountered: