-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Allow for attaching metadata and pass it to the API and transports #3177
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
size-limit report
|
For posteriority, this is related to #3170, as it would simplify the implementation of that one. |
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.
Oh I like that eventually we can have the version defined in a single place ❤️
Indeed. @kamilogorek, even though this replaces that one, you might consider grabbing its tests (which you'd only have to modify a little) since they're already written. (I missed gatsby entirely in that PR, but fortunately the test there already exists and only needs to be updated.) |
const envelopeHeaders = JSON.stringify({ | ||
sent_at: new Date().toISOString(), | ||
...(sdkInfo && { sdk: sdkInfo }), |
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 only want name
and version
here not everything.
@@ -42,6 +70,7 @@ export function eventToSentryRequest(event: Event, api: API): SentryRequest { | |||
const envelopeHeaders = JSON.stringify({ | |||
event_id: event.event_id, | |||
sent_at: new Date().toISOString(), | |||
...(sdkInfo && { sdk: sdkInfo }), |
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.
Same here: We only want name
and version
here, not everything.
Still need some tinkering and tests.
options._metadata
which is type ofSdkMetadata = { sdk?: SdkInfo }
options.transportOptions
internally and passed to the transportnew API
which now has the ability to read this data-SDK_VERSION
is fixed and always read from@sentry/core
SDK_VERSION
is moved to@sentry/core
SDK_NAME
is kept where it was for backwards compatibilityand@sentry/browser
and@sentry/node
still use it as before, so it can be used as fallback for "unknown" SDKs or in a fail-safe scenario- event processors are still in place, as we use them to enhancepackages
attribute, as well as we have to modify the event itself, which is not using envelopes yet