-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(utils): Add parameterize
function
#9145
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
Merged
Lms24
merged 32 commits into
getsentry:develop
from
AleshaOleg:feature/added-parametrize-function
Jan 5, 2024
Merged
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
db66295
Added parametrize function
AleshaOleg e15d5f1
Populate logentry parameter if it's exist for eventFromMessage functions
AleshaOleg 7b27a1e
Merge branch 'develop' of github.com:getsentry/sentry-javascript into…
AleshaOleg e4c4d4c
Renamed parametrize to parameterize and moved ParameterizedString typ…
AleshaOleg 8fa0552
Added integration tests
AleshaOleg d83411a
Fixing tests and improvements
AleshaOleg 70e6864
isParameterized -> isParameterizedString in docs
AleshaOleg cbd0805
Fixed lint errors
AleshaOleg 1020b14
Minor optimization
AleshaOleg 99c4fbb
Merge branch 'develop' of github.com:getsentry/sentry-javascript into…
AleshaOleg 3cbe665
Minor improvements, reverted prisma update
AleshaOleg de6e723
Fixed typo
AleshaOleg 28758b6
Fixed typo
AleshaOleg 17a4bbd
Merge branch 'develop' of github.com:getsentry/sentry-javascript into…
AleshaOleg 2c3393f
[email protected] -> prisma@^3.12.0
AleshaOleg f6347a3
Merge branch 'develop' of github.com:getsentry/sentry-javascript into…
AleshaOleg cefa81c
prisma@^3.12.0 -> [email protected]
AleshaOleg e80f23a
[email protected] -> prisma@^3.12.0
AleshaOleg 3b67901
Merge branch 'develop' of github.com:getsentry/sentry-javascript into…
AleshaOleg 2789d04
[email protected] -> prisma@^3.12.0
AleshaOleg 3e3b441
Merge branch 'develop' of github.com:AleshaOleg/sentry-javascript int…
AleshaOleg 0d67997
Fixed Biome errors
AleshaOleg dcd1549
Merge branch 'develop' of https://github.com/getsentry/sentry-javascr…
AleshaOleg ca8a58a
Merge branch 'develop' of https://github.com/getsentry/sentry-javascr…
AleshaOleg 8c8bf10
Skipping test for some bundles
AleshaOleg a631c55
Prevent running test for tracing builds
AleshaOleg aa3c9d1
Merge branch 'develop' of https://github.com/getsentry/sentry-javascr…
AleshaOleg de11d01
Skipping all test for bundle builds
AleshaOleg 5aeedf7
Merge branch 'develop' of https://github.com/getsentry/sentry-javascr…
AleshaOleg f68be1f
Test migration to dev-packages folder
AleshaOleg 5681add
Merge branch 'develop' of https://github.com/getsentry/sentry-javascr…
AleshaOleg 4b0c53c
Merge branch 'develop' into feature/added-parametrize-function
AleshaOleg 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
6 changes: 6 additions & 0 deletions
6
...owser-integration-tests/suites/public-api/captureMessage/parameterized_message/subject.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { parameterize } from '@sentry/utils'; | ||
|
||
const x = 'first'; | ||
const y = 'second'; | ||
|
||
Sentry.captureMessage(parameterize`This is a log statement with ${x} and ${y} params`); |
16 changes: 16 additions & 0 deletions
16
.../browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { Event } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; | ||
|
||
sentryTest('should capture a parameterized representation of the message', async ({ getLocalTestPath, page }) => { | ||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url); | ||
|
||
expect(eventData.logentry).toStrictEqual({ | ||
message: 'This is a log statement with %s and %s params', | ||
params: ['first', 'second'], | ||
}); | ||
}); |
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
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
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
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
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
12 changes: 12 additions & 0 deletions
12
...node-integration-tests/suites/public-api/captureMessage/parameterized_message/scenario.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as Sentry from '@sentry/node'; | ||
import { parameterize } from '@sentry/utils'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
release: '1.0', | ||
}); | ||
|
||
const x = 'first'; | ||
const y = 'second'; | ||
|
||
Sentry.captureMessage(parameterize`This is a log statement with ${x} and ${y} params`); |
13 changes: 13 additions & 0 deletions
13
...ges/node-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { TestEnv, assertSentryEvent } from '../../../../utils'; | ||
|
||
test('should capture a parameterized representation of the message', async () => { | ||
const env = await TestEnv.init(__dirname); | ||
const event = await env.getEnvelopeRequest(); | ||
|
||
assertSentryEvent(event[2], { | ||
logentry: { | ||
message: 'This is a log statement with %s and %s params', | ||
params: ['first', 'second'], | ||
}, | ||
}); | ||
}); |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type ParameterizedString = string & { | ||
__sentry_template_string__?: string; | ||
__sentry_template_values__?: string[]; | ||
}; |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.