-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(node-otel): Avoid exporting internals & refactor attribute adding (…
…#8920) I noticed that we kind of extended the public API by exporting some things from opentelemetry-node that we need in node-experimental. I am deprecating these internals as I'm refactoring some things to be a bit cleaner IMHO. The one export we actually need outside I am exporting as `_INTERNAL_getSentrySpan` to make it clear this is not meant to be used otherwise. The main reason I am not just exporting this is that this _may_ have to change if we change how we internally store/handle spans - e.g. if we move away from the map this is just not possible to have anymore, and I do not want to lock us into having to support this in the future.
- Loading branch information
Showing
12 changed files
with
133 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Span as OtelSpan } from '@opentelemetry/api'; | ||
import { _INTERNAL_getSentrySpan } from '@sentry/opentelemetry-node'; | ||
import type { SpanOrigin } from '@sentry/types'; | ||
|
||
/** Adds an origin to an OTEL Span. */ | ||
export function addOriginToOtelSpan(otelSpan: OtelSpan, origin: SpanOrigin): void { | ||
const sentrySpan = _INTERNAL_getSentrySpan(otelSpan.spanContext().spanId); | ||
if (!sentrySpan) { | ||
return; | ||
} | ||
|
||
sentrySpan.origin = origin; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import { getSentrySpan } from './spanprocessor'; | ||
|
||
export { SentrySpanProcessor } from './spanprocessor'; | ||
export { SentryPropagator } from './propagator'; | ||
export * from './utils/spanData'; | ||
|
||
/* eslint-disable deprecation/deprecation */ | ||
export { addOtelSpanData, getOtelSpanData, clearOtelSpanData } from './utils/spanData'; | ||
export type { AdditionalOtelSpanData } from './utils/spanData'; | ||
/* eslint-enable deprecation/deprecation */ | ||
|
||
/** | ||
* This is only exported for internal use. | ||
* Semver etc. does not apply here, this is subject to change at any time! | ||
* This is explicitly _NOT_ public because we may have to change the underlying way we store/handle spans, | ||
* which may make this API unusable without further notice. | ||
* | ||
* @private | ||
*/ | ||
export { getSentrySpan as _INTERNAL_getSentrySpan }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.