@sentry/opentelemetry 8.46.0 → 8.48.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.
@@ -1 +1 @@
1
- {"type":"module","version":"8.46.0","sideEffects":false}
1
+ {"type":"module","version":"8.48.0","sideEffects":false}
@@ -1 +1 @@
1
- {"version":3,"file":"asyncContextStrategy.d.ts","sourceRoot":"","sources":["../../src/asyncContextStrategy.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,2CAA2C,IAAI,IAAI,CA0FlE"}
1
+ {"version":3,"file":"asyncContextStrategy.d.ts","sourceRoot":"","sources":["../../src/asyncContextStrategy.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,2CAA2C,IAAI,IAAI,CA2FlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"spanExporter.d.ts","sourceRoot":"","sources":["../../src/spanExporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAKV,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAkCtB;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,aAAa,CAA4C;IAkBjE,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,uBAAuB,CAAS;IACxC,OAAO,CAAC,mBAAmB,CAA4C;IACvE,OAAO,CAAC,wBAAwB,CAAS;gBAEtB,OAAO,CAAC,EAAE;QAC3B,4IAA4I;QAC5I,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IAOD,4BAA4B;IACrB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAyCvC,kDAAkD;IAC3C,KAAK,IAAI,IAAI;IA6BpB,0BAA0B;IACnB,KAAK,IAAI,IAAI;IAKpB,+BAA+B;IAC/B,OAAO,CAAC,aAAa;CAMtB;AAiED,+BAA+B;AAC/B,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAqEjF"}
1
+ {"version":3,"file":"spanExporter.d.ts","sourceRoot":"","sources":["../../src/spanExporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAKV,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAmCtB;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,aAAa,CAA4C;IAkBjE,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,uBAAuB,CAAS;IACxC,OAAO,CAAC,mBAAmB,CAA4C;IACvE,OAAO,CAAC,wBAAwB,CAAS;gBAEtB,OAAO,CAAC,EAAE;QAC3B,4IAA4I;QAC5I,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IAOD,4BAA4B;IACrB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAyCvC,kDAAkD;IAC3C,KAAK,IAAI,IAAI;IA6BpB,0BAA0B;IACnB,KAAK,IAAI,IAAI;IAKpB,+BAA+B;IAC/B,OAAO,CAAC,aAAa;CAMtB;AAiED,+BAA+B;AAC/B,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAqEjF"}
@@ -1,6 +1,5 @@
1
1
  import type { Span } from '@opentelemetry/api';
2
- import type { Client, DynamicSamplingContext, Scope, TraceContext } from '@sentry/core';
3
- import { continueTrace as baseContinueTrace } from '@sentry/core';
2
+ import type { Client, DynamicSamplingContext, Scope, TraceContext, continueTrace as baseContinueTrace } from '@sentry/core';
4
3
  import type { OpenTelemetrySpanContext } from './types';
5
4
  /**
6
5
  * Wraps a function with a transaction/span and finishes the span after the function is done.
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAoC,MAAM,oBAAoB,CAAC;AAG1F,OAA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  */
14
- export declare function inferSpanData(name: string, attributes: SpanAttributes, kind: SpanKind): SpanDescription;
14
+ export declare function inferSpanData(spanName: string, attributes: SpanAttributes, kind: SpanKind): SpanDescription;
15
15
  /**
16
16
  * Extract better op/description from an otel span.
17
17
  *
18
+ * Does not overwrite the span name if the source is already set to custom to ensure
19
+ * that user-updated span names are preserved. In this case, we only adjust the op but
20
+ * leave span description and source unchanged.
21
+ *
18
22
  * Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306
19
23
  */
20
24
  export declare function parseSpanDescription(span: AbstractSpan): SpanDescription;
@@ -32,5 +36,21 @@ export declare function getSanitizedUrl(attributes: Attributes, kind: SpanKind):
32
36
  fragment: string | undefined;
33
37
  hasRoute: boolean;
34
38
  };
39
+ /**
40
+ * Because Otel instrumentation sometimes mutates span names via `span.updateName`, the only way
41
+ * to ensure that a user-set span name is preserved is to store it as a tmp attribute on the span.
42
+ * We delete this attribute once we're done with it when preparing the event envelope.
43
+ *
44
+ * This temp attribute always takes precedence over the original name.
45
+ *
46
+ * We also need to take care of setting the correct source. Users can always update the source
47
+ * after updating the name, so we need to respect that.
48
+ *
49
+ * @internal exported only for testing
50
+ */
51
+ export declare function getUserUpdatedNameAndSource(originalName: string, attributes: Attributes, fallbackSource?: TransactionSource): {
52
+ description: string;
53
+ source: TransactionSource;
54
+ };
35
55
  export {};
36
56
  //# sourceMappingURL=parseSpanDescription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseSpanDescription.d.ts","sourceRoot":"","sources":["../../../src/utils/parseSpanDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAc9C,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAA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M,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAYA"}
@@ -1,6 +1,5 @@
1
1
  import { Span } from '@opentelemetry/api';
2
- import { Client, DynamicSamplingContext, Scope, TraceContext } from '@sentry/core';
3
- import { continueTrace as baseContinueTrace } from '@sentry/core';
2
+ import { Client, DynamicSamplingContext, Scope, TraceContext, continueTrace as baseContinueTrace } from '@sentry/core';
4
3
  import { OpenTelemetrySpanContext } from './types';
5
4
  /**
6
5
  * Wraps a function with a transaction/span and finishes the span after the function is done.
@@ -11,10 +11,14 @@ interface SpanDescription {
11
11
  /**
12
12
  * Infer the op & description for a set of name, attributes and kind of a span.
13
13
  */
14
- export declare function inferSpanData(name: string, attributes: SpanAttributes, kind: SpanKind): SpanDescription;
14
+ export declare function inferSpanData(spanName: string, attributes: SpanAttributes, kind: SpanKind): SpanDescription;
15
15
  /**
16
16
  * Extract better op/description from an otel span.
17
17
  *
18
+ * Does not overwrite the span name if the source is already set to custom to ensure
19
+ * that user-updated span names are preserved. In this case, we only adjust the op but
20
+ * leave span description and source unchanged.
21
+ *
18
22
  * Based on https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7422ce2a06337f68a59b552b8c5a2ac125d6bae5/exporter/sentryexporter/sentry_exporter.go#L306
19
23
  */
20
24
  export declare function parseSpanDescription(span: AbstractSpan): SpanDescription;
@@ -32,5 +36,21 @@ export declare function getSanitizedUrl(attributes: Attributes, kind: SpanKind):
32
36
  fragment: string | undefined;
33
37
  hasRoute: boolean;
34
38
  };
39
+ /**
40
+ * Because Otel instrumentation sometimes mutates span names via `span.updateName`, the only way
41
+ * to ensure that a user-set span name is preserved is to store it as a tmp attribute on the span.
42
+ * We delete this attribute once we're done with it when preparing the event envelope.
43
+ *
44
+ * This temp attribute always takes precedence over the original name.
45
+ *
46
+ * We also need to take care of setting the correct source. Users can always update the source
47
+ * after updating the name, so we need to respect that.
48
+ *
49
+ * @internal exported only for testing
50
+ */
51
+ export declare function getUserUpdatedNameAndSource(originalName: string, attributes: Attributes, fallbackSource?: TransactionSource): {
52
+ description: string;
53
+ source: TransactionSource;
54
+ };
35
55
  export {};
36
56
  //# sourceMappingURL=parseSpanDescription.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/opentelemetry",
3
- "version": "8.46.0",
3
+ "version": "8.48.0",
4
4
  "description": "Official Sentry utilities for OpenTelemetry",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@sentry/core": "8.46.0"
42
+ "@sentry/core": "8.48.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@opentelemetry/api": "^1.9.0",