-
Notifications
You must be signed in to change notification settings - Fork 544
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
feat(restify): add requestHook support #1312
feat(restify): add requestHook support #1312
Conversation
The `requestHook` config option allows custom span handling per request layer.
ff2957d
to
c66dbf9
Compare
plugins/node/opentelemetry-instrumentation-restify/src/types.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-restify/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
As mentioned in the review, pass the instrumentation config to the parent class. That way the config is also stored when given to the initializer, rather only when using the `setConfig` function.
Update comment to reference to correct type from the `@types/restify` package.
plugins/node/opentelemetry-instrumentation-restify/src/types.ts
Outdated
Show resolved
Hide resolved
Add the missing import reported by the linter.
Mention the package name exactly.
804f6e2
to
eda13b1
Compare
Fixed the types comment and fixed some linter issues related to the code added in this PR. Edit: I didn't mean to remove the other reviewer, but that's what happened when I asked for a re-review. |
plugins/node/opentelemetry-instrumentation-restify/src/types.ts
Outdated
Show resolved
Hide resolved
Thanks, it still shows the wrong type in the comment |
Co-authored-by: Amir Blum <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think I fixed the compile issue that broke the build previously. The test file was missing an import that wasn't a problem when I ran the test itself. Edit: Locally the compile task still fails for me, but because of some error from the instrumentation-koa and/or auto-instrumentations-node packages. That doesn't seem related to this PR. |
@tombruijn As discussed, it would be good if this request hook, like the Express and Koa request hooks, had a |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1312 +/- ##
==========================================
- Coverage 96.08% 95.68% -0.41%
==========================================
Files 14 20 +6
Lines 893 1088 +195
Branches 191 224 +33
==========================================
+ Hits 858 1041 +183
- Misses 35 47 +12
|
Add the layerType argument to the requestHook function. This is like the following PR but for restify: open-telemetry#1226 Move the LayerType from internal-types to types, because it's now used in a function used by users of the instrumentation package.
Thank you! |
The
requestHook
config option allows custom span handling per request layer.Which problem is this PR solving?
requestHook
support so users can add custom handling on spans.Short description of the changes
user-defined function is called any time
_handlerPatcher` is executed.