-
Notifications
You must be signed in to change notification settings - Fork 549
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(instrumentation-ioredis): add response hook for custom attributes #343
Conversation
Codecov Report
@@ Coverage Diff @@
## main #343 +/- ##
=======================================
Coverage 93.88% 93.88%
=======================================
Files 12 12
Lines 409 409
Branches 45 45
=======================================
Hits 384 384
Misses 25 25 |
plugins/node/opentelemetry-instrumentation-ioredis/src/utils.ts
Outdated
Show resolved
Hide resolved
} | ||
safeExecuteInTheMiddle( | ||
() => config?.responseHook?.(span, cmd.name, cmd.args, result), | ||
() => {}, |
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.
Sorry i didn't catch this before but i think it could be better if we could log an error so the user know that its hook is failing
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.
makes sense. added logging on error :)
This feature was originally sent in this PR, and I was asked to split it into a different PR. Now that the original PR is merged, I am able to send it once again.
Which problem is this PR solving?
This is similar to the hooks functions in instrumentation-http, and to the plugins in this repo (which I maintain).
Possible usage: add a custom attribute to span which tells if the command is a key HIT or key MISS.
Short description of the changes
IORedisInstrumentationConfig
, and call the function when the command is successfullyresolve
d.