Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v2.0.4
with:
deno-version: ${{ matrix.deno-version || 'v2.8.0' }}
deno-version: ${{ matrix.deno-version || 'v2.8.3' }}
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
Expand Down Expand Up @@ -936,7 +936,7 @@ jobs:
- name: Set up Deno
uses: denoland/setup-deno@v2.0.4
with:
deno-version: 'v2.8.0'
deno-version: 'v2.8.3'
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
Expand Down Expand Up @@ -1046,7 +1046,7 @@ jobs:
matrix.test-application == 'deno-pg'
uses: denoland/setup-deno@v2.0.4
with:
deno-version: ${{ matrix.deno-version || 'v2.8.0' }}
deno-version: ${{ matrix.deno-version || 'v2.8.3' }}
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
Expand Down Expand Up @@ -1169,7 +1169,7 @@ jobs:
if: matrix.test-application == 'deno' || matrix.test-application == 'deno-streamed'
uses: denoland/setup-deno@v2.0.4
with:
deno-version: ${{ matrix.deno-version || 'v2.8.0' }}
deno-version: ${{ matrix.deno-version || 'v2.8.3' }}
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
Expand Down
2 changes: 1 addition & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Version 11 of the Sentry SDK has new compatibility ranges for runtimes and frame

**Node.js:** The minimum supported Node.js version is now **20.19.0**. Node.js 18 is no longer supported.

**Deno:** The minimum supported Deno version is now **2.8.2**.
**Deno:** The minimum supported Deno version is now **2.8.3**.

**Browsers:** Support for **Safari 14** was dropped. Sentry now requires Safari 15 or higher. For the rest of the browser support matrix, refer to the [Sentry docs](https://docs.sentry.io/platforms/javascript/#browser-support).

Expand Down
22 changes: 3 additions & 19 deletions packages/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,14 @@ own. To instrument them, Sentry uses
transform them at load time so they publish to
`node:diagnostics_channel`.

In Deno versions prior to 2.8.0, this is not available, as it
relies on `Module.registerHooks`, which was added in that
version.

As of Deno 2.8.3, you can use the `--import` or `--preload`
argument to `deno run` in order to enable these instrumentations.
Use the `--import` or `--preload` argument to `deno run` to enable
these instrumentations.

```bash
$ deno run --import=@sentry/deno/import app.ts
```

> [!NOTE]
> In Deno versions **2.8.0** through **2.8.2**, a bug causes Deno
> to deadlock when a module hook is added in this way. As a
> workaround, you can import the loader explicitly, and then
> dynamically import your app to take advantage of the added
> module loading hooks.
>
> ```ts
> import 'npm:@sentry/deno/import';
> await import('./app.ts');
> ```

In both cases, your `app.ts` should simply load Sentry as usual:
Your `app.ts` should simply load Sentry as usual:

```ts
// app.ts
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/scripts/download-deno-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { existsSync, writeFileSync } from 'fs';
import { download } from './download.mjs';

if (!existsSync('lib.deno.d.ts')) {
const code = await download('https://github.com/denoland/deno/releases/download/v2.8.0/lib.deno.d.ts');
const code = await download('https://github.com/denoland/deno/releases/download/v2.8.3/lib.deno.d.ts');
writeFileSync('lib.deno.d.ts', code);
}
32 changes: 0 additions & 32 deletions packages/deno/src/denoVersion.ts

This file was deleted.

20 changes: 2 additions & 18 deletions packages/deno/src/import.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
/**
* EXPERIMENTAL: orchestrion runtime hook for Deno.
*
* In Deno versions prior to 2.8.0, this is a no-op: it relies on
* `Module.registerHooks` (added in 2.8.0), so without it the channels are
* simply not injected (channel-based instrumentation is disabled, with a
* warning in debug builds). It does not crash.
*
* As of Deno 2.8.3, this can be loaded via `--import` or `--preload`
* argument to `deno run` in order to enable these instrumentations.
* Load this via the `--import` or `--preload` argument to `deno run` to
* enable the channel-based instrumentations.
*
* For example:
*
* ```bash
* $ deno run --import=@sentry/deno/import app.ts
* ```
*
* In Deno 2.8.0 through 2.8.2, it can be loaded directly in an
* `init.ts` file that then loads the app via dynamic import.
*
* For example:
*
* ```ts
* // init.ts
* import '@sentry/deno/import';
* await import('./app.ts');
* ```
*
* @module
*/
import '@sentry/server-utils/orchestrion/import-hook';
78 changes: 27 additions & 51 deletions packages/deno/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ import { errorMonitor } from 'node:events';
import type { RequestOptions } from 'node:http';
import type { HttpIncomingMessage, Integration, IntegrationFn, Span } from '@sentry/core';
import {
debug,
defineIntegration,
getHttpClientSubscriptions,
getHttpServerSubscriptions,
getRequestOptions,
HTTP_ON_CLIENT_REQUEST,
HTTP_ON_SERVER_REQUEST,
} from '@sentry/core';
import {
DENO_VERSION,
HTTP_CLIENT_DIAGNOSTICS_CHANNEL_SUPPORTED,
HTTP_SERVER_DIAGNOSTICS_CHANNEL_SUPPORTED,
} from '../denoVersion';

const INTEGRATION_NAME = 'DenoHttp' as const;

Expand Down Expand Up @@ -100,51 +94,33 @@ const _denoHttpIntegration = ((options: DenoHttpIntegrationOptions = {}) => {
return {
name: INTEGRATION_NAME,
setupOnce() {
const denoVersion = DENO_VERSION.major !== undefined ? `${Deno.version.deno}` : 'unknown';

// Below 2.7.13 neither channel fires. Warn and bail without touching the ACS.
if (!HTTP_CLIENT_DIAGNOSTICS_CHANNEL_SUPPORTED && !HTTP_SERVER_DIAGNOSTICS_CHANNEL_SUPPORTED) {
debug.warn(
`denoHttpIntegration requires Deno 2.7.13+ (client) or 2.8.0+ (server) for node:http diagnostics channels; running on Deno ${denoVersion}. The integration is a no-op on this version.`,
);
return;
}

if (HTTP_SERVER_DIAGNOSTICS_CHANNEL_SUPPORTED) {
const { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest } = getHttpServerSubscriptions({
// `spans` falls through to the client's tracing config when unset.
spans: options.spans,
ignoreStaticAssets: options.ignoreStaticAssets,
ignoreIncomingRequests: options.ignoreIncomingRequests,
maxRequestBodySize: options.maxRequestBodySize ?? 'medium',
ignoreRequestBody: options.ignoreRequestBody,
onSpanCreated: options.onIncomingSpanCreated,
onSpanEnd: options.onIncomingSpanEnd,
errorMonitor,
sessions: false,
});
subscribe(HTTP_ON_SERVER_REQUEST, onHttpServerRequest);
} else {
debug.log(
`denoHttpIntegration: server-side instrumentation requires Deno 2.8.0+; running on Deno ${denoVersion}. Client-side instrumentation is still active.`,
);
}

if (HTTP_CLIENT_DIAGNOSTICS_CHANNEL_SUPPORTED) {
const { [HTTP_ON_CLIENT_REQUEST]: onHttpClientRequest } = getHttpClientSubscriptions({
spans: options.spans,
breadcrumbs,
propagateTrace: tracePropagation,
ignoreOutgoingRequests: options.ignoreOutgoingRequests
? (url, request) => options.ignoreOutgoingRequests!(url, getRequestOptions(request))
: undefined,
// Deno doesn't run OTel's http instrumentation, so there's no
// double-wrap to detect; skip the warning to avoid loading the module.
suppressOtelWarning: true,
errorMonitor,
});
subscribe(HTTP_ON_CLIENT_REQUEST, onHttpClientRequest);
}
const { [HTTP_ON_SERVER_REQUEST]: onHttpServerRequest } = getHttpServerSubscriptions({
// `spans` falls through to the client's tracing config when unset.
spans: options.spans,
ignoreStaticAssets: options.ignoreStaticAssets,
ignoreIncomingRequests: options.ignoreIncomingRequests,
maxRequestBodySize: options.maxRequestBodySize ?? 'medium',
ignoreRequestBody: options.ignoreRequestBody,
onSpanCreated: options.onIncomingSpanCreated,
onSpanEnd: options.onIncomingSpanEnd,
errorMonitor,
sessions: false,
});
subscribe(HTTP_ON_SERVER_REQUEST, onHttpServerRequest);

const { [HTTP_ON_CLIENT_REQUEST]: onHttpClientRequest } = getHttpClientSubscriptions({
spans: options.spans,
breadcrumbs,
propagateTrace: tracePropagation,
ignoreOutgoingRequests: options.ignoreOutgoingRequests
? (url, request) => options.ignoreOutgoingRequests!(url, getRequestOptions(request))
: undefined,
// Deno doesn't run OTel's http instrumentation, so there's no
// double-wrap to detect; skip the warning to avoid loading the module.
suppressOtelWarning: true,
errorMonitor,
});
subscribe(HTTP_ON_CLIENT_REQUEST, onHttpClientRequest);
},
};
}) satisfies IntegrationFn;
Expand Down
80 changes: 27 additions & 53 deletions packages/deno/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ import { DenoClient } from './client';
import { breadcrumbsIntegration } from './integrations/breadcrumbs';
import { denoContextIntegration } from './integrations/context';
import { contextLinesIntegration } from './integrations/contextlines';
import {
HTTP_CLIENT_DIAGNOSTICS_CHANNEL_SUPPORTED,
HTTP_SERVER_DIAGNOSTICS_CHANNEL_SUPPORTED,
MODULE_REGISTER_HOOKS_SUPPORTED,
TRACING_CHANNEL_SUPPORTED,
} from './denoVersion';
import { denoServeIntegration } from './integrations/deno-serve';
import { denoHttpIntegration } from './integrations/http';
import { denoRedisIntegration } from './integrations/redis';
Expand All @@ -71,57 +65,37 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
breadcrumbsIntegration(),
denoContextIntegration(),
denoServeIntegration(),
// node:http client diagnostics channels fire on Deno 2.7.13+
// server channels arrive at 2.8.0+
// Include in defaults if at least one is available
...(HTTP_CLIENT_DIAGNOSTICS_CHANNEL_SUPPORTED || HTTP_SERVER_DIAGNOSTICS_CHANNEL_SUPPORTED
? [denoHttpIntegration()]
: []),
// node:diagnostics_channel.tracingChannel exists on Deno 1.44.3+.
...(TRACING_CHANNEL_SUPPORTED ? [denoRedisIntegration()] : []),
// graphql is gated on tracingChannel rather than the module hook: the
// composed integration also subscribes to graphql v17's native diagnostics
// channels, which need only tracingChannel. The orchestrion implementation
// (graphql v14–16) stays inert until the runtime hook injects those channels.
...(TRACING_CHANNEL_SUPPORTED ? [graphqlDiagnosticsIntegration()] : []),
// vercel-ai is gated on tracingChannel rather than the module hook, like
// graphql: the composed integration also subscribes to the `ai` SDK v7's
// native `ai:telemetry` channel, which needs only tracingChannel. The
// orchestrion implementation (ai v4–6) stays inert until the runtime hook
// injects those channels.
...(TRACING_CHANNEL_SUPPORTED ? [vercelAiIntegration()] : []),
denoHttpIntegration(),
denoRedisIntegration(),
graphqlDiagnosticsIntegration(),
vercelAiIntegration(),
// orchestrion-based instrumentations. We add a deliberate list here rather
// than every channel integration: each one needs a Deno test proving it
// records spans.
//
// The orchestrion channels may be injected after (or while) the SDK loads,
// so we gate only on whether the feature is possible. If they never load,
// this is a no-op.
...(MODULE_REGISTER_HOOKS_SUPPORTED
? [
amqplibIntegration(),
anthropicIntegration(),
awsIntegration(),
expressIntegration(),
firebaseIntegration(),
genericPoolIntegration(),
googleGenAIIntegration(),
hapiIntegration(),
kafkajsIntegration(),
koaIntegration(),
langChainIntegration(),
langGraphIntegration(),
lruMemoizerIntegration(),
mongodbIntegration(),
mongooseIntegration(),
mysqlIntegration(),
mysql2Integration(),
openaiIntegration(),
postgresIntegration(),
postgresJsIntegration(),
tediousIntegration(),
]
: []),
// The orchestrion channels may be injected after (or while) the SDK loads.
// If they never load, these are no-ops.
amqplibIntegration(),
anthropicIntegration(),
awsIntegration(),
expressIntegration(),
firebaseIntegration(),
genericPoolIntegration(),
googleGenAIIntegration(),
hapiIntegration(),
kafkajsIntegration(),
koaIntegration(),
langChainIntegration(),
langGraphIntegration(),
lruMemoizerIntegration(),
mongodbIntegration(),
mongooseIntegration(),
mysqlIntegration(),
mysql2Integration(),
openaiIntegration(),
postgresIntegration(),
postgresJsIntegration(),
tediousIntegration(),
contextLinesIntegration(),
normalizePathsIntegration(),
globalHandlersIntegration(),
Expand Down
Loading
Loading