Skip to content

feat(node-experimental): Add missing re-exports #10679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/node-experimental/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Integrations = {
...NodeExperimentalIntegrations,
};

export { init } from './sdk/init';
export { init, getDefaultIntegrations } from './sdk/init';
export { getAutoPerformanceIntegrations } from './integrations/getAutoPerformanceIntegrations';
export * as Handlers from './sdk/handlers';
export type { Span } from './types';
Expand All @@ -40,7 +40,8 @@ export {
setIsolationScope,
setCurrentScope,
} from './sdk/api';
export { getCurrentHub, makeMain } from './sdk/hub';
// eslint-disable-next-line deprecation/deprecation
export { getCurrentHub } from './sdk/hub';

export {
addBreadcrumb,
Expand Down Expand Up @@ -88,6 +89,14 @@ export {
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
setCurrentClient,
Scope,
setMeasurement,
continueTrace,
cron,
parameterize,
// eslint-disable-next-line deprecation/deprecation
makeMain,
} from '@sentry/node';

export type {
Expand All @@ -108,4 +117,5 @@ export type {
Stacktrace,
Thread,
User,
NodeOptions,
} from '@sentry/node';
1 change: 1 addition & 0 deletions packages/node-experimental/src/otel/contextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class SentryContextManager extends AsyncLocalStorageContextManager {
const scopes: CurrentScopes = { scope: newCurrentScope, isolationScope };

// We also need to "mock" the hub on the context, as the original @sentry/opentelemetry uses that...
// eslint-disable-next-line deprecation/deprecation
const mockHub = { ...getCurrentHub(), getScope: () => scopes.scope };

const ctx1 = setHubOnContext(context, mockHub);
Expand Down
14 changes: 3 additions & 11 deletions packages/node-experimental/src/sdk/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ import type { SentryCarrier } from './types';
/** Ensure the global hub is our proxied hub. */
export function setupGlobalHub(): void {
const carrier = getGlobalCarrier();
// eslint-disable-next-line deprecation/deprecation
carrier.hub = getCurrentHub();
}

/**
* This is for legacy reasons, and returns a proxy object instead of a hub to be used.
* @deprecated Use the methods directly.
*/
export function getCurrentHub(): Hub {
return {
Expand Down Expand Up @@ -124,17 +126,6 @@ export function getCurrentHub(): Hub {
};
}

/**
* Replaces the current main hub with the passed one on the global object
*
* @returns The old replaced hub
*/
export function makeMain(hub: Hub): Hub {
// eslint-disable-next-line no-console
console.warn('makeMain is a noop in @sentry/node-experimental. Use `setCurrentClient` instead.');
return hub;
}

/**
* Sends the current Session on the scope
*/
Expand All @@ -152,6 +143,7 @@ function _sendSessionUpdate(): void {
* Set a mocked hub on the current carrier.
*/
export function setLegacyHubOnCarrier(carrier: SentryCarrier): boolean {
// eslint-disable-next-line deprecation/deprecation
carrier.hub = getCurrentHub();
return true;
}