-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node): Release Health Session Aggregates #3319
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
a12e6a8 to
d67f2fb
Compare
size-limit report
|
0b578a1 to
6c1c72e
Compare
dc9dd33 to
dc88889
Compare
rhcarvalho
left a comment
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.
Did a partial initial review. Sharing some comments.
220ea59 to
3326a3e
Compare
56565c6 to
b80cf1b
Compare
rhcarvalho
left a comment
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.
another pass
|
When we ship this we should change the dev docs https://develop.sentry.dev/sdk/sessions/#session-aggregates-payload Right now the API is marked experimental and limited to sentry.io usage only. |
9641f64 to
5ad2112
Compare
2aef14c to
062ae6b
Compare
HazAT
left a comment
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.
Small comments, but tests are still failing.
otherwise LGTM
062ae6b to
83c5d6c
Compare
Captures request mode sessions associated with a specific release, and sends them to the Sentry as part of the Release Health functionality.
83c5d6c to
d952992
Compare
| protected async _send(sentryReq: SentryRequest, originalPayload?: Event | Session): Promise<Response> { | ||
| protected async _send( | ||
| sentryReq: SentryRequest, | ||
| originalPayload?: Event | Session | SessionAggregates, |
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.
We do not need to send originalPayload of type SessionAggregates because that is only required for rate limiting
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.
Typescript needs this or it will complain :/
|
|
||
| class DummyTransport extends BaseDummyTransport { | ||
| sendSession(session) { | ||
| console.error('FAIL: Received Single Session which should have been deleted in favor of Session Aggregates!'); |
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.
Removing this section means we no longer check if the application mode session was dropped in favor of SessionAggregates mode
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.
There is only sendSession anymore and we do an assert to check for content, so if a single session reaches this it would fail.
| /** Massages the entries in `pendingAggregates` and returns aggregated sessions */ | ||
| public getSessionAggregates(): SessionAggregates { | ||
| const aggregates: AggregationCounts[] = Object.keys(this._pendingAggregates).map((key: string) => { | ||
| return this._pendingAggregates[parseInt(key)]; |
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.
Are the keys not typed as numbers? Why is it a string here?
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.
Keys are always coerced to strings, despite being stored as numbers, so parseInt can be skipped here.
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.
lol, typescript u dumb :3
Co-authored-by: Kamil Ogórek <[email protected]>

This PR adds:
requestHandlermiddlewarerequestHandlermiddleware is used, it opts user into Session Aggregates mode and deletes Single Session on scope.errorHandlermiddleware, thecrashedcount is incrementederroredcount is incrementedexitedcount is incrementedcaptureEventwith aneventthat contains exceptions, will increment theerroredcountNote: This PR re-enables
autoSessionTrackingby default #3511Docs PR: getsentry/sentry-docs#3541