-
Notifications
You must be signed in to change notification settings - Fork 542
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
fix(instrumentation-koa): handle koa routes being of type RegExp #1754
fix(instrumentation-koa): handle koa routes being of type RegExp #1754
Conversation
@david-luna Is this something that you could look into? |
I can give you feedback on this PR for now but nothing more since I don't have the required role/access for actioning on PRs. So PR LGTM but I was wondering if its necessary to send |
@ramesius Thank you for the contribution. the fix LGTM. |
Codecov Report
@@ Coverage Diff @@
## main #1754 +/- ##
=======================================
Coverage 91.42% 91.42%
=======================================
Files 143 143
Lines 7299 7301 +2
Branches 1458 1460 +2
=======================================
+ Hits 6673 6675 +2
Misses 626 626
|
@blumamir Sure, just pushed up a test for the functionality 👍🏻 |
@david-luna Probably makes sense. I can raise a seperate PR with that feedback if you don't mind. |
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.
Thanks! 🥇
CI was failing due to linting, just fixed that up 🤞🏻 |
…n-telemetry#1754) * chore: replace deprecated SpanAttributes type with Attributes * fix: handle layer path being a string or regex * chore: add test for RegExp koa route * fix: single quote string due to linting --------- Co-authored-by: Amir Blum <amirgiraffe@gmail.com>
Which problem is this PR solving?
Koa route paths can be
string | RegExp
.RegExp
is not a primitive type and thus results in the following logs from Otel when using the koa instrumentation:Invalid attribute value set for key: http.route
Invalid attribute value set for key: koa.name
Short description of the changes
This change updates the typings package
@types/koa__router
that in-turn has been updated with the correct union typestring | RegExp
(See PR DefinitelyTyped/DefinitelyTyped#67194). The Koa instrumentation now properly handles the case when routes are of typeRegExp
.I have also replaced the use of the deprecated
SpanAttributes
withAttributes
.