Socket
Socket
Sign inDemoInstall

@sentry/opentelemetry

Package Overview
Dependencies
Maintainers
11
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/opentelemetry - npm Package Compare versions

Comparing version 7.91.0 to 7.92.0

2

cjs/custom/client.js

@@ -67,3 +67,3 @@ var {

scope,
isolationScope,
_isolationScope,
) {

@@ -70,0 +70,0 @@ let actualScope = scope;

@@ -56,2 +56,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

exports.startSpan = trace.startSpan;
exports.startSpanManual = trace.startSpanManual;
exports.getClient = hub.getClient;

@@ -58,0 +59,0 @@ exports.getCurrentHub = hub.getCurrentHub;

@@ -14,3 +14,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

function onSpanStart(span, parentContext, ScopeClass) {
function onSpanStart(span, parentContext, _ScopeClass) {
// This is a reliable way to get the parent span - because this is exactly how the parent is identified in the OTEL SDK

@@ -17,0 +17,0 @@ const parentSpan = api.trace.getSpan(parentContext);

@@ -5,3 +5,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

const core = require('@sentry/core');
const utils = require('@sentry/utils');
const hub = require('./custom/hub.js');

@@ -25,33 +24,38 @@ const semanticAttributes = require('./semanticAttributes.js');

return tracer.startActiveSpan(name, span => {
function finishSpan() {
span.end();
}
return tracer.startActiveSpan(name, spanContext, span => {
_applySentryAttributesToSpan(span, spanContext);
let maybePromiseResult;
try {
maybePromiseResult = callback(span);
} catch (e) {
span.setStatus({ code: api.SpanStatusCode.ERROR });
finishSpan();
throw e;
}
return core.handleCallbackErrors(
() => callback(span),
() => {
span.setStatus({ code: api.SpanStatusCode.ERROR });
},
() => span.end(),
);
});
}
if (utils.isThenable(maybePromiseResult)) {
Promise.resolve(maybePromiseResult).then(
() => {
finishSpan();
},
() => {
span.setStatus({ code: api.SpanStatusCode.ERROR });
finishSpan();
},
);
} else {
finishSpan();
}
/**
* Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span
* after the function is done automatically. You'll have to call `span.end()` manually.
*
* The created span is the active span and will be used as parent by other spans created inside the function
* and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
*
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
*/
function startSpanManual(spanContext, callback) {
const tracer = getTracer();
return maybePromiseResult;
const { name } = spanContext;
return tracer.startActiveSpan(name, spanContext, span => {
_applySentryAttributesToSpan(span, spanContext);
return core.handleCallbackErrors(
() => callback(span),
() => {
span.setStatus({ code: api.SpanStatusCode.ERROR });
},
);
});

@@ -75,3 +79,3 @@ }

const span = tracer.startSpan(name);
const span = tracer.startSpan(name, spanContext);

@@ -110,2 +114,3 @@ _applySentryAttributesToSpan(span, spanContext);

exports.startSpan = startSpan;
exports.startSpanManual = startSpanManual;
//# sourceMappingURL=trace.js.map

@@ -62,3 +62,3 @@ import { _optionalChain } from '@sentry/utils';

scope,
isolationScope,
_isolationScope,
) {

@@ -65,0 +65,0 @@ let actualScope = scope;

@@ -11,3 +11,3 @@ import { addOriginToSpan } from './utils/addOriginToSpan.js';

export { getActiveSpan, getRootSpan } from './utils/getActiveSpan.js';
export { startInactiveSpan, startSpan } from './trace.js';
export { startInactiveSpan, startSpan, startSpanManual } from './trace.js';
export { getClient, getCurrentHub, setupGlobalHub } from './custom/hub.js';

@@ -14,0 +14,0 @@ export { OpenTelemetryScope } from './custom/scope.js';

@@ -12,3 +12,3 @@ import { trace, ROOT_CONTEXT } from '@opentelemetry/api';

function onSpanStart(span, parentContext, ScopeClass) {
function onSpanStart(span, parentContext, _ScopeClass) {
// This is a reliable way to get the parent span - because this is exactly how the parent is identified in the OTEL SDK

@@ -15,0 +15,0 @@ const parentSpan = trace.getSpan(parentContext);

import { SpanStatusCode, trace } from '@opentelemetry/api';
import { SDK_VERSION } from '@sentry/core';
import { isThenable } from '@sentry/utils';
import { handleCallbackErrors, SDK_VERSION } from '@sentry/core';
import { getClient } from './custom/hub.js';

@@ -22,33 +21,38 @@ import { InternalSentrySemanticAttributes } from './semanticAttributes.js';

return tracer.startActiveSpan(name, span => {
function finishSpan() {
span.end();
}
return tracer.startActiveSpan(name, spanContext, span => {
_applySentryAttributesToSpan(span, spanContext);
let maybePromiseResult;
try {
maybePromiseResult = callback(span);
} catch (e) {
span.setStatus({ code: SpanStatusCode.ERROR });
finishSpan();
throw e;
}
return handleCallbackErrors(
() => callback(span),
() => {
span.setStatus({ code: SpanStatusCode.ERROR });
},
() => span.end(),
);
});
}
if (isThenable(maybePromiseResult)) {
Promise.resolve(maybePromiseResult).then(
() => {
finishSpan();
},
() => {
span.setStatus({ code: SpanStatusCode.ERROR });
finishSpan();
},
);
} else {
finishSpan();
}
/**
* Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span
* after the function is done automatically. You'll have to call `span.end()` manually.
*
* The created span is the active span and will be used as parent by other spans created inside the function
* and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
*
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
*/
function startSpanManual(spanContext, callback) {
const tracer = getTracer();
return maybePromiseResult;
const { name } = spanContext;
return tracer.startActiveSpan(name, spanContext, span => {
_applySentryAttributesToSpan(span, spanContext);
return handleCallbackErrors(
() => callback(span),
() => {
span.setStatus({ code: SpanStatusCode.ERROR });
},
);
});

@@ -72,3 +76,3 @@ }

const span = tracer.startSpan(name);
const span = tracer.startSpan(name, spanContext);

@@ -105,3 +109,3 @@ _applySentryAttributesToSpan(span, spanContext);

export { startInactiveSpan, startSpan };
export { startInactiveSpan, startSpan, startSpanManual };
//# sourceMappingURL=trace.js.map
{
"name": "@sentry/opentelemetry",
"version": "7.91.0",
"version": "7.92.0",
"description": "Official Sentry utilities for OpenTelemetry",

@@ -12,2 +12,8 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

},
"files": [
"cjs",
"esm",
"types",
"types-ts3.8"
],
"main": "cjs/index.js",

@@ -27,5 +33,5 @@ "module": "esm/index.js",

"dependencies": {
"@sentry/core": "7.91.0",
"@sentry/types": "7.91.0",
"@sentry/utils": "7.91.0"
"@sentry/core": "7.92.0",
"@sentry/types": "7.92.0",
"@sentry/utils": "7.92.0"
},

@@ -32,0 +38,0 @@ "peerDependencies": {

@@ -12,3 +12,3 @@ import { addOriginToSpan } from './utils/addOriginToSpan';

export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
export { startSpan, startInactiveSpan } from './trace';
export { startSpan, startSpanManual, startInactiveSpan } from './trace';
export { getCurrentHub, setupGlobalHub, getClient } from './custom/hub';

@@ -15,0 +15,0 @@ export { OpenTelemetryScope } from './custom/scope';

@@ -14,2 +14,12 @@ import { Span } from '@opentelemetry/api';

/**
* Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span
* after the function is done automatically. You'll have to call `span.end()` manually.
*
* The created span is the active span and will be used as parent by other spans created inside the function
* and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
*
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
*/
export declare function startSpanManual<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T;
/**
* @deprecated Use {@link startSpan} instead.

@@ -16,0 +26,0 @@ */

@@ -1,2 +0,2 @@

import { Span as WriteableSpan, Tracer } from '@opentelemetry/api';
import { Attributes, Span as WriteableSpan, SpanKind, TimeInput, Tracer } from '@opentelemetry/api';
import { BasicTracerProvider, ReadableSpan, Span } from '@opentelemetry/sdk-trace-base';

@@ -14,2 +14,5 @@ import { SpanOrigin, TransactionMetadata, TransactionSource } from '@sentry/types';

source?: TransactionSource;
attributes?: Attributes;
kind?: SpanKind;
startTime?: TimeInput;
}

@@ -16,0 +19,0 @@ /**

@@ -12,3 +12,3 @@ import { addOriginToSpan } from './utils/addOriginToSpan';

export { getActiveSpan, getRootSpan } from './utils/getActiveSpan';
export { startSpan, startInactiveSpan } from './trace';
export { startSpan, startSpanManual, startInactiveSpan } from './trace';
export { getCurrentHub, setupGlobalHub, getClient } from './custom/hub';

@@ -15,0 +15,0 @@ export { OpenTelemetryScope } from './custom/scope';

@@ -14,2 +14,12 @@ import type { Span } from '@opentelemetry/api';

/**
* Similar to `Sentry.startSpan`. Wraps a function with a span, but does not finish the span
* after the function is done automatically. You'll have to call `span.end()` manually.
*
* The created span is the active span and will be used as parent by other spans created inside the function
* and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
*
* Note that you'll always get a span passed to the callback, it may just be a NonRecordingSpan if the span is not sampled.
*/
export declare function startSpanManual<T>(spanContext: OpenTelemetrySpanContext, callback: (span: Span) => T): T;
/**
* @deprecated Use {@link startSpan} instead.

@@ -16,0 +26,0 @@ */

@@ -1,2 +0,2 @@

import type { Span as WriteableSpan, Tracer } from '@opentelemetry/api';
import type { Attributes, Span as WriteableSpan, SpanKind, TimeInput, Tracer } from '@opentelemetry/api';
import type { BasicTracerProvider, ReadableSpan, Span } from '@opentelemetry/sdk-trace-base';

@@ -14,2 +14,5 @@ import type { SpanOrigin, TransactionMetadata, TransactionSource } from '@sentry/types';

source?: TransactionSource;
attributes?: Attributes;
kind?: SpanKind;
startTime?: TimeInput;
}

@@ -16,0 +19,0 @@ /**

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc