-
Notifications
You must be signed in to change notification settings - Fork 813
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
[@opentelemetry/instrumentation
] require
performance grows linearly with each instrumentation plugin
#3029
Comments
@opentelemetry/instrumentation
] require
performance grows linearly with each instrumentation@opentelemetry/instrumentation
] require
performance grows linearly with each instrumentation plugin
No... you are actually absolutely right. We've been aware of this issue from the beginning, but haven't gotten around to fixing this. RITM just patches require every time. Each last patch is added on top of the last one. If there's no other takes I'd like to take a stab at this. |
I think the way to handle this is to have a single wrapper that catches all of the instrumented packages and looks up the appropriate instrumentation. |
Assigning priority 3 since this causes a performance issue in end user applications |
I had a rough WIP before other stuff took over my priority. Can take a look, or make my WIP available if you are interested. |
@dyladan Thanks for resolving this. When can we expect the next release of |
Today I hope |
@dyladan I'm assuming there's something blocking the release. Is there anything I can do to help? |
Release in progress at #3340 |
@dyladan Is it possible this regressed in the lates OTel package release (1.8.0)? We saw a huge jump in the startup time of one of our bigger services after updating the packages yesterday |
Of course anything is possible, but I think it's unlikely that this particular issue regressed. Can you open a new issue for your startup time issue and provide your exact package versions and setup code? |
Confirmed that we're experiencing this same issue using |
What version of OpenTelemetry are you using?
@opentelemetry/api@^1.1.0
What version of Node are you using?
v16.14.2
Please provide the code you used to setup the OpenTelemetry SDK
What did you do?
What did you expect to see?
require
should not be much slower when instrumentation is enabledWhat did you see instead?
require
is 3-5x slower when instrumentation is enabledAdditional context
getNodeAutoInstrumentations()
, it takes 2.5 minutes.require
grows linearly with the number of enabled instrumentation plugins. In our large application, each additional instrumentation plugin adds 5-10 seconds to startup time.@opentelemetry/instrumentation
usesrequire-in-the-middle
: since each instrumentation plugin invokes RITM, does therequire
function end up as a deeply nested patch on top of a patch on top of a patch?The text was updated successfully, but these errors were encountered: