-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ref(measurements): Update setMeasurements
to only set a single measurement
#4920
Conversation
size-limit report 📦
|
packages/tracing/src/transaction.ts
Outdated
* @hidden | ||
*/ | ||
public setMeasurements(measurements: Measurements): void { | ||
this._measurements = { ...measurements }; | ||
public setMeasurement(name: string, value: number, unit: MeasurementUnit = 'ms'): void { |
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.
The default should be an empty string, ms
is pretty unexpected behaviour.
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.
Now that I know units are basically free form text, I agree. Changed in dd9f8c8.
@@ -17,7 +17,7 @@ const global = getGlobalObject<Window>(); | |||
|
|||
/** Class tracking metrics */ | |||
export class MetricsInstrumentation { | |||
private _measurements: Measurements = {}; | |||
private _measurements: Record<string, { value: number }> = {}; |
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.
do we need to add units to any of these? Most vitals like LCP are in seconds.
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.
Added units here: afcdaee
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.
lets goooo!
@@ -79,14 +79,14 @@ export class MetricsInstrumentation { | |||
|
|||
if (entry.name === 'first-paint' && shouldRecord) { | |||
IS_DEBUG_BUILD && logger.log('[Measurements] Adding FP'); | |||
this._measurements['fp'] = { value: entry.startTime }; | |||
this._measurements['mark.fp'] = { value: startTimestamp }; | |||
this._measurements['fp'] = { value: entry.startTime, unit: 'millisecond' }; |
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.
wait the units are supposed to be send in full form? We can't use ms
or s
?
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 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.
This is the source of truth: getsentry/relay#1217
So we should use the fully written out version.
Merging this. We can iterate later on the whole download speed units thing. Jan is aware that this needs to be thoroughly defined. |
Currently, users have to keep track of the existing measurements if they want to update them, which is a bit painful.
This updates
setMeasurements
to only set a single measurement similar to how @sl0thentr0py did it for the python SDK getsentry/sentry-python#1359.We don't want to have both methods because we don't want to unnecessarily increase API surface.
Ref: https://getsentry.atlassian.net/browse/WEB-835