@sentry/opentelemetry 9.39.0 → 10.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +10 -13
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +11 -14
- package/build/esm/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/propagator.d.ts.map +1 -1
- package/package.json +5 -7
package/build/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ATTR_URL_FULL, SEMATTRS_HTTP_URL, ATTR_HTTP_REQUEST_METHOD, SEMATTRS_HTTP_METHOD, SEMATTRS_DB_SYSTEM, SEMATTRS_RPC_SERVICE, SEMATTRS_MESSAGING_SYSTEM, SEMATTRS_FAAS_TRIGGER, SEMATTRS_DB_STATEMENT, SEMATTRS_HTTP_TARGET, ATTR_HTTP_ROUTE, ATTR_HTTP_RESPONSE_STATUS_CODE, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_RPC_GRPC_STATUS_CODE } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
import { parseUrl, getSanitizedUrlString, SDK_VERSION, addNonEnumerableProperty, isSentryRequestUrl, getClient, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, spanToJSON, hasSpansEnabled, dynamicSamplingContextToSentryBaggageHeader, LRUMap,
|
|
2
|
+
import { parseUrl, getSanitizedUrlString, SDK_VERSION, addNonEnumerableProperty, isSentryRequestUrl, getClient, baggageHeaderToDynamicSamplingContext, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, stripUrlQueryAndFragment, spanToJSON, hasSpansEnabled, dynamicSamplingContextToSentryBaggageHeader, LRUMap, debug, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, stringMatchesSomePattern, getDynamicSamplingContextFromSpan, getCurrentScope, getDynamicSamplingContextFromScope, getIsolationScope, propagationContextFromHeaders, handleCallbackErrors, spanToTraceContext, getTraceContextFromScope, getRootSpan, getCapturedScopesOnSpan, setAsyncContextStrategy, getDefaultIsolationScope, getDefaultCurrentScope, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, debounce, timedEventsToMeasurements, captureEvent, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, convertSpanLinksForEnvelope, getStatusMessage, spanTimeInputToSeconds, addChildSpanToSpan, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, parseSampleRate, sampleSpan } from '@sentry/core';
|
|
3
3
|
export { getClient, getDynamicSamplingContextFromSpan } from '@sentry/core';
|
|
4
4
|
import * as api from '@opentelemetry/api';
|
|
5
5
|
import { trace, SpanKind, createContextKey, TraceFlags, propagation, INVALID_TRACEID, context, SpanStatusCode, ROOT_CONTEXT, isSpanContextValid } from '@opentelemetry/api';
|
|
@@ -689,7 +689,7 @@ class SentryPropagator extends W3CBaggagePropagator {
|
|
|
689
689
|
*/
|
|
690
690
|
inject(context, carrier, setter) {
|
|
691
691
|
if (isTracingSuppressed(context)) {
|
|
692
|
-
DEBUG_BUILD &&
|
|
692
|
+
DEBUG_BUILD && debug.log('[Tracing] Not injecting trace data for url because tracing is suppressed.');
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
695
|
|
|
@@ -699,10 +699,7 @@ class SentryPropagator extends W3CBaggagePropagator {
|
|
|
699
699
|
const tracePropagationTargets = getClient()?.getOptions()?.tracePropagationTargets;
|
|
700
700
|
if (!shouldPropagateTraceForUrl(url, tracePropagationTargets, this._urlMatchesTargetsMap)) {
|
|
701
701
|
DEBUG_BUILD &&
|
|
702
|
-
|
|
703
|
-
'[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:',
|
|
704
|
-
url,
|
|
705
|
-
);
|
|
702
|
+
debug.log('[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:', url);
|
|
706
703
|
return;
|
|
707
704
|
}
|
|
708
705
|
|
|
@@ -783,14 +780,14 @@ function shouldPropagateTraceForUrl(
|
|
|
783
780
|
|
|
784
781
|
const cachedDecision = decisionMap?.get(url);
|
|
785
782
|
if (cachedDecision !== undefined) {
|
|
786
|
-
DEBUG_BUILD && !cachedDecision &&
|
|
783
|
+
DEBUG_BUILD && !cachedDecision && debug.log(NOT_PROPAGATED_MESSAGE, url);
|
|
787
784
|
return cachedDecision;
|
|
788
785
|
}
|
|
789
786
|
|
|
790
787
|
const decision = stringMatchesSomePattern(url, tracePropagationTargets);
|
|
791
788
|
decisionMap?.set(url, decision);
|
|
792
789
|
|
|
793
|
-
DEBUG_BUILD && !decision &&
|
|
790
|
+
DEBUG_BUILD && !decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
|
|
794
791
|
return decision;
|
|
795
792
|
}
|
|
796
793
|
|
|
@@ -1659,7 +1656,7 @@ class SentrySpanExporter {
|
|
|
1659
1656
|
});
|
|
1660
1657
|
if (droppedSpanCount > 0) {
|
|
1661
1658
|
DEBUG_BUILD &&
|
|
1662
|
-
|
|
1659
|
+
debug.log(
|
|
1663
1660
|
`SpanExporter dropped ${droppedSpanCount} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`,
|
|
1664
1661
|
);
|
|
1665
1662
|
}
|
|
@@ -1696,7 +1693,7 @@ class SentrySpanExporter {
|
|
|
1696
1693
|
const sentSpanCount = sentSpans.size;
|
|
1697
1694
|
const remainingOpenSpanCount = finishedSpans.length - sentSpanCount;
|
|
1698
1695
|
DEBUG_BUILD &&
|
|
1699
|
-
|
|
1696
|
+
debug.log(
|
|
1700
1697
|
`SpanExporter exported ${sentSpanCount} spans, ${remainingOpenSpanCount} spans are waiting for their parent spans to finish`,
|
|
1701
1698
|
);
|
|
1702
1699
|
|
|
@@ -2191,7 +2188,7 @@ class SentrySampler {
|
|
|
2191
2188
|
|
|
2192
2189
|
const method = `${maybeSpanHttpMethod}`.toUpperCase();
|
|
2193
2190
|
if (method === 'OPTIONS' || method === 'HEAD') {
|
|
2194
|
-
DEBUG_BUILD &&
|
|
2191
|
+
DEBUG_BUILD && debug.log(`[Tracing] Not sampling span because HTTP method is '${method}' for ${spanName}`);
|
|
2195
2192
|
|
|
2196
2193
|
return wrapSamplingDecision({
|
|
2197
2194
|
decision: SamplingDecision.NOT_RECORD,
|
|
@@ -2207,7 +2204,7 @@ class SentrySampler {
|
|
|
2207
2204
|
// We check for `parentSampled === undefined` because we only want to record client reports for spans that are trace roots (ie. when there was incoming trace)
|
|
2208
2205
|
parentSampled === undefined
|
|
2209
2206
|
) {
|
|
2210
|
-
DEBUG_BUILD &&
|
|
2207
|
+
DEBUG_BUILD && debug.log('[Tracing] Discarding root span because its trace was not chosen to be sampled.');
|
|
2211
2208
|
this._client.recordDroppedEvent('sample_rate', 'transaction');
|
|
2212
2209
|
}
|
|
2213
2210
|
|
|
@@ -2241,12 +2238,12 @@ function getParentSampled(parentSpan, traceId, spanName) {
|
|
|
2241
2238
|
if (parentContext.isRemote) {
|
|
2242
2239
|
const parentSampled = getSamplingDecision(parentSpan.spanContext());
|
|
2243
2240
|
DEBUG_BUILD &&
|
|
2244
|
-
|
|
2241
|
+
debug.log(`[Tracing] Inheriting remote parent's sampled decision for ${spanName}: ${parentSampled}`);
|
|
2245
2242
|
return parentSampled;
|
|
2246
2243
|
}
|
|
2247
2244
|
|
|
2248
2245
|
const parentSampled = getSamplingDecision(parentContext);
|
|
2249
|
-
DEBUG_BUILD &&
|
|
2246
|
+
DEBUG_BUILD && debug.log(`[Tracing] Inheriting parent's sampled decision for ${spanName}: ${parentSampled}`);
|
|
2250
2247
|
return parentSampled;
|
|
2251
2248
|
}
|
|
2252
2249
|
|