Repository navigation
feat(deno): Align deno with node & run integration suites with @sentry/deno - #26595
Conversation
size-limit report 📦Compared: ceeb934 (PR test merge using develop at b361c10) Against: b361c10 (develop) · base run #67257 ✅ Baseline matches: this diff contains only this PR's changes.
|
| // `alias-sentry-deno.ts`. The suites below fail only because of that. | ||
|
|
||
| // The scenario uses an `@sentry/node` export that `@sentry/deno` does not have, such as | ||
| // `httpIntegration`, `nativeNodeFetchIntegration`, `setupExpressErrorHandler`, |
There was a problem hiding this comment.
actually let's fix some of these instead of excluding them:
- setupExpressErrorHandler:, setupHapiErrorHandler: just add these exports to deno I guess?
- cron: I guess that cannot work in deno, then fine?
- NodeClient: which tests actully rely on this? could we write the tests without this?
- node logging/queue: which are these?
I guess httpIntegration and nativeNodeFetchIntegration make sense to skip!
There was a problem hiding this comment.
Updated in e379224:
setupExpressErrorHandler/setupHapiErrorHandler:@sentry/denonow re-exportssetupExpressErrorHandlerandexpressErrorHandlerfrom@sentry/server-utils, like Bun. The deprecatedsetupHapiErrorHandlerwrapper moved from@sentry/nodeto@sentry/server-utils, likesetupFastifyErrorHandler, and Node and Deno both re-export it. Node's API and deprecation are unchanged.express/handle-errorandtracing/hapinow run on Deno and pass.NodeClient: two suites use it.public-api/logsnow usesSentry.init({ defaultIntegrations: false, ... })with the custom scope instead ofnew NodeClient(...). That lets it run with@sentry/bun, so I removed its Bun exclude too. It stays excluded on Deno, for a different reason: theloggerof@sentry/nodetakes printf-style parameters (logger.info('test info with %d', [1])), and theloggerof@sentry/corein@sentry/denodoes not.tracing/tracer-start-active-span-errordrivesclient.tracer, the OTel tracer that onlyNodeClienthas. It stays excluded, in its own commented group.
- cron and Node logging/queue:
cron(instrumentCron,instrumentNodeCron,instrumentNodeSchedule),pinoIntegration,createSentryWinstonTransportandBullMQTelemetryonly import@sentry/coreand@sentry/server-utils, plusnode:utilfor the logs. So they should work on Deno once they move to@sentry/server-utils. I suggest that as a separate follow-up PR; this one keeps them excluded. httpIntegrationandnativeNodeFetchIntegrationstay excluded, as you said.
| 'suites/public-api/onUnhandledRejectionIntegration/test.ts', | ||
| ]; | ||
|
|
||
| // `@sentry/deno` does not send client reports: unlike `NodeClient`, `DenoClient` never flushes the |
There was a problem hiding this comment.
can we fix this? (in a separate pr)
There was a problem hiding this comment.
Opened #26604. DenoClient now sends client reports on flush(), on an unref'd interval and before exit, and init() enables sendClientReports by default. I ran it locally together with this PR: with NO_CLIENT_REPORTS removed, all of those suites pass on Deno except tracing/ignoreSpans/continued-trace-http-client, where the ignored fetch span differs. Whichever PR merges second should remove the group.
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 56 successful. See the run.
Successful checks
|
| // The test expects data that a default integration of `@sentry/node` adds and `@sentry/deno` does | ||
| // not have: process sessions, child process breadcrumbs, the `modules` of the event, the | ||
| // `node_system_error` context, and the context attributes of `nodeContextIntegration` on spans. | ||
| const NO_NODE_DEFAULT_INTEGRATION = [ |
There was a problem hiding this comment.
do these not exist on deno, or are they just not defaults?
There was a problem hiding this comment.
They don't exist on Deno: processSessionIntegration, childProcessIntegration, modulesIntegration, systemErrorIntegration and nodeContextIntegration are defined only in packages/node/src/integrations/ and exported only from @sentry/node. @sentry/deno has its own denoContextIntegration, which sets other context data, and nothing for the rest.
They import only @sentry/core, @sentry/server-utils and node: builtins (child_process via diagnostics channel, fs, os, path, util), so moving them to server-utils for Deno looks possible. I haven't checked whether Deno publishes the child_process channel or how modules would resolve without node_modules.
| // The `fetchIntegration` of `@sentry/deno` creates other spans and breadcrumbs than `@sentry/node`: | ||
| // the span origin is `auto.http.fetch`, not `auto.http.node_fetch`, the spans have fewer | ||
| // attributes, and the breadcrumb category is `fetch`, not `http`. | ||
| const FETCH_INTEGRATION_DIFFERS = [ |
There was a problem hiding this comment.
can you create an issue tracking the differences here, we should eventually align those imho
There was a problem hiding this comment.
Opened #26608 with the span attribute and breadcrumb differences, taken from local runs of these four suites on Node and Deno.
…6605) ## What `Sentry.cron` (`instrumentCron`, `instrumentNodeCron`, `instrumentNodeSchedule`), `pinoIntegration`, `createSentryWinstonTransport` and `BullMQTelemetry` move from `@sentry/node` to `@sentry/server-utils`, and `@sentry/deno` now exports them. `@sentry/node` re-exports them unchanged: same names, types, deprecations and defaults. Bun, AWS Lambda and Google Cloud Functions still get them through `@sentry/node`. Node doesn't enable any of them by default, so Deno doesn't either. ## Why The code only depends on `@sentry/core`, `@sentry/conventions`, diagnostics channels and OTel types, so nothing about it is Node-specific. The Winston transport now calls `_INTERNAL_captureLog` from core directly instead of going through Node's `logs/capture` helper, which only forwarded to it. Node's `logger` still uses that helper, so it stays. #26595 runs the shared Node integration suites with `@sentry/deno` and excludes these suites because Deno doesn't export them. They can be un-excluded there, or in a follow-up once both PRs land. The `_INTERNAL_isReadAlikeByNodeCron3` and `_INTERNAL_CronDialect` server-utils exports are removed. Only the moved cron code used them. Cloudflare re-exports server-utils integrations the same way, and `cron` and `BullMQTelemetry` could likely be exported there too. That's left for a follow-up. <!-- junior-request-attribution:start --> via @mydea. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ab2ab9e4a9f9fc9cac6b32725256a6c56 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ab2ab9e4a9f9fc9cac6b32725256a6c56) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab2ab9e4a9f9fc9cac6b32725256a6c56/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
217e127 to
2e28a5c
Compare
Map `@sentry/node` to `@sentry/deno` in the Node suite files, so the Deno CI job tests the Deno SDK instead of `@sentry/node` on Deno. ES modules get the mapping from import map scopes, and CommonJS scenarios from a `Module._resolveFilename` preload, because Deno does not apply import maps to `require()`. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Re-export `setupExpressErrorHandler` and `expressErrorHandler` from `@sentry/server-utils`, and move Node's deprecated `setupHapiErrorHandler` wrapper to `@sentry/server-utils` so both SDKs share it. The Express and Hapi error handler suites now run on Deno. `public-api/logs` no longer constructs a `NodeClient`, so it now runs with `@sentry/bun`. It stays excluded on Deno, whose `logger` does not take printf-style parameters. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
`Sentry.init()` reads the release from CI env vars, which `new NodeClient()` did not, so CI logs got a `sentry.release` attribute. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
|
rebase on develop and double check the list, make sure nothing can since be removed there too |
2e28a5c to
a6c2f31
Compare
## What `@sentry/deno` now sends client reports on an interval (`clientReportFlushInterval`, 60 seconds by default) and before the process exits. `init()` turns on `sendClientReports` by default, as `@sentry/node` does. Sending them on `flush()`/`close()` comes in #26619, stacked on this PR, which moves that into core `Client.flush` for every SDK. ## Why `DenoClient` recorded dropped events but never sent the outcomes, so Deno apps sent no client reports. This follows `NodeClient.startClientReportTracking`. The interval is unref'd, and `close()` removes it and the exit listener. This does not depend on #26595, which runs the Node integration suites with `@sentry/deno`. That PR excludes the client report suites in `NO_CLIENT_REPORTS`. Whichever PR merges second should remove that group. `tracing/ignoreSpans/continued-trace-http-client` should stay excluded because its `fetch` span differs. <!-- junior-request-attribution:start --> via @mydea. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1795075925.324589 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1795075925.324589) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1795075925.324589/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
|
@mydea Rebased on develop (80a2ca4) and re-ran every excluded suite on Deno 2.8.3. 8a1ab5399e removes the ones that pass now:
Still excluded, regrouped by their actual cause now that the export exists:
Everything else still fails for the reason in its group, including |
8a1ab53 to
a6c2f31
Compare
… spans (getsentry#26638) ## What `http.client` spans from fetch (all runtimes) and from browser XHR now have `sentry.kind: 'client'`, `url.path` and `url.scheme`, like the spans of `@sentry/node`. Fetch breadcrumbs of the server runtimes (Deno, Bun, Cloudflare, Vercel Edge) also get `http.request.method` next to `method`. The shared Node fetch suites now expect the span origin and breadcrumb category of the SDK under test, so they also run on Deno. ## Why This is the additive part of getsentry#26608, so nothing breaks. The origin (`auto.http.fetch`) and breadcrumb category (`fetch`) stay, because changing them would be breaking. The three attributes are correct in the browser too, and the fetch code is shared, so they're set everywhere instead of behind a server-only flag. XHR spans get them as well so fetch and XHR spans stay consistent. `url.path` and `url.scheme` are only set for URLs with a host, so data URLs don't get them. `http.request.method_original`, `network.peer.*` and `user_agent.original` are not added: a patched global `fetch` sees neither the connection nor the default headers, and gets the method already uppercased. Open questions: - `url.full` keeps the `#fragment` on these runtimes, where undici drops it. Should we drop it too? - Bun's fetch excludes are untouched, since getsentry#26612 reworks that list. - Browser bundles grow by a few bytes. Stacked on getsentry#26595. Refs: getsentry#26608 <!-- junior-request-attribution:start --> via @mydea. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1795090204.972289 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1795090204.972289) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1795090204.972289/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
…sentry#26640) ## What Removes the Deno `orchestrion-*` suites for amqplib, anthropic, express, generic-pool, google-genai, hapi, kafkajs, langchain, langgraph, lru-memoizer, mongo, mongoose, mysql2, openai and vercel-ai, and the synthetic `orchestrion:pg:query` test. Also removes the "included in default integrations" test from the remaining suites. ## Why Since getsentry#26595, the Node integration suites for these packages run on Deno against `@sentry/deno` with the real packages. The synthetic suites publish to the channel by hand, so they duplicate those suites with weaker checks. The default integrations tests only assert a name in a list, and the channel tests next to them already fail when an integration is missing. The suites for fastify, koa, mysql, postgresjs, graphql, tedious, aws and firebase stay until their Node suites run on Deno. Stacked on getsentry#26638. <!-- junior-request-attribution:start --> via @mydea. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1795090204.972289 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1795090204.972289) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1795090204.972289/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
What
The Deno run of the shared Node integration suites uses
@sentry/denoinstead of@sentry/node. In the Node suite files,@sentry/nodemaps to@sentry/deno. ES modules get the mapping fromscopesinnode-suites/import-map.json. Deno does not apply import maps torequire(), so CommonJS scenarios get it from a preload that patchesModule._resolveFilename, likealias-sentry-bun.ts.@sentry/denoalso exports the deprecatedsetupExpressErrorHandler,expressErrorHandlerandsetupHapiErrorHandler, like@sentry/node.setupHapiErrorHandlermoved to@sentry/server-utils, likesetupFastifyErrorHandler.Why
@sentry/nodeinstrumentsfetchthrough undici diagnostics channels, which Deno'sfetchdoes not publish.@sentry/denohas its ownfetchIntegration, and it is the SDK that Deno users install. TheNO_FETCH_INSTRUMENTATIONexcludes are removed. Suites that need Node-only APIs or Node-specific event data are excluded in new groups inexcludes.ts, each with its cause.This replaces the
@sentry/noderun on Deno rather than adding a second project next to it, unlike Bun'snode-suitesproject. The suites that need Node-only APIs therefore no longer run on Deno; that is intended.public-api/logsno longer constructs aNodeClient, so it also runs with@sentry/bunnow.Follow-ups for
@sentry/deno:NO_CLIENT_REPORTS.module, andpost_contextends with an extra empty line.express/requestUsergets the IP address::ffff:127.0.0.1, where@sentry/nodegets::1.via @mydea.
--
View Session [Sentry]