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(Telemetry): Ensure telemetry only matches js stacktrace paths #9447
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9447 +/- ##
=======================================
Coverage 86.90% 86.90%
=======================================
Files 321 321
Lines 11976 11976
=======================================
Hits 10408 10408
Misses 1568 1568
Continue to review full report at Codecov.
|
5fca5ac
to
9b4e778
Compare
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.
Wouldn't it be better if would confirm it's a stack trace line by requiring: :\d+:\d+
?
e.g. I think it's valuable to have node:internal/child_process:403:11
reported, as having Node.js version, we can seclude which exactly
@@ -8,7 +8,7 @@ const resolveErrorLocation = (exceptionTokens) => { | |||
const splittedStack = exceptionTokens.stack.split(/[\r\n]+/); | |||
if (splittedStack.length === 1 && exceptionTokens.code) return '<not available>'; | |||
|
|||
const stacktraceLineRegex = /(?:\s*at.*\((.*)\).?|\s*at\s(.*))/; | |||
const stacktraceLineRegex = /(?:\s*at.*\((.*\.js:\d+:\d+)\).?|\s*at\s(.*\.js:\d+:\d+))/; |
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.
It may stop working once someone starts using e.g. mjs
or cjs
extension.
I think problem with regex was that it didn't force whitespace wrap around at
word.
How about a regex as /(?:\s+at\s+\((.*:\d+:\d+)\).?|\s+at\s+(.*:\d+:\d+))/
;
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.
yes, that was the problem with the regex and in the initial version I went with the exact same regex as you're proposing, but I thought that maybe we could be more "bulletproof" with enforcing js
, but your point about mjs
and cjs
makes a lot of sense as well, I'll stick to just looking for line/column numbers at the end for now and will monitor if it resolves the problem 👍
9b4e778
to
a176c8a
Compare
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.
👍
Reported internally
It should resolve situations where the regex was not strict enough and was matching phrases as
from versions: none
(from Python requirements plugin)unix:///var/run/docker.sock. Is the docker daemon running?.
(from Docker check)does not match the API schema.
(from webpack)Additionally, it will not report the stacktrace lines coming from internals such as
node:child_process:573:9'
which are noise anyway.