Skip to content

feat(v8/deno): Remove deprecations from deno SDK #10972

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 3 commits into from
Mar 8, 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
17 changes: 0 additions & 17 deletions packages/deno/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export type { AddRequestDataToEventOptions } from '@sentry/utils';
export type { DenoOptions } from './types';

export {
// eslint-disable-next-line deprecation/deprecation
addGlobalEventProcessor,
addEventProcessor,
addBreadcrumb,
captureException,
Expand All @@ -32,22 +30,14 @@ export {
createTransport,
continueTrace,
flush,
// eslint-disable-next-line deprecation/deprecation
getActiveTransaction,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getClient,
isInitialized,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Hub,
// eslint-disable-next-line deprecation/deprecation
makeMain,
setCurrentClient,
Scope,
// eslint-disable-next-line deprecation/deprecation
startTransaction,
SDK_VERSION,
setContext,
setExtra,
Expand Down Expand Up @@ -99,10 +89,3 @@ export { normalizePathsIntegration } from './integrations/normalizepaths';
export { contextLinesIntegration } from './integrations/contextlines';
export { denoCronIntegration } from './integrations/deno-cron';
export { breadcrumbsIntegration } from './integrations/breadcrumbs';

import * as DenoIntegrations from './integrations';

/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */
export const Integrations = {
...DenoIntegrations,
};
17 changes: 15 additions & 2 deletions packages/deno/src/integrations/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ interface BreadcrumbsOptions {

const INTEGRATION_NAME = 'Breadcrumbs';

/**
* Note: This `breadcrumbsIntegration` is almost the same as the one from @sentry/browser.
* The Deno-version does not support browser-specific APIs like dom, xhr and history.
*/
const _breadcrumbsIntegration = ((options: Partial<BreadcrumbsOptions> = {}) => {
const _options = {
console: true,
Expand All @@ -42,8 +46,17 @@ const _breadcrumbsIntegration = ((options: Partial<BreadcrumbsOptions> = {}) =>
}) satisfies IntegrationFn;

/**
* This breadcrumbsIntegration is almost the same as the one from @sentry/browser.
* The Deno-version does not support browser-specific APIs like dom, xhr and history.
* Adds a breadcrumbs for console, fetch, and sentry events.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.breadcrumbsIntegration(),
* ],
* })
* ```
*/
export const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration);

Expand Down
27 changes: 14 additions & 13 deletions packages/deno/src/integrations/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
import type { Event, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
import { defineIntegration } from '@sentry/core';
import type { Event, IntegrationFn } from '@sentry/types';

const INTEGRATION_NAME = 'DenoContext';

Expand Down Expand Up @@ -61,16 +61,17 @@ const _denoContextIntegration = (() => {
};
}) satisfies IntegrationFn;

export const denoContextIntegration = defineIntegration(_denoContextIntegration);

/**
* Adds Deno context to events.
* @deprecated Use `denoContextintegration()` instead.
* Adds Deno related context to events. This includes contexts about app, device, os, v8, and TypeScript.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.denoContextIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const DenoContext = convertIntegrationFnToClass(INTEGRATION_NAME, denoContextIntegration) as IntegrationClass<
Integration & { processEvent: (event: Event) => Promise<Event> }
>;

// eslint-disable-next-line deprecation/deprecation
export type DenoContext = typeof DenoContext;
export const denoContextIntegration = defineIntegration(_denoContextIntegration);
27 changes: 14 additions & 13 deletions packages/deno/src/integrations/contextlines.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
import type { Event, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
import { defineIntegration } from '@sentry/core';
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
import { LRUMap, addContextToFrame } from '@sentry/utils';

const INTEGRATION_NAME = 'ContextLines';
Expand Down Expand Up @@ -58,19 +58,20 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
};
}) satisfies IntegrationFn;

export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);

/**
* Add node modules / packages to the event.
* @deprecated Use `contextLinesIntegration()` instead.
* Adds source context to event stacktraces.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.contextLinesIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const ContextLines = convertIntegrationFnToClass(INTEGRATION_NAME, contextLinesIntegration) as IntegrationClass<
Integration & { processEvent: (event: Event) => Promise<Event> }
>;

// eslint-disable-next-line deprecation/deprecation
export type ContextLines = typeof ContextLines;
export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);

/** Processes an event and adds context lines */
async function addSourceContext(event: Event, contextLines: number): Promise<Event> {
Expand Down
25 changes: 13 additions & 12 deletions packages/deno/src/integrations/deno-cron.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { convertIntegrationFnToClass, defineIntegration, getClient, withMonitor } from '@sentry/core';
import type { Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
import { defineIntegration, getClient, withMonitor } from '@sentry/core';
import type { Client, IntegrationFn } from '@sentry/types';
import { parseScheduleToString } from './deno-cron-format';

type CronOptions = { backoffSchedule?: number[]; signal?: AbortSignal };
Expand Down Expand Up @@ -60,16 +60,17 @@ const _denoCronIntegration = (() => {
};
}) satisfies IntegrationFn;

export const denoCronIntegration = defineIntegration(_denoCronIntegration);

/**
* Instruments Deno.cron to automatically capture cron check-ins.
* @deprecated Use `denoCronIntegration()` instead.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.denoCronIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const DenoCron = convertIntegrationFnToClass(INTEGRATION_NAME, denoCronIntegration) as IntegrationClass<
Integration & { setup: (client: Client) => void }
>;

// eslint-disable-next-line deprecation/deprecation
export type DenoCron = typeof DenoCron;
export const denoCronIntegration = defineIntegration(_denoCronIntegration);
35 changes: 13 additions & 22 deletions packages/deno/src/integrations/globalhandlers.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import type { ServerRuntimeClient } from '@sentry/core';
import { defineIntegration } from '@sentry/core';
import { convertIntegrationFnToClass } from '@sentry/core';
import { captureEvent } from '@sentry/core';
import { getClient } from '@sentry/core';
import { flush } from '@sentry/core';
import type {
Client,
Event,
Integration,
IntegrationClass,
IntegrationFn,
Primitive,
StackParser,
} from '@sentry/types';
import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/types';
import { eventFromUnknownInput, isPrimitive } from '@sentry/utils';

type GlobalHandlersIntegrationsOptionKeys = 'error' | 'unhandledrejection';
Expand Down Expand Up @@ -42,20 +33,20 @@ const _globalHandlersIntegration = ((options?: GlobalHandlersIntegrations) => {
};
}) satisfies IntegrationFn;

export const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);

/**
* Global handlers.
* @deprecated Use `globalHandlersIntegration()` instead.
* Instruments global `error` and `unhandledrejection` listeners in Deno.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.globalHandlersIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const GlobalHandlers = convertIntegrationFnToClass(
INTEGRATION_NAME,
globalHandlersIntegration,
) as IntegrationClass<Integration & { setup: (client: Client) => void }>;

// eslint-disable-next-line deprecation/deprecation
export type GlobalHandlers = typeof GlobalHandlers;
export const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);

function installGlobalErrorHandler(client: Client): void {
globalThis.addEventListener('error', data => {
Expand Down
6 changes: 0 additions & 6 deletions packages/deno/src/integrations/index.ts

This file was deleted.

26 changes: 13 additions & 13 deletions packages/deno/src/integrations/normalizepaths.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
import type { Event, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
import { defineIntegration } from '@sentry/core';
import type { IntegrationFn } from '@sentry/types';
import { createStackParser, dirname, nodeStackLineParser } from '@sentry/utils';

const INTEGRATION_NAME = 'NormalizePaths';
Expand Down Expand Up @@ -96,17 +96,17 @@ const _normalizePathsIntegration = (() => {
};
}) satisfies IntegrationFn;

export const normalizePathsIntegration = defineIntegration(_normalizePathsIntegration);

/**
* Normalises paths to the app root directory.
* @deprecated Use `normalizePathsIntegration()` instead.
*
* Enabled by default in the Deno SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.normalizePathsIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const NormalizePaths = convertIntegrationFnToClass(
INTEGRATION_NAME,
normalizePathsIntegration,
) as IntegrationClass<Integration & { processEvent: (event: Event) => Event }>;

// eslint-disable-next-line deprecation/deprecation
export type NormalizePaths = typeof NormalizePaths;
export const normalizePathsIntegration = defineIntegration(_normalizePathsIntegration);
Loading