-
-
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
605fe42
ref(measurements): Update `setMeasurements` to only set a single meas…
lforst dd9f8c8
Remove restrictions on `unit`
lforst e617f7f
Add function to include multiple measurements at once
lforst fad13a1
Add integration tests for transaction measurements
lforst 14c62ff
Remove `setMeasurements` method
lforst afcdaee
Add units to web vitals measurements
lforst 3a95f2c
Update download speed unit
lforst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/integration-tests/suites/public-api/startTransaction/setMeasurement/subject.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const transaction = Sentry.startTransaction({ name: 'some_transaction' }); | ||
|
||
transaction.setMeasurement('metric.foo', 42, 'ms'); | ||
transaction.setMeasurement('metric.bar', 1337, 'nanoseconds'); | ||
transaction.setMeasurement('metric.baz', 99, 's'); | ||
transaction.setMeasurement('metric.baz', 1); | ||
|
||
transaction.finish(); |
18 changes: 18 additions & 0 deletions
18
packages/integration-tests/suites/public-api/startTransaction/setMeasurement/test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expect } from '@playwright/test'; | ||
import { Event } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; | ||
|
||
sentryTest('should attach measurement to transaction', async ({ getLocalTestPath, page }) => { | ||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
const event = await getFirstSentryEnvelopeRequest<Event>(page, url); | ||
|
||
expect(event.measurements?.['metric.foo'].value).toBe(42); | ||
expect(event.measurements?.['metric.bar'].value).toBe(1337); | ||
expect(event.measurements?.['metric.baz'].value).toBe(1); | ||
|
||
expect(event.measurements?.['metric.foo'].unit).toBe('ms'); | ||
expect(event.measurements?.['metric.bar'].unit).toBe('nanoseconds'); | ||
expect(event.measurements?.['metric.baz'].unit).toBe(''); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
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.
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
ors
?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.
@jan-auer informed me that fully written out and singular is the way to go
@jan-auer can you confirm?
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.