-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(tracing): Use integer for content length #8152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,18 +214,30 @@ describe('callbacks', () => { | |
expect(newSpan).toBeUndefined(); | ||
}); | ||
|
||
it('adds content-length to span data', () => { | ||
const spans = {}; | ||
fetchHandlerData['response'] = { headers: { 'content-length': 123 } }; | ||
it('adds content-length to span data on finish', () => { | ||
const spans: Record<string, Span> = {}; | ||
|
||
// triggered by request being sent | ||
fetchCallback(fetchHandlerData, alwaysCreateSpan, alwaysAttachHeaders, spans); | ||
|
||
const newSpan = transaction.spanRecorder?.spans[1] as Span; | ||
|
||
expect(newSpan).toBeDefined(); | ||
expect(newSpan).toBeInstanceOf(Span); | ||
expect(newSpan.data).toEqual({ | ||
|
||
const postRequestFetchHandlerData = { | ||
...fetchHandlerData, | ||
endTimestamp, | ||
response: { status: 404, headers: { get: () => 123 } }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shimming out the headers obj since not available in test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah its painful but I also had to do this somewhere 😅 |
||
}; | ||
|
||
// triggered by response coming back | ||
fetchCallback(postRequestFetchHandlerData, alwaysCreateSpan, alwaysAttachHeaders, spans); | ||
|
||
const finishedSpan = transaction.spanRecorder?.spans[1] as Span; | ||
|
||
expect(finishedSpan).toBeDefined(); | ||
expect(finishedSpan).toBeInstanceOf(Span); | ||
expect(finishedSpan.data).toEqual({ | ||
'http.response_content_length': 123, | ||
'http.method': 'GET', | ||
type: 'fetch', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ describe('envelope', () => { | |
expect(headers).toEqual({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }); | ||
}); | ||
|
||
it.only('serializes an envelope with attachments', () => { | ||
it('serializes an envelope with attachments', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const items: EventEnvelope[1] = [ | ||
[{ type: 'event' }, { event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2' }], | ||
[{ type: 'attachment', filename: 'bar.txt', length: 6 }, Uint8Array.from([1, 2, 3, 4, 5, 6])], | ||
|
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 check takes care of NaN also