You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improved instrumentation code & related telemetry (#6910)
* chore: improve instrumentation hooks
This improves our instrumentations in multiple ways:
- Add JSDoc to many methods that it is easier to work with.
- Fix multiple type errors.
- Remove code that was only used in testing such as `unhook()`.
- Fix small issues in esbuild instrumentation where a module might
not return a moduleExports object.
- Improve code to run slightly faster (these are not hot code paths).
- Automatically instruments unprefixed Node.js modules when defining
a instrumentation for a module. This removes the need for much special
handling (duplicating the instrumentation, using the symbol to detect
already instrumented calls, etc.).
- Fix using an array as file for some modules. This did not cause any
issues, but it was not correct.
- Removed unused isIitm arguments in instrumentations.
- Removed unused ritm code.
- Removed HOOK_SYMBOL code.
* fix: always send telemetry for not instrumented code
This makes sure not instrumented code will always send out the
proper telemetry. Formerly, it would rely on any part of the file
being instrumented. Now, we properly check by version again. To
guarantee it is only logging it once, it is send the data on the
first flush or before the service ends in case that happens earlier.
It also fixes DD_TRACE_DISABLED_INSTRUMENTATIONS to work for
prefixed and unprefixed Node automatically in case either is
deactivated. Before, both would have to be deactivated.
In addition, it simplifies code, adds some JSDoc and makes sure
the Node.js version is added to Node.js modules in the telemetry /
failures.
This also fixes a couple of tests that were not properly checking
the behavior as some state was captured in the instrumentation.
---------
Co-authored-by: Pablo Erhard <pabloerhard02@gmail.com>
0 commit comments