-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(core): Create template attributes in consoleLoggingIntegration
#17703
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
Conversation
consoleLoggingIntegration
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
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.
Can see how this is useful. Sounds like a good change to me!
}); | ||
|
||
return attributes; | ||
} |
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.
Bug: Console Template Attributes Formatting Issues
The createConsoleTemplateAttributes
function has two issues. The sentry.message.template
attribute includes an unintended trailing space when no followingArgs
are present. Additionally, sentry.message.parameter
attributes are stored as raw values instead of structured objects with value
/type
, and null
/undefined
values are not converted to their expected string representations.
ref #16737
Right now if users use
console.log
like so:The console logging integration will emit a log with log message
"here is my log statement"
.Some users would like it if we automatically paramaterized this into a template, given there are separate arguments being sent into the logging statement. So the above log statement would generate
This paramaterization is what this PR does, which provides a much better user experience.
One edge case that we need to watch out for is console substitution patterns like
%s
,%d
,%i
,%f
,%o
,%O
,%c
. Read more about this in the MDN docs. When encountering a console substitution pattern in the string, we elect to not generate string templates, as parsing the string to evaluate it gets too complicated client side.