feat: record exceptions in http instrumentation#3008
feat: record exceptions in http instrumentation#3008legendecas merged 1 commit intoopen-telemetry:mainfrom
Conversation
|
|
a1a8945 to
63c0929
Compare
Codecov Report
@@ Coverage Diff @@
## main #3008 +/- ##
==========================================
- Coverage 92.63% 91.24% -1.40%
==========================================
Files 187 68 -119
Lines 6166 1850 -4316
Branches 1301 392 -909
==========================================
- Hits 5712 1688 -4024
+ Misses 454 162 -292
|
blumamir
left a comment
There was a problem hiding this comment.
LGTM
Thanks for the contribution
Interesting OTEP regarding the future of SpanEvents: https://github.com/open-telemetry/oteps/pull/202/files
63c0929 to
1248bb6
Compare
1248bb6 to
b6d57fc
Compare
b6d57fc to
03cabe4
Compare
| assert.strictEqual(span.events[0].name, 'exception'); | ||
|
|
||
| const eventAttributes = span.events[0].attributes as Object; | ||
| assert.deepEqual( |
There was a problem hiding this comment.
Strict version of assert.deepEqual is preferred:
| assert.deepEqual( | |
| assert.deepStrictEqual( |
| assert.strictEqual(span.events.length, 1); | ||
| assert.strictEqual(span.events[0].name, 'exception'); | ||
|
|
||
| const eventAttributes = span.events[0].attributes as Object; |
There was a problem hiding this comment.
I'd suggest asserting the eventAttributes to be non-nullish rather than casting it as an object -- the casting has no runtime-effect, we'll get a TypeError below if it is actually an undefined.
| const eventAttributes = span.events[0].attributes as Object; | |
| const eventAttributes = span.events[0].attributes; | |
| assert.ok(eventAttributes != null); |
074c0a3 to
5f6880e
Compare
5f6880e to
279dec9
Compare
|
Thank you for your contribution! |
Which problem is this PR solving?
When an error is captured, it is now recorded as an event using recordException().
Short description of the changes
Added the
recordExceptioncall right after the status setup insetSpanWithError().Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Updated the helper that compares spans so it supports errors being passed and checks if they've been recorded.
Checklist: