Help needed: proxy-middleware possibly interfering with Datadog trace context #1119
Unanswered
jorge-gomez-baraibar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone 👋
This might not be an issue with this repo directly, but we’re hoping someone here might have insights.
We’re working on a large Express-based multi-tenant project that uses
http-proxy-middleware
. Recently, we’ve noticed some strange behavior in our Datadog APM traces.We see traces with tens of thousands of spans that are completely unrelated to each other. These spans should belong to separate traces, but for some reason, they’re getting grouped into one.
Here's an example of what this looks like in Datadog (10k spans in a single trace):

After reviewing our Datadog integration thoroughly and comparing it with other projects, we’re fairly confident the issue is not on the Datadog side. Our suspicion is that it’s related to how we configure the proxy middleware.
Our proxy configuration:
Here’s how we use
createProxyMiddleware
for each tenant:This is called for each proxy we need for each tenant we have.
Things we've tried:
selfHandleResponse
and set it tofalse
to avoid side effects in the proxyRes function (where we add tags to the DD spans). This did not work at all.Things that the AI is telling us are happening:
We are using the last major version of this library (^3.0.0).
Has anyone here encountered something similar or have suggestions on how to debug this better? We're open to any ideas.
Also, if this isn't the right place for this discussion, please let me know where better to post it.
Thanks in advance, and have a great day!
Beta Was this translation helpful? Give feedback.
All reactions