@sentry/opentelemetry 10.57.0 → 10.59.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/README.md +0 -1
- package/build/cjs/index.browser.js +2 -2
- package/build/cjs/index.js +2 -2
- package/build/cjs/{resource-CTgtEOmw.js → resource-D2T3VSoy.js} +53 -49
- package/build/cjs/resource-D2T3VSoy.js.map +1 -0
- package/build/cjs/tracingChannel.js +2 -4
- package/build/cjs/tracingChannel.js.map +1 -1
- package/build/esm/index.browser.js +2 -2
- package/build/esm/index.js +3 -3
- package/build/esm/package.json +1 -1
- package/build/esm/{resource-CEl6olOs.js → resource-P9iYHxcD.js} +31 -27
- package/build/esm/resource-P9iYHxcD.js.map +1 -0
- package/build/esm/tracingChannel.js +2 -4
- package/build/esm/tracingChannel.js.map +1 -1
- package/build/types/exports.d.ts.map +1 -1
- package/build/types/resource.d.ts.map +1 -1
- package/build/types/sampler.d.ts.map +1 -1
- package/build/types/tracingChannel.d.ts.map +1 -1
- package/build/types/utils/getRequestSpanData.d.ts.map +1 -1
- package/build/types/utils/mapStatus.d.ts.map +1 -1
- package/package.json +5 -6
- package/build/cjs/resource-CTgtEOmw.js.map +0 -1
- package/build/esm/resource-CEl6olOs.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,7 +28,6 @@ Note that `@sentry/opentelemetry` depends on the following peer dependencies:
|
|
|
28
28
|
|
|
29
29
|
- `@opentelemetry/api` version `1.0.0` or greater
|
|
30
30
|
- `@opentelemetry/core` version `1.0.0` or greater
|
|
31
|
-
- `@opentelemetry/semantic-conventions` version `1.0.0` or greater
|
|
32
31
|
- `@opentelemetry/sdk-trace-base` version `1.0.0` or greater, or a package that implements that, like
|
|
33
32
|
`@opentelemetry/sdk-node`.
|
|
34
33
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
|
-
const resource = require('./resource-
|
|
4
|
+
const resource = require('./resource-D2T3VSoy.js');
|
|
5
5
|
require('@opentelemetry/api');
|
|
6
|
-
require('@
|
|
6
|
+
require('@sentry/conventions/attributes');
|
|
7
7
|
require('@opentelemetry/core');
|
|
8
8
|
require('./debug-build-CQngOfDt.js');
|
|
9
9
|
require('@opentelemetry/sdk-trace-base');
|
package/build/cjs/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const resource = require('./resource-
|
|
3
|
+
const resource = require('./resource-D2T3VSoy.js');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
5
|
const api = require('@opentelemetry/api');
|
|
6
6
|
const node_async_hooks = require('node:async_hooks');
|
|
7
7
|
const node_events = require('node:events');
|
|
8
|
-
require('@
|
|
8
|
+
require('@sentry/conventions/attributes');
|
|
9
9
|
require('@opentelemetry/core');
|
|
10
10
|
require('./debug-build-CQngOfDt.js');
|
|
11
11
|
require('@opentelemetry/sdk-trace-base');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const api = require('@opentelemetry/api');
|
|
2
2
|
const core = require('@sentry/core');
|
|
3
|
-
const
|
|
3
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
4
4
|
const core$1 = require('@opentelemetry/core');
|
|
5
5
|
const debugBuild = require('./debug-build-CQngOfDt.js');
|
|
6
6
|
const sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
@@ -46,11 +46,11 @@ function getRequestSpanData(span) {
|
|
|
46
46
|
if (!spanHasAttributes(span)) {
|
|
47
47
|
return {};
|
|
48
48
|
}
|
|
49
|
-
const maybeUrlAttribute = span.attributes[
|
|
49
|
+
const maybeUrlAttribute = span.attributes[attributes.URL_FULL] || span.attributes[attributes.HTTP_URL];
|
|
50
50
|
const data = {
|
|
51
51
|
url: maybeUrlAttribute,
|
|
52
|
-
// eslint-disable-next-line
|
|
53
|
-
"http.method": span.attributes[
|
|
52
|
+
// eslint-disable-next-line typescript/no-deprecated
|
|
53
|
+
"http.method": span.attributes[attributes.HTTP_REQUEST_METHOD] || span.attributes[attributes.HTTP_METHOD]
|
|
54
54
|
};
|
|
55
55
|
if (!data["http.method"] && data.url) {
|
|
56
56
|
data["http.method"] = "GET";
|
|
@@ -138,8 +138,8 @@ function isSentryRequestSpan(span) {
|
|
|
138
138
|
if (!spanHasAttributes(span)) {
|
|
139
139
|
return false;
|
|
140
140
|
}
|
|
141
|
-
const { attributes } = span;
|
|
142
|
-
const httpUrl = attributes[
|
|
141
|
+
const { attributes: attributes$1 } = span;
|
|
142
|
+
const httpUrl = attributes$1[attributes.HTTP_URL] || attributes$1[attributes.URL_FULL];
|
|
143
143
|
if (!httpUrl) {
|
|
144
144
|
return false;
|
|
145
145
|
}
|
|
@@ -166,35 +166,35 @@ function getSamplingDecision(spanContext) {
|
|
|
166
166
|
return void 0;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
function inferSpanData(spanName, attributes, kind) {
|
|
170
|
-
const httpMethod = attributes[
|
|
169
|
+
function inferSpanData(spanName, attributes$1, kind) {
|
|
170
|
+
const httpMethod = attributes$1[attributes.HTTP_REQUEST_METHOD] || attributes$1[attributes.HTTP_METHOD];
|
|
171
171
|
if (httpMethod) {
|
|
172
|
-
return descriptionForHttpMethod({ attributes, name: spanName, kind }, httpMethod);
|
|
172
|
+
return descriptionForHttpMethod({ attributes: attributes$1, name: spanName, kind }, httpMethod);
|
|
173
173
|
}
|
|
174
|
-
const dbSystem = attributes[
|
|
175
|
-
const opIsCache = typeof attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] === "string" && attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_OP].startsWith("cache.");
|
|
174
|
+
const dbSystem = attributes$1[attributes.DB_SYSTEM_NAME] || attributes$1[attributes.DB_SYSTEM];
|
|
175
|
+
const opIsCache = typeof attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] === "string" && attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_OP].startsWith("cache.");
|
|
176
176
|
if (dbSystem && !opIsCache) {
|
|
177
|
-
return descriptionForDbSystem({ attributes, name: spanName });
|
|
177
|
+
return descriptionForDbSystem({ attributes: attributes$1, name: spanName });
|
|
178
178
|
}
|
|
179
|
-
const customSourceOrRoute = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom" ? "custom" : "route";
|
|
180
|
-
const rpcService = attributes[
|
|
179
|
+
const customSourceOrRoute = attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom" ? "custom" : "route";
|
|
180
|
+
const rpcService = attributes$1[attributes.RPC_SERVICE];
|
|
181
181
|
if (rpcService) {
|
|
182
182
|
return {
|
|
183
|
-
...getUserUpdatedNameAndSource(spanName, attributes, "route"),
|
|
183
|
+
...getUserUpdatedNameAndSource(spanName, attributes$1, "route"),
|
|
184
184
|
op: "rpc"
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
const messagingSystem = attributes[
|
|
187
|
+
const messagingSystem = attributes$1[attributes.MESSAGING_SYSTEM];
|
|
188
188
|
if (messagingSystem) {
|
|
189
189
|
return {
|
|
190
|
-
...getUserUpdatedNameAndSource(spanName, attributes, customSourceOrRoute),
|
|
190
|
+
...getUserUpdatedNameAndSource(spanName, attributes$1, customSourceOrRoute),
|
|
191
191
|
op: "message"
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
const faasTrigger = attributes[
|
|
194
|
+
const faasTrigger = attributes$1[attributes.FAAS_TRIGGER];
|
|
195
195
|
if (faasTrigger) {
|
|
196
196
|
return {
|
|
197
|
-
...getUserUpdatedNameAndSource(spanName, attributes, customSourceOrRoute),
|
|
197
|
+
...getUserUpdatedNameAndSource(spanName, attributes$1, customSourceOrRoute),
|
|
198
198
|
op: faasTrigger.toString()
|
|
199
199
|
};
|
|
200
200
|
}
|
|
@@ -206,19 +206,19 @@ function parseSpanDescription(span) {
|
|
|
206
206
|
const kind = getSpanKind(span);
|
|
207
207
|
return inferSpanData(name, attributes, kind);
|
|
208
208
|
}
|
|
209
|
-
function descriptionForDbSystem({ attributes, name }) {
|
|
210
|
-
const userDefinedName = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME];
|
|
209
|
+
function descriptionForDbSystem({ attributes: attributes$1, name }) {
|
|
210
|
+
const userDefinedName = attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME];
|
|
211
211
|
if (typeof userDefinedName === "string") {
|
|
212
212
|
return {
|
|
213
213
|
op: "db",
|
|
214
214
|
description: userDefinedName,
|
|
215
|
-
source: attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] || "custom"
|
|
215
|
+
source: attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] || "custom"
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
if (attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom") {
|
|
218
|
+
if (attributes$1[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom") {
|
|
219
219
|
return { op: "db", description: name, source: "custom" };
|
|
220
220
|
}
|
|
221
|
-
const statement = attributes[
|
|
221
|
+
const statement = attributes$1[attributes.DB_STATEMENT];
|
|
222
222
|
const description = statement ? statement.toString() : name;
|
|
223
223
|
return { op: "db", description, source: "task" };
|
|
224
224
|
}
|
|
@@ -278,10 +278,10 @@ function getGraphqlOperationNamesFromAttribute(attr) {
|
|
|
278
278
|
}
|
|
279
279
|
return `${attr}`;
|
|
280
280
|
}
|
|
281
|
-
function getSanitizedUrl(attributes, kind) {
|
|
282
|
-
const httpTarget = attributes[
|
|
283
|
-
const httpUrl = attributes[
|
|
284
|
-
const httpRoute = attributes[
|
|
281
|
+
function getSanitizedUrl(attributes$1, kind) {
|
|
282
|
+
const httpTarget = attributes$1[attributes.HTTP_TARGET];
|
|
283
|
+
const httpUrl = attributes$1[attributes.HTTP_URL] || attributes$1[attributes.URL_FULL];
|
|
284
|
+
const httpRoute = attributes$1[attributes.HTTP_ROUTE];
|
|
285
285
|
const parsedUrl = typeof httpUrl === "string" ? core.parseUrl(httpUrl) : void 0;
|
|
286
286
|
const url = parsedUrl ? core.getSanitizedUrlString(parsedUrl) : void 0;
|
|
287
287
|
const query = parsedUrl?.search || void 0;
|
|
@@ -537,7 +537,7 @@ function getExistingSentryTrace(carrier) {
|
|
|
537
537
|
}
|
|
538
538
|
function getCurrentURL(span) {
|
|
539
539
|
const spanData = core.spanToJSON(span).data;
|
|
540
|
-
const urlAttribute = spanData[
|
|
540
|
+
const urlAttribute = spanData[attributes.HTTP_URL] || spanData[attributes.URL_FULL];
|
|
541
541
|
if (typeof urlAttribute === "string") {
|
|
542
542
|
return urlAttribute;
|
|
543
543
|
}
|
|
@@ -998,9 +998,9 @@ function mapStatus(span) {
|
|
|
998
998
|
return { code: core.SPAN_STATUS_ERROR, message: "unknown_error" };
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
|
-
function inferStatusFromAttributes(attributes) {
|
|
1002
|
-
const httpCodeAttribute = attributes[
|
|
1003
|
-
const grpcCodeAttribute = attributes[
|
|
1001
|
+
function inferStatusFromAttributes(attributes$1) {
|
|
1002
|
+
const httpCodeAttribute = attributes$1[attributes.HTTP_RESPONSE_STATUS_CODE] || attributes$1[attributes.HTTP_STATUS_CODE];
|
|
1003
|
+
const grpcCodeAttribute = attributes$1[attributes.RPC_GRPC_STATUS_CODE];
|
|
1004
1004
|
const numberHttpCode = typeof httpCodeAttribute === "number" ? httpCodeAttribute : typeof httpCodeAttribute === "string" ? parseInt(httpCodeAttribute) : void 0;
|
|
1005
1005
|
if (typeof numberHttpCode === "number") {
|
|
1006
1006
|
return core.getSpanStatusFromHttpCode(numberHttpCode);
|
|
@@ -1153,7 +1153,7 @@ function createTransactionForOtelSpan(span) {
|
|
|
1153
1153
|
const { op, description, data, origin = "manual", source } = getSpanData(span);
|
|
1154
1154
|
const capturedSpanScopes = core.getCapturedScopesOnSpan(span);
|
|
1155
1155
|
const sampleRate = span.attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];
|
|
1156
|
-
const attributes = {
|
|
1156
|
+
const attributes$1 = {
|
|
1157
1157
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
1158
1158
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: sampleRate,
|
|
1159
1159
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
|
|
@@ -1169,14 +1169,14 @@ function createTransactionForOtelSpan(span) {
|
|
|
1169
1169
|
parent_span_id,
|
|
1170
1170
|
span_id,
|
|
1171
1171
|
trace_id,
|
|
1172
|
-
data: attributes,
|
|
1172
|
+
data: attributes$1,
|
|
1173
1173
|
origin,
|
|
1174
1174
|
op,
|
|
1175
1175
|
status: core.getStatusMessage(status),
|
|
1176
1176
|
// As per protocol, span status is allowed to be undefined
|
|
1177
1177
|
links: core.convertSpanLinksForEnvelope(links)
|
|
1178
1178
|
};
|
|
1179
|
-
const statusCode = attributes[
|
|
1179
|
+
const statusCode = attributes$1[attributes.HTTP_RESPONSE_STATUS_CODE];
|
|
1180
1180
|
const responseContext = typeof statusCode === "number" ? { response: { status_code: statusCode } } : void 0;
|
|
1181
1181
|
const transactionEvent = {
|
|
1182
1182
|
contexts: {
|
|
@@ -1279,14 +1279,14 @@ function removeSentryAttributes(data) {
|
|
|
1279
1279
|
return cleanedData;
|
|
1280
1280
|
}
|
|
1281
1281
|
function getData(span) {
|
|
1282
|
-
const attributes = span.attributes;
|
|
1282
|
+
const attributes$1 = span.attributes;
|
|
1283
1283
|
const data = {};
|
|
1284
1284
|
if (span.kind !== api.SpanKind.INTERNAL) {
|
|
1285
1285
|
data["otel.kind"] = api.SpanKind[span.kind];
|
|
1286
1286
|
}
|
|
1287
|
-
const maybeHttpStatusCodeAttribute = attributes[
|
|
1287
|
+
const maybeHttpStatusCodeAttribute = attributes$1[attributes.HTTP_STATUS_CODE];
|
|
1288
1288
|
if (maybeHttpStatusCodeAttribute) {
|
|
1289
|
-
data[
|
|
1289
|
+
data[attributes.HTTP_RESPONSE_STATUS_CODE] = maybeHttpStatusCodeAttribute;
|
|
1290
1290
|
}
|
|
1291
1291
|
const requestData = getRequestSpanData(span);
|
|
1292
1292
|
if (requestData.url) {
|
|
@@ -1371,7 +1371,7 @@ class SentrySampler {
|
|
|
1371
1371
|
if (!core.hasSpansEnabled(options)) {
|
|
1372
1372
|
return wrapSamplingDecision({ decision: void 0, context, spanAttributes });
|
|
1373
1373
|
}
|
|
1374
|
-
const maybeSpanHttpMethod = spanAttributes[
|
|
1374
|
+
const maybeSpanHttpMethod = spanAttributes[attributes.HTTP_METHOD] || spanAttributes[attributes.HTTP_REQUEST_METHOD];
|
|
1375
1375
|
if (spanKind === api.SpanKind.CLIENT && maybeSpanHttpMethod && (!parentSpan || parentContext?.isRemote)) {
|
|
1376
1376
|
if (!this._isSpanStreaming) {
|
|
1377
1377
|
this._client.recordDroppedEvent("no_parent_span", "span");
|
|
@@ -1555,7 +1555,7 @@ function getBaseTraceState(context, spanAttributes) {
|
|
|
1555
1555
|
const parentSpan = api.trace.getSpan(context);
|
|
1556
1556
|
const parentContext = parentSpan?.spanContext();
|
|
1557
1557
|
let traceState = parentContext?.traceState || new TraceState();
|
|
1558
|
-
const url = spanAttributes[
|
|
1558
|
+
const url = spanAttributes[attributes.HTTP_URL] || spanAttributes[attributes.URL_FULL];
|
|
1559
1559
|
if (url && typeof url === "string") {
|
|
1560
1560
|
traceState = traceState.set(SENTRY_TRACE_STATE_URL, url);
|
|
1561
1561
|
}
|
|
@@ -1566,6 +1566,10 @@ function getValidSpan(context) {
|
|
|
1566
1566
|
return span && api.isSpanContextValid(span.spanContext()) ? span : void 0;
|
|
1567
1567
|
}
|
|
1568
1568
|
|
|
1569
|
+
const ATTR_TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language";
|
|
1570
|
+
const ATTR_TELEMETRY_SDK_NAME = "telemetry.sdk.name";
|
|
1571
|
+
const ATTR_TELEMETRY_SDK_VERSION = "telemetry.sdk.version";
|
|
1572
|
+
const SEMRESATTRS_SERVICE_NAMESPACE = "service.namespace";
|
|
1569
1573
|
class SentryResource {
|
|
1570
1574
|
constructor(attributes) {
|
|
1571
1575
|
this._attributes = attributes;
|
|
@@ -1611,18 +1615,18 @@ function getSentryResource(serviceNameFallback) {
|
|
|
1611
1615
|
const otelResourceAttrs = parseOtelResourceAttributes(env.OTEL_RESOURCE_ATTRIBUTES);
|
|
1612
1616
|
return new SentryResource({
|
|
1613
1617
|
// Lowest priority: Sentry defaults
|
|
1614
|
-
// eslint-disable-next-line
|
|
1615
|
-
[
|
|
1616
|
-
[
|
|
1618
|
+
// eslint-disable-next-line typescript/no-deprecated
|
|
1619
|
+
[SEMRESATTRS_SERVICE_NAMESPACE]: "sentry",
|
|
1620
|
+
[attributes.SERVICE_NAME]: serviceNameFallback,
|
|
1617
1621
|
// OTEL_RESOURCE_ATTRIBUTES overrides defaults (including service.name and service.namespace)
|
|
1618
1622
|
...otelResourceAttrs,
|
|
1619
1623
|
// OTEL_SERVICE_NAME explicitly overrides service.name
|
|
1620
|
-
...otelServiceName ? { [
|
|
1624
|
+
...otelServiceName ? { [attributes.SERVICE_NAME]: otelServiceName } : {},
|
|
1621
1625
|
// Highest priority: Sentry SDK telemetry attrs (cannot be overridden by env vars)
|
|
1622
|
-
[
|
|
1623
|
-
[
|
|
1624
|
-
[
|
|
1625
|
-
[
|
|
1626
|
+
[attributes.SERVICE_VERSION]: core.SDK_VERSION,
|
|
1627
|
+
[ATTR_TELEMETRY_SDK_LANGUAGE]: core$1.SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],
|
|
1628
|
+
[ATTR_TELEMETRY_SDK_NAME]: core$1.SDK_INFO[ATTR_TELEMETRY_SDK_NAME],
|
|
1629
|
+
[ATTR_TELEMETRY_SDK_VERSION]: core$1.SDK_INFO[ATTR_TELEMETRY_SDK_VERSION]
|
|
1626
1630
|
});
|
|
1627
1631
|
}
|
|
1628
1632
|
|
|
@@ -1659,4 +1663,4 @@ exports.withActiveSpan = withActiveSpan;
|
|
|
1659
1663
|
exports.wrapClientClass = wrapClientClass;
|
|
1660
1664
|
exports.wrapContextManagerClass = wrapContextManagerClass;
|
|
1661
1665
|
exports.wrapSamplingDecision = wrapSamplingDecision;
|
|
1662
|
-
//# sourceMappingURL=resource-
|
|
1666
|
+
//# sourceMappingURL=resource-D2T3VSoy.js.map
|