feat(node)!: Collect request sessions via HTTP instrumentation#14658
Merged
feat(node)!: Collect request sessions via HTTP instrumentation#14658
Conversation
In order for us to have size-limit comparison etc, we need to ensure CI runs on v8 & v9 branches too.
In order for us to have size-limit comparison etc, we need to ensure CI runs on v8 & v9 branches too.
With this PR, the default value for the `spans` option in the `httpIntegration` is changed to `false`, if `skipOpenTelemetrySetup: true` is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario. Closes #14675
Contributor
size-limit report 📦
|
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
In order for us to have size-limit comparison etc, we need to ensure CI runs on v8 & v9 branches too.
With this PR, the default value for the `spans` option in the `httpIntegration` is changed to `false`, if `skipOpenTelemetrySetup: true` is configured. This is what you'd expect as a user, you do not want Sentry to register any OTEL instrumentation and emit any spans in this scenario. Closes #14675
added 3 commits
December 13, 2024 14:29
added 9 commits
December 16, 2024 12:03
chargome
approved these changes
Dec 17, 2024
Comment on lines
+215
to
+223
| if (isHandledException) { | ||
| // A request session can go from "errored" -> "crashed" but not "crashed" -> "errored". | ||
| // Crashed (unhandled exception) is worse than errored (handled exception). | ||
| if (requestSession.status !== 'crashed') { | ||
| requestSession.status = 'errored'; | ||
| } | ||
| } else { | ||
| requestSession.status = 'crashed'; | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| if (isHandledException) { | |
| // A request session can go from "errored" -> "crashed" but not "crashed" -> "errored". | |
| // Crashed (unhandled exception) is worse than errored (handled exception). | |
| if (requestSession.status !== 'crashed') { | |
| requestSession.status = 'errored'; | |
| } | |
| } else { | |
| requestSession.status = 'crashed'; | |
| } | |
| // A request session can go from "errored" -> "crashed" but not "crashed" -> "errored". | |
| // Crashed (unhandled exception) is worse than errored (handled exception). | |
| if (isHandledException && requestSession.status !== 'crashed') { | |
| requestSession.status = 'errored'; | |
| } else if (!isHandledException) { | |
| requestSession.status = 'crashed'; | |
| } |
|
|
||
| const existingClientAggregate = clientToRequestSessionAggregatesMap.get(client); | ||
| const bucket = existingClientAggregate?.[dateBucketKey] || { exited: 0, crashed: 0, errored: 0 }; | ||
| bucket[({ ok: 'exited', crashed: 'crashed', errored: 'errored' } as const)[requestSession.status]]++; |
Member
There was a problem hiding this comment.
l: we could put exited crashed and errored into a type
| crashed: value.crashed, | ||
| }), | ||
| ); | ||
| client.sendSession({ aggregates: aggregatePayload }); |
Contributor
Author
There was a problem hiding this comment.
Great question. As of now, it cannot be caught because we leave the underlying promises dangling in the base client :/ It should be fine though since we do it only after all the cleanup has been done and it is in a non-main-program-flow place (i.e. res.on()) so it won't crash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref #14658
This is a very cool PR 😎👉👉 that
autoSessionTrackingimplementation from the Node SDKhttpIntegrationto create sessions for incoming requestsRequestSessionAPIs from Scope etc. and hoists it intosdkProcessingMetadataServerRuntimeClientSessionFlusherSorry for big PR.