-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test(e2e/react): Add e2e tests for Scope transactionName
changes
#11053
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
Closed
Conversation
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
Comment on lines
+68
to
+99
const sentryRequest = https.request( | ||
sentryIngestUrl, | ||
{ headers: proxyRequest.headers, method: proxyRequest.method }, | ||
sentryResponse => { | ||
sentryResponse.addListener('data', (chunk: Buffer) => { | ||
proxyResponse.write(chunk, 'binary'); | ||
sentryResponseChunks.push(chunk); | ||
}); | ||
|
||
sentryResponse.addListener('end', () => { | ||
eventCallbackListeners.forEach(listener => { | ||
const rawSentryResponseBody = Buffer.concat(sentryResponseChunks).toString(); | ||
|
||
const data: SentryRequestCallbackData = { | ||
envelope: parseEnvelope(proxyRequestBody), | ||
rawProxyRequestBody: proxyRequestBody, | ||
rawSentryResponseBody, | ||
sentryResponseStatusCode: sentryResponse.statusCode, | ||
}; | ||
|
||
listener(Buffer.from(JSON.stringify(data)).toString('base64')); | ||
}); | ||
proxyResponse.end(); | ||
}); | ||
|
||
sentryResponse.addListener('error', err => { | ||
throw err; | ||
}); | ||
|
||
proxyResponse.writeHead(sentryResponse.statusCode || 500, sentryResponse.headers); | ||
}, | ||
); |
Check failure
Code scanning / CodeQL
Server-side request forgery
The [URL](1) of this request depends on a [user-provided value](2).
Lms24
commented
Mar 12, 2024
Comment on lines
+13
to
+42
expect(error).toMatchObject({ | ||
exception: { | ||
values: [ | ||
{ | ||
type: 'Error', | ||
value: 'I am an error!', | ||
mechanism: { | ||
type: 'generic', | ||
handled: true, // called via captureException, this makes sense | ||
}, | ||
}, | ||
], | ||
}, | ||
transaction: '/', | ||
contexts: { | ||
trace: { | ||
data: { | ||
'sentry.source': 'route', | ||
'sentry.origin': 'auto.pageload.react.reactrouter_v6', | ||
'sentry.op': 'pageload', | ||
'sentry.sample_rate': 1, | ||
}, | ||
op: 'pageload', | ||
span_id: expect.any(String), | ||
trace_id: expect.any(String), | ||
origin: 'auto.pageload.react.reactrouter_v6', | ||
}, | ||
}, | ||
}); | ||
}); |
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 checks two things:
- That the trace context is applied correctly to the error event (this is inherently tied to the active root span)
- That the
transaction
field is set correctly (this is no longer tied to the active root span at all)
mydea
approved these changes
Mar 12, 2024
9d16569
to
7680875
Compare
Base automatically changed from
lms/feat-react-auto-update-transactionName
to
develop
March 12, 2024 16:43
01ea3e7
to
defe516
Compare
92d3a07
to
1e5dd9c
Compare
@Lms24 would we still like to merge this? |
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.
This PR adds two React
standard-frontend-react
e2e tests to cover the changes made in #11048. To avoid adding tests that poll the Sentry API and potentially cause timeouts, I added our event proxy e2e testing stragegy to thestandard-frontend-react
test app.ref #10846