ref(measurements): Update setMeasurements to only set a single measurement#4920
Merged
Conversation
Contributor
size-limit report 📦
|
AbhiPrasad
reviewed
Apr 12, 2022
| */ | ||
| public setMeasurements(measurements: Measurements): void { | ||
| this._measurements = { ...measurements }; | ||
| public setMeasurement(name: string, value: number, unit: MeasurementUnit = 'ms'): void { |
Contributor
There was a problem hiding this comment.
The default should be an empty string, ms is pretty unexpected behaviour.
Contributor
Author
There was a problem hiding this comment.
Now that I know units are basically free form text, I agree. Changed in dd9f8c8.
AbhiPrasad
reviewed
Apr 12, 2022
| /** Class tracking metrics */ | ||
| export class MetricsInstrumentation { | ||
| private _measurements: Measurements = {}; | ||
| private _measurements: Record<string, { value: number }> = {}; |
Contributor
There was a problem hiding this comment.
do we need to add units to any of these? Most vitals like LCP are in seconds.
AbhiPrasad
reviewed
Apr 12, 2022
| 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' }; |
Contributor
There was a problem hiding this comment.
wait the units are supposed to be send in full form? We can't use ms or s?
Contributor
Author
Contributor
Author
There was a problem hiding this comment.
This is the source of truth: getsentry/relay#1217
So we should use the fully written out version.
Contributor
Author
|
Merging this. We can iterate later on the whole download speed units thing. Jan is aware that this needs to be thoroughly defined. |
Lms24
pushed a commit
that referenced
this pull request
Apr 26, 2022
lobsterkatie
pushed a commit
that referenced
this pull request
Apr 26, 2022
lobsterkatie
pushed a commit
that referenced
this pull request
Apr 26, 2022
AbhiPrasad
pushed a commit
that referenced
this pull request
May 30, 2022
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.
Currently, users have to keep track of the existing measurements if they want to update them, which is a bit painful.
This updates
setMeasurementsto 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