-
Notifications
You must be signed in to change notification settings - Fork 309
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
Feature Request: Undici / Global Fetch integration #1615
Comments
We've been looking into using Undici for sending traces, but we haven't looked into writing a plugin for it yet.
Definitely accepted and welcomed!
Not that I know of, it should be pretty similar to other HTTP servers/clients that are already supported. |
Thanks @rochdev ; I'll draw some inspiration from the |
@flovilmart Note also that undici has also recently added support for diagnostics channel, so we'll want to use that in versions of undici where that's available. https://github.com/nodejs/undici/blob/main/docs/api/DiagnosticsChannel.md |
That's a super neat feature those diagnostics channels! |
@flovilmart It should be based on the |
OK that works for me @rochdev , we're not even on node 16 yet! I planned to get on that next week. |
Got this nodejs/undici#1053 patch done for undici for better compatibility. Outside the The implementation through the diag channels is very straightforward with some book-keeping. |
@rochdev , what do you think about this:nodejs/undici#1053 (comment)? |
@flovilmart Actually it's fine if the implementation in Undici is backed 100% by diagnostics channel. My thought was that we need to do the monkey-patching anyway to support older versions of Undici without the channel available. In that sense, the idea was to first implement the monkey-patching and then add support to use the channel once it lands in Undici. This doesn't mean adding any monkey-patching ability to Undici since that would be redundant when the channels are available. So basically:
In both cases, no change is needed in Undici other than adding diagnostics channel support. |
@rochdev @bengl I've open the PR above to gather initial feedback around the implementation. For now, I'm waiting for a new release of undici, which explains why the tests are currently failing. |
@flovilmart Not sure why these would interact. Can you try rebasing the PR? There was a change to how Next is tests a few weeks ago, maybe that change wasn't in your branch and it would fix the issue. |
Interesting! I've rebased, let's see how it goes! |
Any resolution on this since? I see in your PR that there has been some back and forth on whether to solve monkey-patching or diagnostic channels approach first. Are we pinning this to Undici DC PR as a dependency? |
@JustinTRoss I haven't had a chance to actually move forward with a new implementation; the monkey patching look very complex given undici's architecture; there are multiple APIs that leverage dispatchers differently, I haven't found any "clean" monkey patching strategy for all APIs (request, client, pipeline etc...) |
Any news on this subject? |
@Grmiade yep agreed - I haven't had the chance to improve on the current design and address the comments. |
We're actually in the process of finalizing the approach of instrumenting with |
@flovilmart Maybe it might make sense to skip the complex monkey-patching altogether and only support newer versions of Undici? |
Quick update related to the above: we're currently finishing up the new approach which we'll be trying internally in the next few weeks, and we plan to add instrumentation to Undici directly in Node core soon after. That work can be tracked in nodejs/node#44943 |
Amazing work @rochdev glad your team was able to pull it through! That was not a simple endeavour! |
hello there, are there any updates on Undici support? |
Looks like this nodejs/node#44943 was merged so I guess this is closer now? |
I see that support for |
We tested out undici for our gateway application and datadog didn't report any traces for backend services when we used undici. I don't think this issue can be closed until dd-trace supports undici. We are using dd-trace-js v 4.14.0 |
I meant to say that most people want undici support because the Fetch API uses undici. But I guess there are cases when one might use undici without |
https://datadoghq.dev/dd-trace-js/interfaces/export_.plugins.undici.html Whatever this is, it doesn't work. It's very hard to find docs on the over-the-wire format of datadog APM trace metadata (datadog or otel tracecontext) - everything points to libs. Well AFAICT there's no datadog lib that can instrument undici yet, so I'm trying to do it manully. Thus far, not having much luck with either otel's undici instrumentation or datadog's tease of one in the docs linked above. edit: udpate - turns out our code was not using global fetch but one of the other libs. My mistake! |
Hi there!
We're starting to shift away from axios / request and wish to roll out undici in our new deployments.
Unfortunately, there is no 'official' tracing package for it.
Is it something that is being worked on? Would a PR be accepted to add an
undici
plugin? Should I be aware of any 🐉 ?Thanks!
The text was updated successfully, but these errors were encountered: