@sentry-internal/tracing
Advanced tools
Comparing version 7.81.1 to 7.82.0
@@ -10,2 +10,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const MAX_INT_AS_BYTES = 2147483647; | ||
/** | ||
@@ -389,11 +391,5 @@ * Converts from milliseconds to seconds | ||
const data = {}; | ||
if ('transferSize' in entry) { | ||
data['http.response_transfer_size'] = entry.transferSize; | ||
} | ||
if ('encodedBodySize' in entry) { | ||
data['http.response_content_length'] = entry.encodedBodySize; | ||
} | ||
if ('decodedBodySize' in entry) { | ||
data['http.decoded_response_content_length'] = entry.decodedBodySize; | ||
} | ||
setResourceEntrySizeData(data, entry, 'transferSize', 'http.response_transfer_size'); | ||
setResourceEntrySizeData(data, entry, 'encodedBodySize', 'http.response_content_length'); | ||
setResourceEntrySizeData(data, entry, 'decodedBodySize', 'http.decoded_response_content_length'); | ||
if ('renderBlockingStatus' in entry) { | ||
@@ -482,2 +478,14 @@ data['resource.render_blocking_status'] = entry.renderBlockingStatus; | ||
function setResourceEntrySizeData( | ||
data, | ||
entry, | ||
key, | ||
dataKey, | ||
) { | ||
const entryVal = entry[key]; | ||
if (entryVal !== undefined && entryVal < MAX_INT_AS_BYTES) { | ||
data[dataKey] = entryVal; | ||
} | ||
} | ||
exports._addMeasureSpans = _addMeasureSpans; | ||
@@ -484,0 +492,0 @@ exports._addResourceSpans = _addResourceSpans; |
@@ -52,3 +52,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (traceFetch) { | ||
utils.addInstrumentationHandler('fetch', (handlerData) => { | ||
utils.addFetchInstrumentationHandler(handlerData => { | ||
const createdSpan = fetch.instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); | ||
@@ -62,3 +62,3 @@ if (enableHTTPTimings && createdSpan) { | ||
if (traceXHR) { | ||
utils.addInstrumentationHandler('xhr', (handlerData) => { | ||
utils.addXhrInstrumentationHandler(handlerData => { | ||
const createdSpan = xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); | ||
@@ -191,3 +191,3 @@ if (enableHTTPTimings && createdSpan) { | ||
if (!core.hasTracingEnabled() || (xhr && xhr.__sentry_own_request__) || !xhr || !sentryXhrData) { | ||
if (!core.hasTracingEnabled() || !xhr || xhr.__sentry_own_request__ || !sentryXhrData) { | ||
return undefined; | ||
@@ -204,3 +204,3 @@ } | ||
const span = spans[spanId]; | ||
if (span) { | ||
if (span && sentryXhrData.status_code !== undefined) { | ||
span.setHttpStatus(sentryXhrData.status_code); | ||
@@ -223,3 +223,2 @@ span.finish(); | ||
data: { | ||
...sentryXhrData.data, | ||
type: 'xhr', | ||
@@ -226,0 +225,0 @@ 'http.method': sentryXhrData.method, |
@@ -34,3 +34,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (startTransactionOnLocationChange) { | ||
utils.addInstrumentationHandler('history', ({ to, from }) => { | ||
utils.addHistoryInstrumentationHandler(({ to, from }) => { | ||
/** | ||
@@ -37,0 +37,0 @@ * This early return is there to account for some cases where a navigation transaction starts right after |
@@ -8,2 +8,4 @@ import { getActiveTransaction } from '@sentry/core'; | ||
const MAX_INT_AS_BYTES = 2147483647; | ||
/** | ||
@@ -387,11 +389,5 @@ * Converts from milliseconds to seconds | ||
const data = {}; | ||
if ('transferSize' in entry) { | ||
data['http.response_transfer_size'] = entry.transferSize; | ||
} | ||
if ('encodedBodySize' in entry) { | ||
data['http.response_content_length'] = entry.encodedBodySize; | ||
} | ||
if ('decodedBodySize' in entry) { | ||
data['http.decoded_response_content_length'] = entry.decodedBodySize; | ||
} | ||
setResourceEntrySizeData(data, entry, 'transferSize', 'http.response_transfer_size'); | ||
setResourceEntrySizeData(data, entry, 'encodedBodySize', 'http.response_content_length'); | ||
setResourceEntrySizeData(data, entry, 'decodedBodySize', 'http.decoded_response_content_length'); | ||
if ('renderBlockingStatus' in entry) { | ||
@@ -480,3 +476,15 @@ data['resource.render_blocking_status'] = entry.renderBlockingStatus; | ||
function setResourceEntrySizeData( | ||
data, | ||
entry, | ||
key, | ||
dataKey, | ||
) { | ||
const entryVal = entry[key]; | ||
if (entryVal !== undefined && entryVal < MAX_INT_AS_BYTES) { | ||
data[dataKey] = entryVal; | ||
} | ||
} | ||
export { _addMeasureSpans, _addResourceSpans, addPerformanceEntries, startTrackingInteractions, startTrackingLongTasks, startTrackingWebVitals }; | ||
//# sourceMappingURL=index.js.map |
import { hasTracingEnabled, getCurrentHub, getDynamicSamplingContextFromClient } from '@sentry/core'; | ||
import { addInstrumentationHandler, SENTRY_XHR_DATA_KEY, dynamicSamplingContextToSentryBaggageHeader, generateSentryTraceHeader, BAGGAGE_HEADER_NAME, browserPerformanceTimeOrigin, stringMatchesSomePattern } from '@sentry/utils'; | ||
import { addFetchInstrumentationHandler, addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY, dynamicSamplingContextToSentryBaggageHeader, generateSentryTraceHeader, BAGGAGE_HEADER_NAME, browserPerformanceTimeOrigin, stringMatchesSomePattern } from '@sentry/utils'; | ||
import { instrumentFetchRequest } from '../common/fetch.js'; | ||
@@ -50,3 +50,3 @@ import { addPerformanceInstrumentationHandler } from './instrument.js'; | ||
if (traceFetch) { | ||
addInstrumentationHandler('fetch', (handlerData) => { | ||
addFetchInstrumentationHandler(handlerData => { | ||
const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); | ||
@@ -60,3 +60,3 @@ if (enableHTTPTimings && createdSpan) { | ||
if (traceXHR) { | ||
addInstrumentationHandler('xhr', (handlerData) => { | ||
addXhrInstrumentationHandler(handlerData => { | ||
const createdSpan = xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); | ||
@@ -189,3 +189,3 @@ if (enableHTTPTimings && createdSpan) { | ||
if (!hasTracingEnabled() || (xhr && xhr.__sentry_own_request__) || !xhr || !sentryXhrData) { | ||
if (!hasTracingEnabled() || !xhr || xhr.__sentry_own_request__ || !sentryXhrData) { | ||
return undefined; | ||
@@ -202,3 +202,3 @@ } | ||
const span = spans[spanId]; | ||
if (span) { | ||
if (span && sentryXhrData.status_code !== undefined) { | ||
span.setHttpStatus(sentryXhrData.status_code); | ||
@@ -221,3 +221,2 @@ span.finish(); | ||
data: { | ||
...sentryXhrData.data, | ||
type: 'xhr', | ||
@@ -224,0 +223,0 @@ 'http.method': sentryXhrData.method, |
@@ -1,2 +0,2 @@ | ||
import { logger, browserPerformanceTimeOrigin, addInstrumentationHandler } from '@sentry/utils'; | ||
import { logger, browserPerformanceTimeOrigin, addHistoryInstrumentationHandler } from '@sentry/utils'; | ||
import { WINDOW } from './types.js'; | ||
@@ -32,3 +32,3 @@ | ||
if (startTransactionOnLocationChange) { | ||
addInstrumentationHandler('history', ({ to, from }) => { | ||
addHistoryInstrumentationHandler(({ to, from }) => { | ||
/** | ||
@@ -35,0 +35,0 @@ * This early return is there to account for some cases where a navigation transaction starts right after |
{ | ||
"name": "@sentry-internal/tracing", | ||
"version": "7.81.1", | ||
"version": "7.82.0", | ||
"description": "Sentry Internal Tracing Package", | ||
@@ -26,5 +26,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.81.1", | ||
"@sentry/types": "7.81.1", | ||
"@sentry/utils": "7.81.1" | ||
"@sentry/core": "7.82.0", | ||
"@sentry/types": "7.82.0", | ||
"@sentry/utils": "7.82.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -1,3 +0,2 @@ | ||
import { Span } from '@sentry/types'; | ||
import { SENTRY_XHR_DATA_KEY } from '@sentry/utils'; | ||
import { HandlerDataXhr, Span } from '@sentry/types'; | ||
export declare const DEFAULT_TRACE_PROPAGATION_TARGETS: (string | RegExp)[]; | ||
@@ -48,19 +47,2 @@ /** Options for Request Instrumentation */ | ||
} | ||
/** Data returned from XHR request */ | ||
export interface XHRData { | ||
xhr?: { | ||
[SENTRY_XHR_DATA_KEY]?: { | ||
method: string; | ||
url: string; | ||
status_code: number; | ||
data: Record<string, any>; | ||
}; | ||
__sentry_xhr_span_id__?: string; | ||
setRequestHeader?: (key: string, val: string) => void; | ||
getRequestHeader?: (key: string) => string; | ||
__sentry_own_request__?: boolean; | ||
}; | ||
startTimestamp: number; | ||
endTimestamp?: number; | ||
} | ||
export declare const defaultRequestInstrumentationOptions: RequestInstrumentationOptions; | ||
@@ -90,3 +72,3 @@ /** Registers span creators for xhr and fetch requests */ | ||
*/ | ||
export declare function xhrCallback(handlerData: XHRData, shouldCreateSpan: (url: string) => boolean, shouldAttachHeaders: (url: string) => boolean, spans: Record<string, Span>): Span | undefined; | ||
export declare function xhrCallback(handlerData: HandlerDataXhr, shouldCreateSpan: (url: string) => boolean, shouldAttachHeaders: (url: string) => boolean, spans: Record<string, Span>): Span | undefined; | ||
//# sourceMappingURL=request.d.ts.map |
@@ -1,3 +0,2 @@ | ||
import type { Span } from '@sentry/types'; | ||
import { SENTRY_XHR_DATA_KEY } from '@sentry/utils'; | ||
import type { HandlerDataXhr, Span } from '@sentry/types'; | ||
export declare const DEFAULT_TRACE_PROPAGATION_TARGETS: (string | RegExp)[]; | ||
@@ -48,19 +47,2 @@ /** Options for Request Instrumentation */ | ||
} | ||
/** Data returned from XHR request */ | ||
export interface XHRData { | ||
xhr?: { | ||
[SENTRY_XHR_DATA_KEY]?: { | ||
method: string; | ||
url: string; | ||
status_code: number; | ||
data: Record<string, any>; | ||
}; | ||
__sentry_xhr_span_id__?: string; | ||
setRequestHeader?: (key: string, val: string) => void; | ||
getRequestHeader?: (key: string) => string; | ||
__sentry_own_request__?: boolean; | ||
}; | ||
startTimestamp: number; | ||
endTimestamp?: number; | ||
} | ||
export declare const defaultRequestInstrumentationOptions: RequestInstrumentationOptions; | ||
@@ -90,3 +72,3 @@ /** Registers span creators for xhr and fetch requests */ | ||
*/ | ||
export declare function xhrCallback(handlerData: XHRData, shouldCreateSpan: (url: string) => boolean, shouldAttachHeaders: (url: string) => boolean, spans: Record<string, Span>): Span | undefined; | ||
export declare function xhrCallback(handlerData: HandlerDataXhr, shouldCreateSpan: (url: string) => boolean, shouldAttachHeaders: (url: string) => boolean, spans: Record<string, Span>): Span | undefined; | ||
//# sourceMappingURL=request.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1040263
8698
+ Added@sentry/core@7.82.0(transitive)
+ Added@sentry/types@7.82.0(transitive)
+ Added@sentry/utils@7.82.0(transitive)
- Removed@sentry/core@7.81.1(transitive)
- Removed@sentry/types@7.81.1(transitive)
- Removed@sentry/utils@7.81.1(transitive)
Updated@sentry/core@7.82.0
Updated@sentry/types@7.82.0
Updated@sentry/utils@7.82.0