-
-
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(browser): Add protocol attributes to resource spans #15161
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { SentrySpan, getCurrentScope, getIsolationScope, setCurrentClient, spanToJSON } from '@sentry/core'; | ||
import { startAndEndSpan } from '../../src/metrics/utils'; | ||
import { extractNetworkProtocol, startAndEndSpan } from '../../src/metrics/utils'; | ||
import { TestClient, getDefaultClientOptions } from '../utils/TestClient'; | ||
|
||
describe('startAndEndSpan()', () => { | ||
|
@@ -54,3 +54,44 @@ describe('startAndEndSpan()', () => { | |
expect(spanToJSON(parentSpan).start_timestamp).toEqual(123); | ||
}); | ||
}); | ||
|
||
describe('HTTPTimings', () => { | ||
test.each([ | ||
['http/0.9', { name: 'http', version: '0.9' }], | ||
['http/1.0', { name: 'http', version: '1.0' }], | ||
['http/1.1', { name: 'http', version: '1.1' }], | ||
['spdy/1', { name: 'spdy', version: '1' }], | ||
['spdy/2', { name: 'spdy', version: '2' }], | ||
['spdy/3', { name: 'spdy', version: '3' }], | ||
['stun.turn', { name: 'stun.turn', version: 'unknown' }], | ||
['stun.nat-discovery', { name: 'stun.nat-discovery', version: 'unknown' }], | ||
['h2', { name: 'http', version: '2' }], | ||
['h2c', { name: 'http', version: '2c' }], | ||
['webrtc', { name: 'webrtc', version: 'unknown' }], | ||
['c-webrtc', { name: 'c-webrtc', version: 'unknown' }], | ||
['ftp', { name: 'ftp', version: 'unknown' }], | ||
['imap', { name: 'imap', version: 'unknown' }], | ||
['pop3', { name: 'pop', version: '3' }], | ||
['managesieve', { name: 'managesieve', version: 'unknown' }], | ||
['coap', { name: 'coap', version: 'unknown' }], | ||
['xmpp-client', { name: 'xmpp-client', version: 'unknown' }], | ||
['xmpp-server', { name: 'xmpp-server', version: 'unknown' }], | ||
['acme-tls/1', { name: 'acme-tls', version: '1' }], | ||
['mqtt', { name: 'mqtt', version: 'unknown' }], | ||
['dot', { name: 'dot', version: 'unknown' }], | ||
['ntske/1', { name: 'ntske', version: '1' }], | ||
['sunrpc', { name: 'sunrpc', version: 'unknown' }], | ||
['h3', { name: 'http', version: '3' }], | ||
['smb', { name: 'smb', version: 'unknown' }], | ||
['irc', { name: 'irc', version: 'unknown' }], | ||
['nntp', { name: 'nntp', version: 'unknown' }], | ||
['nnsp', { name: 'nnsp', version: 'unknown' }], | ||
['doq', { name: 'doq', version: 'unknown' }], | ||
['sip/2', { name: 'sip', version: '2' }], | ||
['tds/8.0', { name: 'tds', version: '8.0' }], | ||
['dicom', { name: 'dicom', version: 'unknown' }], | ||
['', { name: '', version: 'unknown' }], | ||
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. I added this last case here because according to MDN, I was briefly debating changing the implementation to |
||
])('Extracting version from ALPN protocol %s', (protocol, expected) => { | ||
expect(extractNetworkProtocol(protocol)).toMatchObject(expected); | ||
}); | ||
}); |
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 prop is needed even if the metadata is not asserted, otherwise this line throws due to undefined value:
sentry-javascript/packages/browser/src/tracing/request.ts
Line 241 in a67d3ca
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.
Yeah I was a bit worried about this but I think it's okay. MDN classifies the
nextHopProtocol
prop as widely available and we previously treated it as such when adding timing info to fetch request spans. So it's okay to add this I think. If we get reports, we can still safeguard usage later.