-
Notifications
You must be signed in to change notification settings - Fork 227
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
bug: transaction.setDefaultNameFromRequest relies on instrumentation being loaded #2288
Comments
Some possibly non-obvious things about the This configuration value only controls the runtime/monkey-patching of the original modules. It does not control the loading and execution of the of the instrumentation module/function. For example -- with The main takeaway here is that |
Disabling Instrumentation ConfigurationThere are three configuration variables that control instrumentation in the agent. instrumentationThe agent uses the Agent Reference Points: disableInstrumentationThe Agent Reference Points: instrumentIncomingHTTPRequestsThe This configuration is checked in individual instrumentation modules before the Agent Reference Points
Removing instrumentIncomingHTTPRequestsQuestion: Will removing the Answer: Slightly. If users start transactions via Question: Is removing the Answer: Soft yes on this. For users who have never set any of the above three configuration variables, there will be no changed agent behavior. However, if they have set any of the above there may be subtle, unexpected changes to agent behavior based on the presense or non presense of a transaction. I'm softly opposed to changing this behavior without a major version bump. |
I re-read the discuss thread and:
apm-agent-nodejs/lib/instrumentation/modules/http.js Lines 10 to 19 in 666092c
Changing those guards to |
Consider the following small program
When running this program we're able to rename the current transaction successfully despite the default transaction name being set to unknown. Similarly, the following program is able to start a transaction with a default name and set a custom name.
This appears to cover the expected use cases from the original discuss forum post, and that the WIP PR isn't needed. We'll be closing this issue for now, but if anyone has trouble with custom transaction naming when these configuration values are in use please let us know. |
This issue comes from a discuss forum post.
The following program
Will produce a transaction name of
GET unknown route
when handling the root URL, despite that URL having a configured route.We would expect a transaction name of
GET /
Root Cause
This bug occurs when the following configuration value is set
which disables automatic instrumentation.
There's a bug in the
setDefaultNameFromRequest
method of the transaction object. It uses thegetPathFromRequest
from the./express-utils
module to fetch a request path if noroute
property is found. If it can't fetch a request path, it assumes an unknown route.The
getPathFromRequest
method relies on our express instrumentation being loaded. Specifically, the agent grabs a path value using thesymbols.expressMountStack
symbol that our instrumentation sets on the request object.Additionally, the agent does not reach the
setDefaultNameFromRequest
code path when theinstrumentation
configuration value is set totrue
, as the KOA instrumentation will have already calledsetDefaultTransactionName
.The
setDefaultNameFromRequest
(probably?) should not rely on this symbol being set assetDefaultNameFromRequest
is part of our generic HTTP instrumentation.Additional Info: PR where
instrument
configuration's current behavior landed: #1114The text was updated successfully, but these errors were encountered: