@sentry/opentelemetry
Advanced tools
Comparing version 7.86.0 to 7.87.0
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const core = require('@sentry/core'); | ||
const hub = require('./custom/hub.js'); | ||
@@ -8,3 +9,3 @@ const contextData = require('./utils/contextData.js'); | ||
const carrier = {}; | ||
hub.ensureHubOnCarrier(carrier, parent); | ||
core.ensureHubOnCarrier(carrier, parent); | ||
return hub.getHubFromCarrier(carrier); | ||
@@ -11,0 +12,0 @@ } |
@@ -61,10 +61,10 @@ var { | ||
* Extends the base `_prepareEvent` so that we can properly handle `captureContext`. | ||
* This uses `Scope.clone()`, which we need to replace with `NodeExperimentalScope.clone()` for this client. | ||
* This uses `Scope.clone()`, which we need to replace with `OpenTelemetryScope.clone()` for this client. | ||
*/ | ||
_prepareEvent(event, hint, scope$1) { | ||
let actualScope = scope$1; | ||
_prepareEvent(event, hint, scope) { | ||
let actualScope = scope; | ||
// Remove `captureContext` hint and instead clone already here | ||
if (hint && hint.captureContext) { | ||
actualScope = scope.OpenTelemetryScope.clone(scope$1); | ||
actualScope = getFinalScope(scope, hint.captureContext); | ||
delete hint.captureContext; | ||
@@ -81,3 +81,9 @@ } | ||
function getFinalScope(scope$1, captureContext) { | ||
const finalScope = scope$1 ? scope$1.clone() : new scope.OpenTelemetryScope(); | ||
finalScope.update(captureContext); | ||
return finalScope; | ||
} | ||
exports.wrapClientClass = wrapClientClass; | ||
//# sourceMappingURL=client.js.map |
@@ -15,15 +15,2 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
pushScope() { | ||
// We want to clone the content of prev scope | ||
const scope$1 = scope.OpenTelemetryScope.clone(this.getScope()); | ||
this.getStack().push({ | ||
client: this.getClient(), | ||
scope: scope$1, | ||
}); | ||
return scope$1; | ||
} | ||
} | ||
@@ -104,18 +91,2 @@ | ||
/** | ||
* @private Private API with no semver guarantees! | ||
* | ||
* If the carrier does not contain a hub, a new hub is created with the global hub client and scope. | ||
*/ | ||
function ensureHubOnCarrier(carrier, parent = getGlobalHub()) { | ||
// If there's no hub on current domain, or it's an old API, assign a new one | ||
if (!hasHubOnCarrier(carrier) || getHubFromCarrier(carrier).isOlderThan(API_VERSION)) { | ||
const globalHubTopStack = parent.getStackTop(); | ||
setHubOnCarrier( | ||
carrier, | ||
new OpenTelemetryHub(globalHubTopStack.client, scope.OpenTelemetryScope.clone(globalHubTopStack.scope)), | ||
); | ||
} | ||
} | ||
function getGlobalHub(registry = getMainCarrier()) { | ||
@@ -168,3 +139,2 @@ // If there's no hub, or its an old API, assign a new one | ||
exports.OpenTelemetryHub = OpenTelemetryHub; | ||
exports.ensureHubOnCarrier = ensureHubOnCarrier; | ||
exports.getClient = getClient; | ||
@@ -171,0 +141,0 @@ exports.getCurrentHub = getCurrentHub; |
@@ -23,20 +23,26 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
static clone(scope) { | ||
return scope ? scope.clone() : new OpenTelemetryScope(); | ||
} | ||
/** | ||
* Clone this scope instance. | ||
*/ | ||
clone() { | ||
const newScope = new OpenTelemetryScope(); | ||
if (scope) { | ||
newScope._breadcrumbs = [...scope['_breadcrumbs']]; | ||
newScope._tags = { ...scope['_tags'] }; | ||
newScope._extra = { ...scope['_extra'] }; | ||
newScope._contexts = { ...scope['_contexts'] }; | ||
newScope._user = scope['_user']; | ||
newScope._level = scope['_level']; | ||
newScope._span = scope['_span']; | ||
newScope._session = scope['_session']; | ||
newScope._transactionName = scope['_transactionName']; | ||
newScope._fingerprint = scope['_fingerprint']; | ||
newScope._eventProcessors = [...scope['_eventProcessors']]; | ||
newScope._requestSession = scope['_requestSession']; | ||
newScope._attachments = [...scope['_attachments']]; | ||
newScope._sdkProcessingMetadata = { ...scope['_sdkProcessingMetadata'] }; | ||
newScope._propagationContext = { ...scope['_propagationContext'] }; | ||
} | ||
newScope._breadcrumbs = [...this['_breadcrumbs']]; | ||
newScope._tags = { ...this['_tags'] }; | ||
newScope._extra = { ...this['_extra'] }; | ||
newScope._contexts = { ...this['_contexts'] }; | ||
newScope._user = this['_user']; | ||
newScope._level = this['_level']; | ||
newScope._span = this['_span']; | ||
newScope._session = this['_session']; | ||
newScope._transactionName = this['_transactionName']; | ||
newScope._fingerprint = this['_fingerprint']; | ||
newScope._eventProcessors = [...this['_eventProcessors']]; | ||
newScope._requestSession = this['_requestSession']; | ||
newScope._attachments = [...this['_attachments']]; | ||
newScope._sdkProcessingMetadata = { ...this['_sdkProcessingMetadata'] }; | ||
newScope._propagationContext = { ...this['_propagationContext'] }; | ||
return newScope; | ||
@@ -43,0 +49,0 @@ } |
@@ -106,4 +106,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// We make sure to use the current span as the activeSpan for this transaction | ||
const scope$1 = spanData.getSpanScope(span); | ||
const forkedScope = scope.OpenTelemetryScope.clone(scope$1 ) ; | ||
const scope$1 = spanData.getSpanScope(span) ; | ||
const forkedScope = scope$1 ? scope$1.clone() : new scope.OpenTelemetryScope(); | ||
forkedScope.activeSpan = span ; | ||
@@ -110,0 +110,0 @@ |
@@ -1,2 +0,3 @@ | ||
import { getCurrentHub, ensureHubOnCarrier, getHubFromCarrier } from './custom/hub.js'; | ||
import { ensureHubOnCarrier } from '@sentry/core'; | ||
import { getCurrentHub, getHubFromCarrier } from './custom/hub.js'; | ||
import { setHubOnContext } from './utils/contextData.js'; | ||
@@ -3,0 +4,0 @@ |
@@ -56,3 +56,3 @@ import { _optionalChain } from '@sentry/utils'; | ||
* Extends the base `_prepareEvent` so that we can properly handle `captureContext`. | ||
* This uses `Scope.clone()`, which we need to replace with `NodeExperimentalScope.clone()` for this client. | ||
* This uses `Scope.clone()`, which we need to replace with `OpenTelemetryScope.clone()` for this client. | ||
*/ | ||
@@ -64,3 +64,3 @@ _prepareEvent(event, hint, scope) { | ||
if (hint && hint.captureContext) { | ||
actualScope = OpenTelemetryScope.clone(scope); | ||
actualScope = getFinalScope(scope, hint.captureContext); | ||
delete hint.captureContext; | ||
@@ -77,3 +77,9 @@ } | ||
function getFinalScope(scope, captureContext) { | ||
const finalScope = scope ? scope.clone() : new OpenTelemetryScope(); | ||
finalScope.update(captureContext); | ||
return finalScope; | ||
} | ||
export { wrapClientClass }; | ||
//# sourceMappingURL=client.js.map |
@@ -13,15 +13,2 @@ import { Hub } from '@sentry/core'; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
pushScope() { | ||
// We want to clone the content of prev scope | ||
const scope = OpenTelemetryScope.clone(this.getScope()); | ||
this.getStack().push({ | ||
client: this.getClient(), | ||
scope, | ||
}); | ||
return scope; | ||
} | ||
} | ||
@@ -102,18 +89,2 @@ | ||
/** | ||
* @private Private API with no semver guarantees! | ||
* | ||
* If the carrier does not contain a hub, a new hub is created with the global hub client and scope. | ||
*/ | ||
function ensureHubOnCarrier(carrier, parent = getGlobalHub()) { | ||
// If there's no hub on current domain, or it's an old API, assign a new one | ||
if (!hasHubOnCarrier(carrier) || getHubFromCarrier(carrier).isOlderThan(API_VERSION)) { | ||
const globalHubTopStack = parent.getStackTop(); | ||
setHubOnCarrier( | ||
carrier, | ||
new OpenTelemetryHub(globalHubTopStack.client, OpenTelemetryScope.clone(globalHubTopStack.scope)), | ||
); | ||
} | ||
} | ||
function getGlobalHub(registry = getMainCarrier()) { | ||
@@ -165,3 +136,3 @@ // If there's no hub, or its an old API, assign a new one | ||
export { OpenTelemetryHub, ensureHubOnCarrier, getClient, getCurrentHub, getHubFromCarrier, setupGlobalHub }; | ||
export { OpenTelemetryHub, getClient, getCurrentHub, getHubFromCarrier, setupGlobalHub }; | ||
//# sourceMappingURL=hub.js.map |
@@ -21,20 +21,26 @@ import { Scope } from '@sentry/core'; | ||
static clone(scope) { | ||
return scope ? scope.clone() : new OpenTelemetryScope(); | ||
} | ||
/** | ||
* Clone this scope instance. | ||
*/ | ||
clone() { | ||
const newScope = new OpenTelemetryScope(); | ||
if (scope) { | ||
newScope._breadcrumbs = [...scope['_breadcrumbs']]; | ||
newScope._tags = { ...scope['_tags'] }; | ||
newScope._extra = { ...scope['_extra'] }; | ||
newScope._contexts = { ...scope['_contexts'] }; | ||
newScope._user = scope['_user']; | ||
newScope._level = scope['_level']; | ||
newScope._span = scope['_span']; | ||
newScope._session = scope['_session']; | ||
newScope._transactionName = scope['_transactionName']; | ||
newScope._fingerprint = scope['_fingerprint']; | ||
newScope._eventProcessors = [...scope['_eventProcessors']]; | ||
newScope._requestSession = scope['_requestSession']; | ||
newScope._attachments = [...scope['_attachments']]; | ||
newScope._sdkProcessingMetadata = { ...scope['_sdkProcessingMetadata'] }; | ||
newScope._propagationContext = { ...scope['_propagationContext'] }; | ||
} | ||
newScope._breadcrumbs = [...this['_breadcrumbs']]; | ||
newScope._tags = { ...this['_tags'] }; | ||
newScope._extra = { ...this['_extra'] }; | ||
newScope._contexts = { ...this['_contexts'] }; | ||
newScope._user = this['_user']; | ||
newScope._level = this['_level']; | ||
newScope._span = this['_span']; | ||
newScope._session = this['_session']; | ||
newScope._transactionName = this['_transactionName']; | ||
newScope._fingerprint = this['_fingerprint']; | ||
newScope._eventProcessors = [...this['_eventProcessors']]; | ||
newScope._requestSession = this['_requestSession']; | ||
newScope._attachments = [...this['_attachments']]; | ||
newScope._sdkProcessingMetadata = { ...this['_sdkProcessingMetadata'] }; | ||
newScope._propagationContext = { ...this['_propagationContext'] }; | ||
return newScope; | ||
@@ -41,0 +47,0 @@ } |
@@ -104,4 +104,4 @@ import { SpanKind } from '@opentelemetry/api'; | ||
// We make sure to use the current span as the activeSpan for this transaction | ||
const scope = getSpanScope(span); | ||
const forkedScope = OpenTelemetryScope.clone(scope ) ; | ||
const scope = getSpanScope(span) ; | ||
const forkedScope = scope ? scope.clone() : new OpenTelemetryScope(); | ||
forkedScope.activeSpan = span ; | ||
@@ -108,0 +108,0 @@ |
{ | ||
"name": "@sentry/opentelemetry", | ||
"version": "7.86.0", | ||
"version": "7.87.0", | ||
"description": "Official Sentry utilities for OpenTelemetry", | ||
@@ -26,5 +26,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.86.0", | ||
"@sentry/types": "7.86.0", | ||
"@sentry/utils": "7.86.0" | ||
"@sentry/core": "7.87.0", | ||
"@sentry/types": "7.87.0", | ||
"@sentry/utils": "7.87.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "peerDependencies": { |
@@ -10,6 +10,2 @@ import { Carrier, Scope } from '@sentry/core'; | ||
constructor(client?: Client, scope?: Scope); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
pushScope(): Scope; | ||
} | ||
@@ -16,0 +12,0 @@ /** Custom getClient method that uses the custom hub. */ |
@@ -16,2 +16,6 @@ import { Span } from '@opentelemetry/api'; | ||
/** | ||
* Clone this scope instance. | ||
*/ | ||
clone(): OpenTelemetryScope; | ||
/** | ||
* In node-experimental, scope.getSpan() always returns undefined. | ||
@@ -18,0 +22,0 @@ * Instead, use the global `getActiveSpan()`. |
@@ -10,6 +10,2 @@ import type { Carrier, Scope } from '@sentry/core'; | ||
constructor(client?: Client, scope?: Scope); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
pushScope(): Scope; | ||
} | ||
@@ -16,0 +12,0 @@ /** Custom getClient method that uses the custom hub. */ |
@@ -16,2 +16,6 @@ import type { Span } from '@opentelemetry/api'; | ||
/** | ||
* Clone this scope instance. | ||
*/ | ||
clone(): OpenTelemetryScope; | ||
/** | ||
* In node-experimental, scope.getSpan() always returns undefined. | ||
@@ -18,0 +22,0 @@ * Instead, use the global `getActiveSpan()`. |
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
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
502203
4669
+ Added@sentry/core@7.87.0(transitive)
+ Added@sentry/types@7.87.0(transitive)
+ Added@sentry/utils@7.87.0(transitive)
- Removed@sentry/core@7.86.0(transitive)
- Removed@sentry/types@7.86.0(transitive)
- Removed@sentry/utils@7.86.0(transitive)
Updated@sentry/core@7.87.0
Updated@sentry/types@7.87.0
Updated@sentry/utils@7.87.0