@sentry-internal/tracing
Advanced tools
Comparing version 7.47.0 to 7.48.0
@@ -204,6 +204,9 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
) { | ||
const xhr = handlerData.xhr; | ||
const sentryXhrData = xhr && xhr[utils.SENTRY_XHR_DATA_KEY]; | ||
if ( | ||
!core.hasTracingEnabled() || | ||
(handlerData.xhr && handlerData.xhr.__sentry_own_request__) || | ||
!(handlerData.xhr && handlerData.xhr.__sentry_xhr__ && shouldCreateSpan(handlerData.xhr.__sentry_xhr__.url)) | ||
(xhr && xhr.__sentry_own_request__) || | ||
!(xhr && sentryXhrData && shouldCreateSpan(sentryXhrData.url)) | ||
) { | ||
@@ -213,7 +216,5 @@ return; | ||
const xhr = handlerData.xhr.__sentry_xhr__; | ||
// check first if the request has finished and is tracked by an existing span which should now end | ||
if (handlerData.endTimestamp) { | ||
const spanId = handlerData.xhr.__sentry_xhr_span_id__; | ||
const spanId = xhr.__sentry_xhr_span_id__; | ||
if (!spanId) return; | ||
@@ -223,3 +224,3 @@ | ||
if (span) { | ||
span.setHttpStatus(xhr.status_code); | ||
span.setHttpStatus(sentryXhrData.status_code); | ||
span.finish(); | ||
@@ -240,17 +241,17 @@ | ||
data: { | ||
...xhr.data, | ||
...sentryXhrData.data, | ||
type: 'xhr', | ||
method: xhr.method, | ||
url: xhr.url, | ||
method: sentryXhrData.method, | ||
url: sentryXhrData.url, | ||
}, | ||
description: `${xhr.method} ${xhr.url}`, | ||
description: `${sentryXhrData.method} ${sentryXhrData.url}`, | ||
op: 'http.client', | ||
}); | ||
handlerData.xhr.__sentry_xhr_span_id__ = span.spanId; | ||
spans[handlerData.xhr.__sentry_xhr_span_id__] = span; | ||
xhr.__sentry_xhr_span_id__ = span.spanId; | ||
spans[xhr.__sentry_xhr_span_id__] = span; | ||
if (handlerData.xhr.setRequestHeader && shouldAttachHeaders(handlerData.xhr.__sentry_xhr__.url)) { | ||
if (xhr.setRequestHeader && shouldAttachHeaders(sentryXhrData.url)) { | ||
try { | ||
handlerData.xhr.setRequestHeader('sentry-trace', span.toTraceparent()); | ||
xhr.setRequestHeader('sentry-trace', span.toTraceparent()); | ||
@@ -264,3 +265,3 @@ const dynamicSamplingContext = activeTransaction.getDynamicSamplingContext(); | ||
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader | ||
handlerData.xhr.setRequestHeader(utils.BAGGAGE_HEADER_NAME, sentryBaggageHeader); | ||
xhr.setRequestHeader(utils.BAGGAGE_HEADER_NAME, sentryBaggageHeader); | ||
} | ||
@@ -267,0 +268,0 @@ } catch (_) { |
@@ -1,7 +0,4 @@ | ||
var { | ||
_optionalChain | ||
} = require('@sentry/utils/cjs/buildPolyfills'); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const core = require('@sentry/core'); | ||
const utils = require('@sentry/utils'); | ||
@@ -59,29 +56,10 @@ const nodeUtils = require('./utils/node-utils.js'); | ||
this._client.$use((params, next) => { | ||
const scope = getCurrentHub().getScope(); | ||
const parentSpan = _optionalChain([scope, 'optionalAccess', _2 => _2.getSpan, 'call', _3 => _3()]); | ||
const action = params.action; | ||
const model = params.model; | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _4 => _4.startChild, 'call', _5 => _5({ | ||
description: model ? `${model} ${action}` : action, | ||
op: 'db.sql.prisma', | ||
})]); | ||
const rv = next(params); | ||
if (utils.isThenable(rv)) { | ||
return rv.then((res) => { | ||
_optionalChain([span, 'optionalAccess', _6 => _6.finish, 'call', _7 => _7()]); | ||
return res; | ||
}); | ||
} | ||
_optionalChain([span, 'optionalAccess', _8 => _8.finish, 'call', _9 => _9()]); | ||
return rv; | ||
return core.trace({ name: model ? `${model} ${action}` : action, op: 'db.sql.prisma' }, () => next(params)); | ||
}); | ||
} | ||
}Prisma.__initStatic(); | ||
} Prisma.__initStatic(); | ||
exports.Prisma = Prisma; | ||
//# sourceMappingURL=prisma.js.map |
import { hasTracingEnabled, getCurrentHub } from '@sentry/core'; | ||
import { addInstrumentationHandler, dynamicSamplingContextToSentryBaggageHeader, isInstanceOf, BAGGAGE_HEADER_NAME, stringMatchesSomePattern } from '@sentry/utils'; | ||
import { addInstrumentationHandler, dynamicSamplingContextToSentryBaggageHeader, isInstanceOf, BAGGAGE_HEADER_NAME, SENTRY_XHR_DATA_KEY, stringMatchesSomePattern } from '@sentry/utils'; | ||
@@ -202,6 +202,9 @@ /* eslint-disable max-lines */ | ||
) { | ||
const xhr = handlerData.xhr; | ||
const sentryXhrData = xhr && xhr[SENTRY_XHR_DATA_KEY]; | ||
if ( | ||
!hasTracingEnabled() || | ||
(handlerData.xhr && handlerData.xhr.__sentry_own_request__) || | ||
!(handlerData.xhr && handlerData.xhr.__sentry_xhr__ && shouldCreateSpan(handlerData.xhr.__sentry_xhr__.url)) | ||
(xhr && xhr.__sentry_own_request__) || | ||
!(xhr && sentryXhrData && shouldCreateSpan(sentryXhrData.url)) | ||
) { | ||
@@ -211,7 +214,5 @@ return; | ||
const xhr = handlerData.xhr.__sentry_xhr__; | ||
// check first if the request has finished and is tracked by an existing span which should now end | ||
if (handlerData.endTimestamp) { | ||
const spanId = handlerData.xhr.__sentry_xhr_span_id__; | ||
const spanId = xhr.__sentry_xhr_span_id__; | ||
if (!spanId) return; | ||
@@ -221,3 +222,3 @@ | ||
if (span) { | ||
span.setHttpStatus(xhr.status_code); | ||
span.setHttpStatus(sentryXhrData.status_code); | ||
span.finish(); | ||
@@ -238,17 +239,17 @@ | ||
data: { | ||
...xhr.data, | ||
...sentryXhrData.data, | ||
type: 'xhr', | ||
method: xhr.method, | ||
url: xhr.url, | ||
method: sentryXhrData.method, | ||
url: sentryXhrData.url, | ||
}, | ||
description: `${xhr.method} ${xhr.url}`, | ||
description: `${sentryXhrData.method} ${sentryXhrData.url}`, | ||
op: 'http.client', | ||
}); | ||
handlerData.xhr.__sentry_xhr_span_id__ = span.spanId; | ||
spans[handlerData.xhr.__sentry_xhr_span_id__] = span; | ||
xhr.__sentry_xhr_span_id__ = span.spanId; | ||
spans[xhr.__sentry_xhr_span_id__] = span; | ||
if (handlerData.xhr.setRequestHeader && shouldAttachHeaders(handlerData.xhr.__sentry_xhr__.url)) { | ||
if (xhr.setRequestHeader && shouldAttachHeaders(sentryXhrData.url)) { | ||
try { | ||
handlerData.xhr.setRequestHeader('sentry-trace', span.toTraceparent()); | ||
xhr.setRequestHeader('sentry-trace', span.toTraceparent()); | ||
@@ -262,3 +263,3 @@ const dynamicSamplingContext = activeTransaction.getDynamicSamplingContext(); | ||
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader | ||
handlerData.xhr.setRequestHeader(BAGGAGE_HEADER_NAME, sentryBaggageHeader); | ||
xhr.setRequestHeader(BAGGAGE_HEADER_NAME, sentryBaggageHeader); | ||
} | ||
@@ -265,0 +266,0 @@ } catch (_) { |
@@ -1,3 +0,3 @@ | ||
import { _optionalChain } from '@sentry/utils/esm/buildPolyfills'; | ||
import { logger, isThenable } from '@sentry/utils'; | ||
import { trace } from '@sentry/core'; | ||
import { logger } from '@sentry/utils'; | ||
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js'; | ||
@@ -54,29 +54,10 @@ | ||
this._client.$use((params, next) => { | ||
const scope = getCurrentHub().getScope(); | ||
const parentSpan = _optionalChain([scope, 'optionalAccess', _2 => _2.getSpan, 'call', _3 => _3()]); | ||
const action = params.action; | ||
const model = params.model; | ||
const span = _optionalChain([parentSpan, 'optionalAccess', _4 => _4.startChild, 'call', _5 => _5({ | ||
description: model ? `${model} ${action}` : action, | ||
op: 'db.sql.prisma', | ||
})]); | ||
const rv = next(params); | ||
if (isThenable(rv)) { | ||
return rv.then((res) => { | ||
_optionalChain([span, 'optionalAccess', _6 => _6.finish, 'call', _7 => _7()]); | ||
return res; | ||
}); | ||
} | ||
_optionalChain([span, 'optionalAccess', _8 => _8.finish, 'call', _9 => _9()]); | ||
return rv; | ||
return trace({ name: model ? `${model} ${action}` : action, op: 'db.sql.prisma' }, () => next(params)); | ||
}); | ||
} | ||
}Prisma.__initStatic(); | ||
} Prisma.__initStatic(); | ||
export { Prisma }; | ||
//# sourceMappingURL=prisma.js.map |
{ | ||
"name": "@sentry-internal/tracing", | ||
"version": "7.47.0", | ||
"version": "7.48.0", | ||
"description": "Sentry Internal Tracing Package", | ||
@@ -19,5 +19,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.47.0", | ||
"@sentry/types": "7.47.0", | ||
"@sentry/utils": "7.47.0", | ||
"@sentry/core": "7.48.0", | ||
"@sentry/types": "7.48.0", | ||
"@sentry/utils": "7.48.0", | ||
"tslib": "^1.9.3" | ||
@@ -24,0 +24,0 @@ }, |
import type { DynamicSamplingContext, Span } from '@sentry/types'; | ||
import { SENTRY_XHR_DATA_KEY } from '@sentry/utils'; | ||
export declare const DEFAULT_TRACE_PROPAGATION_TARGETS: (string | RegExp)[]; | ||
@@ -54,3 +55,3 @@ /** Options for Request Instrumentation */ | ||
xhr?: { | ||
__sentry_xhr__?: { | ||
[SENTRY_XHR_DATA_KEY]?: { | ||
method: string; | ||
@@ -57,0 +58,0 @@ url: string; |
import type { Hub } from '@sentry/core'; | ||
import type { EventProcessor } from '@sentry/types'; | ||
import type { LazyLoadedIntegration } from './lazy'; | ||
declare type Operation = typeof OPERATIONS[number]; | ||
declare type Operation = (typeof OPERATIONS)[number]; | ||
declare const OPERATIONS: readonly ["aggregate", "bulkWrite", "countDocuments", "createIndex", "createIndexes", "deleteMany", "deleteOne", "distinct", "drop", "dropIndex", "dropIndexes", "estimatedDocumentCount", "find", "findOne", "findOneAndDelete", "findOneAndReplace", "findOneAndUpdate", "indexes", "indexExists", "indexInformation", "initializeOrderedBulkOp", "insertMany", "insertOne", "isCapped", "mapReduce", "options", "parallelCollectionScan", "rename", "replaceOne", "stats", "updateMany", "updateOne"]; | ||
@@ -6,0 +6,0 @@ interface MongoCollection { |
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
Sorry, the diff of this file is not supported yet
832219
6157
+ Added@sentry/core@7.48.0(transitive)
+ Added@sentry/types@7.48.0(transitive)
+ Added@sentry/utils@7.48.0(transitive)
- Removed@sentry/core@7.47.0(transitive)
- Removed@sentry/types@7.47.0(transitive)
- Removed@sentry/utils@7.47.0(transitive)
Updated@sentry/core@7.48.0
Updated@sentry/types@7.48.0
Updated@sentry/utils@7.48.0