@sentry/server-utils 11.1.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/THIRD-PARTY-LICENSES.txt +32 -32
- package/build/cjs/ai/core/apiPromise.js +54 -0
- package/build/cjs/ai/core/apiPromise.js.map +1 -0
- package/build/cjs/index.js +8 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.no-diagnostic-channels.js +5 -0
- package/build/cjs/index.no-diagnostic-channels.js.map +1 -1
- package/build/cjs/integrations/anthropic.js +11 -1
- package/build/cjs/integrations/anthropic.js.map +1 -1
- package/build/cjs/integrations/express/instrumentation.js +12 -1
- package/build/cjs/integrations/express/instrumentation.js.map +1 -1
- package/build/cjs/integrations/hono/applyPatches.js +38 -0
- package/build/cjs/integrations/hono/applyPatches.js.map +1 -0
- package/build/cjs/integrations/hono/constants.js +6 -0
- package/build/cjs/integrations/hono/constants.js.map +1 -0
- package/build/cjs/integrations/hono/createHonoMiddleware.js +44 -0
- package/build/cjs/integrations/hono/createHonoMiddleware.js.map +1 -0
- package/build/cjs/integrations/hono/defaultShouldHandleError.js +12 -0
- package/build/cjs/integrations/hono/defaultShouldHandleError.js.map +1 -0
- package/build/cjs/integrations/hono/hono-context.js +14 -0
- package/build/cjs/integrations/hono/hono-context.js.map +1 -0
- package/build/cjs/integrations/hono/honoIntegration.js +126 -0
- package/build/cjs/integrations/hono/honoIntegration.js.map +1 -0
- package/build/cjs/integrations/hono/isMiddleware.js +14 -0
- package/build/cjs/integrations/hono/isMiddleware.js.map +1 -0
- package/build/cjs/integrations/hono/middlewareHandlers.js +79 -0
- package/build/cjs/integrations/hono/middlewareHandlers.js.map +1 -0
- package/build/cjs/integrations/hono/patchAppRequest.js +82 -0
- package/build/cjs/integrations/hono/patchAppRequest.js.map +1 -0
- package/build/cjs/integrations/hono/patchAppUse.js +70 -0
- package/build/cjs/integrations/hono/patchAppUse.js.map +1 -0
- package/build/cjs/integrations/hono/patchRoute.js +81 -0
- package/build/cjs/integrations/hono/patchRoute.js.map +1 -0
- package/build/cjs/integrations/hono/resolveRouteName.js +31 -0
- package/build/cjs/integrations/hono/resolveRouteName.js.map +1 -0
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js +52 -0
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js.map +1 -0
- package/build/cjs/integrations/index.js +2 -1
- package/build/cjs/integrations/index.js.map +1 -1
- package/build/cjs/integrations/openai-compatible.js +11 -2
- package/build/cjs/integrations/openai-compatible.js.map +1 -1
- package/build/cjs/integrations/openai.js +11 -2
- package/build/cjs/integrations/openai.js.map +1 -1
- package/build/cjs/orchestrion/bundler/bun.js.map +1 -1
- package/build/cjs/orchestrion/bundler/moduleInjectedTransform.js +1 -1
- package/build/cjs/orchestrion/bundler/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +23 -0
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +2 -0
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +3 -3
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/cjs/orchestrion/config/channel-integration-definitions.js +1 -0
- package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/cjs/orchestrion/config/hono.js +32 -0
- package/build/cjs/orchestrion/config/hono.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +5 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/openai-compatible.js +2 -2
- package/build/cjs/orchestrion/config/openai-compatible.js.map +1 -1
- package/build/cjs/orchestrion/config/openai.js +5 -7
- package/build/cjs/orchestrion/config/openai.js.map +1 -1
- package/build/cjs/orchestrion/config/remix-v3.js +23 -0
- package/build/cjs/orchestrion/config/remix-v3.js.map +1 -0
- package/build/cjs/utils/sql.js +12 -9
- package/build/cjs/utils/sql.js.map +1 -1
- package/build/esm/ai/core/apiPromise.js +52 -0
- package/build/esm/ai/core/apiPromise.js.map +1 -0
- package/build/esm/index.js +3 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/index.no-diagnostic-channels.js +2 -0
- package/build/esm/index.no-diagnostic-channels.js.map +1 -1
- package/build/esm/integrations/anthropic.js +11 -1
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/express/instrumentation.js +12 -1
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/hono/applyPatches.js +34 -0
- package/build/esm/integrations/hono/applyPatches.js.map +1 -0
- package/build/esm/integrations/hono/constants.js +4 -0
- package/build/esm/integrations/hono/constants.js.map +1 -0
- package/build/esm/integrations/hono/createHonoMiddleware.js +41 -0
- package/build/esm/integrations/hono/createHonoMiddleware.js.map +1 -0
- package/build/esm/integrations/hono/defaultShouldHandleError.js +10 -0
- package/build/esm/integrations/hono/defaultShouldHandleError.js.map +1 -0
- package/build/esm/integrations/hono/hono-context.js +12 -0
- package/build/esm/integrations/hono/hono-context.js.map +1 -0
- package/build/esm/integrations/hono/honoIntegration.js +123 -0
- package/build/esm/integrations/hono/honoIntegration.js.map +1 -0
- package/build/esm/integrations/hono/isMiddleware.js +12 -0
- package/build/esm/integrations/hono/isMiddleware.js.map +1 -0
- package/build/esm/integrations/hono/middlewareHandlers.js +75 -0
- package/build/esm/integrations/hono/middlewareHandlers.js.map +1 -0
- package/build/esm/integrations/hono/patchAppRequest.js +78 -0
- package/build/esm/integrations/hono/patchAppRequest.js.map +1 -0
- package/build/esm/integrations/hono/patchAppUse.js +67 -0
- package/build/esm/integrations/hono/patchAppUse.js.map +1 -0
- package/build/esm/integrations/hono/patchRoute.js +78 -0
- package/build/esm/integrations/hono/patchRoute.js.map +1 -0
- package/build/esm/integrations/hono/resolveRouteName.js +29 -0
- package/build/esm/integrations/hono/resolveRouteName.js.map +1 -0
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js +50 -0
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js.map +1 -0
- package/build/esm/integrations/index.js +2 -1
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/openai-compatible.js +11 -2
- package/build/esm/integrations/openai-compatible.js.map +1 -1
- package/build/esm/integrations/openai.js +11 -2
- package/build/esm/integrations/openai.js.map +1 -1
- package/build/esm/orchestrion/bundler/bun.js.map +1 -1
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js +1 -1
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js.map +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +22 -1
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
- package/build/esm/orchestrion/channels.js +2 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +3 -3
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +1 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/esm/orchestrion/config/hono.js +28 -0
- package/build/esm/orchestrion/config/hono.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +5 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/openai-compatible.js +2 -2
- package/build/esm/orchestrion/config/openai-compatible.js.map +1 -1
- package/build/esm/orchestrion/config/openai.js +5 -7
- package/build/esm/orchestrion/config/openai.js.map +1 -1
- package/build/esm/orchestrion/config/remix-v3.js +20 -0
- package/build/esm/orchestrion/config/remix-v3.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/utils/sql.js +12 -9
- package/build/esm/utils/sql.js.map +1 -1
- package/build/types/ai/core/apiPromise.d.ts +2 -0
- package/build/types/ai/core/apiPromise.d.ts.map +1 -0
- package/build/types/exports.d.ts +4 -0
- package/build/types/exports.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/anthropic.d.ts.map +1 -1
- package/build/types/integrations/express/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/hono/applyPatches.d.ts +28 -0
- package/build/types/integrations/hono/applyPatches.d.ts.map +1 -0
- package/build/types/integrations/hono/constants.d.ts +2 -0
- package/build/types/integrations/hono/constants.d.ts.map +1 -0
- package/build/types/integrations/hono/createHonoMiddleware.d.ts +33 -0
- package/build/types/integrations/hono/createHonoMiddleware.d.ts.map +1 -0
- package/build/types/integrations/hono/defaultShouldHandleError.d.ts +12 -0
- package/build/types/integrations/hono/defaultShouldHandleError.d.ts.map +1 -0
- package/build/types/integrations/hono/hono-context.d.ts +6 -0
- package/build/types/integrations/hono/hono-context.d.ts.map +1 -0
- package/build/types/integrations/hono/honoIntegration.d.ts +29 -0
- package/build/types/integrations/hono/honoIntegration.d.ts.map +1 -0
- package/build/types/integrations/hono/honoTypes.d.ts +57 -0
- package/build/types/integrations/hono/honoTypes.d.ts.map +1 -0
- package/build/types/integrations/hono/index.d.ts +8 -0
- package/build/types/integrations/hono/index.d.ts.map +1 -0
- package/build/types/integrations/hono/isMiddleware.d.ts +13 -0
- package/build/types/integrations/hono/isMiddleware.d.ts.map +1 -0
- package/build/types/integrations/hono/middlewareHandlers.d.ts +20 -0
- package/build/types/integrations/hono/middlewareHandlers.d.ts.map +1 -0
- package/build/types/integrations/hono/patchAppRequest.d.ts +26 -0
- package/build/types/integrations/hono/patchAppRequest.d.ts.map +1 -0
- package/build/types/integrations/hono/patchAppUse.d.ts +16 -0
- package/build/types/integrations/hono/patchAppUse.d.ts.map +1 -0
- package/build/types/integrations/hono/patchRoute.d.ts +35 -0
- package/build/types/integrations/hono/patchRoute.d.ts.map +1 -0
- package/build/types/integrations/hono/resolveRouteName.d.ts +10 -0
- package/build/types/integrations/hono/resolveRouteName.d.ts.map +1 -0
- package/build/types/integrations/hono/types.d.ts +25 -0
- package/build/types/integrations/hono/types.d.ts.map +1 -0
- package/build/types/integrations/hono/wrapMiddlewareSpan.d.ts +9 -0
- package/build/types/integrations/hono/wrapMiddlewareSpan.d.ts.map +1 -0
- package/build/types/integrations/index.d.ts.map +1 -1
- package/build/types/integrations/openai-compatible.d.ts.map +1 -1
- package/build/types/integrations/openai.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/bun.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/moduleInjectedTransform.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/rollup.d.ts +21 -0
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +2 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/anthropic-ai.d.ts +2 -14
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +3 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
- package/build/types/orchestrion/config/hono.d.ts +8 -0
- package/build/types/orchestrion/config/hono.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts +1 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/mongodb.d.ts +2 -2
- package/build/types/orchestrion/config/openai-compatible.d.ts +2 -2
- package/build/types/orchestrion/config/openai.d.ts +1 -1
- package/build/types/orchestrion/config/openai.d.ts.map +1 -1
- package/build/types/orchestrion/config/remix-v3.d.ts +6 -0
- package/build/types/orchestrion/config/remix-v3.d.ts.map +1 -0
- package/build/types/utils/sql.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const debugBuild = require('../../debug-build.js');
|
|
5
|
+
const patchAppRequest = require('./patchAppRequest.js');
|
|
6
|
+
const patchAppUse = require('./patchAppUse.js');
|
|
7
|
+
const patchRoute = require('./patchRoute.js');
|
|
8
|
+
|
|
9
|
+
let _routeHook;
|
|
10
|
+
function earlyPatchHono(honoClass) {
|
|
11
|
+
_routeHook ?? (_routeHook = patchRoute.installRouteHookOnPrototype(Object.getPrototypeOf(honoClass.prototype)));
|
|
12
|
+
}
|
|
13
|
+
function applyPatches(app) {
|
|
14
|
+
_routeHook = patchRoute.installRouteHookOnPrototype(Object.getPrototypeOf(Object.getPrototypeOf(app)));
|
|
15
|
+
patchAppUse.patchAppUse(app);
|
|
16
|
+
patchAppUse.patchHttpMethodHandlers(app);
|
|
17
|
+
patchAppRequest.patchAppRequest(app);
|
|
18
|
+
_routeHook.activate();
|
|
19
|
+
const pendingSubApps = _routeHook.getPendingSubApps();
|
|
20
|
+
if (pendingSubApps.size > 0) {
|
|
21
|
+
debugBuild.DEBUG_BUILD && core.debug.log(
|
|
22
|
+
`[hono] ${pendingSubApps.size} sub-app(s) were mounted before sentry(). Tracing is applied retroactively. Consider registering sentry() before calling app.route().`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
for (const subApp of pendingSubApps) {
|
|
26
|
+
patchRoute.wrapSubAppMiddleware(subApp.routes);
|
|
27
|
+
patchAppRequest.patchAppRequest(subApp);
|
|
28
|
+
}
|
|
29
|
+
pendingSubApps.clear();
|
|
30
|
+
}
|
|
31
|
+
function applyHonoPatches(app) {
|
|
32
|
+
applyPatches(app);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.applyHonoPatches = applyHonoPatches;
|
|
36
|
+
exports.applyPatches = applyPatches;
|
|
37
|
+
exports.earlyPatchHono = earlyPatchHono;
|
|
38
|
+
//# sourceMappingURL=applyPatches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPatches.js","sources":["../../../../src/integrations/hono/applyPatches.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { Env, Hono } from './honoTypes';\nimport { patchAppRequest } from './patchAppRequest';\nimport { patchAppUse, patchHttpMethodHandlers } from './patchAppUse';\nimport { type RouteHookHandle, installRouteHookOnPrototype, wrapSubAppMiddleware } from './patchRoute';\n\n// Lazily set by the first call to earlyPatchHono or applyPatches.\nlet _routeHook: RouteHookHandle | undefined;\n\n/**\n * Hooks `HonoBase.prototype.route` at import time, before `sentry()` runs.\n *\n * Collecting sub-app references early ensures nothing is missed if sub-apps are mounted synchronously\n * before the `sentry()` middleware is registered. The `Hono` class is passed in by the caller (the\n * `@sentry/hono` SDK, where `hono` is a peer dependency) so this module never imports `hono` itself;\n * `HonoBase.prototype` is one level above the class prototype.\n */\nexport function earlyPatchHono(honoClass: { prototype: object }): void {\n _routeHook ??= installRouteHookOnPrototype(Object.getPrototypeOf(honoClass.prototype));\n}\n\n/**\n * Instruments a Hono app instance for Sentry tracing in middleware and route handlers.\n *\n * - `use` and `request` are per-instance class fields → must be patched on the instance.\n * - `route` is a prototype method → hooked once globally, covers all instances.\n * - Retroactively instruments sub-apps mounted before `sentry()` was called.\n */\nexport function applyPatches<E extends Env>(app: Hono<E>): void {\n // `HonoBase.prototype` (where `route` lives) is two levels up from the app instance:\n // app → Hono.prototype → HonoBase.prototype. Deriving it from the live app avoids importing `hono`.\n // Always call — installRouteHookOnPrototype is idempotent and returns existing handle when prototype already patched\n _routeHook = installRouteHookOnPrototype(Object.getPrototypeOf(Object.getPrototypeOf(app)));\n\n // `app.use` (instance own property) — wraps middleware at registration time on this instance.\n patchAppUse(app);\n\n // `app.get`, `app.post`, … (instance own properties) — wraps inline middleware (all-but-last handler).\n patchHttpMethodHandlers(app);\n\n patchAppRequest(app);\n\n _routeHook.activate();\n\n const pendingSubApps = _routeHook.getPendingSubApps();\n\n if (pendingSubApps.size > 0) {\n DEBUG_BUILD &&\n debug.log(\n `[hono] ${pendingSubApps.size} sub-app(s) were mounted before sentry(). Tracing is applied retroactively. Consider registering sentry() before calling app.route().`,\n );\n }\n\n for (const subApp of pendingSubApps) {\n wrapSubAppMiddleware(subApp.routes);\n patchAppRequest(subApp);\n }\n\n pendingSubApps.clear();\n}\n\n/**\n * Applies Sentry's Hono span patches to an app instance.\n *\n * Typed loosely (`object`) so the real `hono` `Hono<E, S, P>` type used by the `@sentry/hono` SDK is\n * accepted without a cast; internally it is treated as the vendored {@link Hono} shape.\n */\nexport function applyHonoPatches(app: object): void {\n applyPatches(app as Hono);\n}\n"],"names":["installRouteHookOnPrototype","patchAppUse","patchHttpMethodHandlers","patchAppRequest","DEBUG_BUILD","debug","wrapSubAppMiddleware"],"mappings":";;;;;;;;AAQA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAUG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwC;AACrE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAeA,sCAAA,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAC,CAAA,CAAA;AACvF;AASO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAA4B,CAAA,CAAA,CAAA,C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AM,CAAA;AAClC,CAAA,CAAA,CAAA,CAAAH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA;AAAA,CAAA,CACxB;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AACvB;AAQO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAiB,CAAA,CAAA,CAAA,CAAA,CAAmB;AAClD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAW,CAAA;AAC1B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/integrations/hono/constants.ts"],"sourcesContent":["// Origin for the `http.server` child span that traces Hono's internal `app.request(...)` dispatches.\n// Shared by the `app.request` Proxy (`patchAppRequest`) and the orchestrion channel subscriber\n// (`instrumentInternalRequests` in `honoIntegration`), which both open this span.\nexport const INTERNAL_REQUEST_ORIGIN = 'auto.http.hono.internal_request';\n"],"names":[],"mappings":";;AAGO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,uBAAA,CAAA,CAAA,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const middlewareHandlers = require('./middlewareHandlers.js');
|
|
5
|
+
|
|
6
|
+
const SENTRY_HONO_MIDDLEWARE = "__SENTRY_HONO_MIDDLEWARE__";
|
|
7
|
+
const HONO_REQUEST_HANDLED = /* @__PURE__ */ Symbol.for("sentry.hono.requestHandled");
|
|
8
|
+
const HONO_SHOULD_HANDLE_ERROR = /* @__PURE__ */ Symbol.for("sentry.hono.shouldHandleError");
|
|
9
|
+
function getRequestScope(context) {
|
|
10
|
+
const isolationScope = core.getIsolationScope();
|
|
11
|
+
const target = isolationScope === core.getDefaultIsolationScope() ? context : isolationScope;
|
|
12
|
+
return target;
|
|
13
|
+
}
|
|
14
|
+
function createHonoRequestMiddleware(options = {}) {
|
|
15
|
+
const middleware = async (context, next) => {
|
|
16
|
+
const scope = getRequestScope(context);
|
|
17
|
+
const shouldHandleError = options.resolveShouldHandleError ? options.resolveShouldHandleError(context) : options.shouldHandleError;
|
|
18
|
+
if (shouldHandleError) {
|
|
19
|
+
core.addNonEnumerableProperty(scope, HONO_SHOULD_HANDLE_ERROR, shouldHandleError);
|
|
20
|
+
}
|
|
21
|
+
if (scope[HONO_REQUEST_HANDLED]) {
|
|
22
|
+
await next();
|
|
23
|
+
const dedupShouldHandleError = scope[HONO_SHOULD_HANDLE_ERROR] ?? shouldHandleError;
|
|
24
|
+
middlewareHandlers.captureContextError(context, dedupShouldHandleError);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
core.addNonEnumerableProperty(scope, HONO_REQUEST_HANDLED, true);
|
|
28
|
+
try {
|
|
29
|
+
middlewareHandlers.requestHandler(context, options.getConnInfo);
|
|
30
|
+
await next();
|
|
31
|
+
const effectiveShouldHandleError = scope[HONO_SHOULD_HANDLE_ERROR] ?? shouldHandleError;
|
|
32
|
+
middlewareHandlers.responseHandler(context, effectiveShouldHandleError);
|
|
33
|
+
} finally {
|
|
34
|
+
core.addNonEnumerableProperty(scope, HONO_REQUEST_HANDLED, void 0);
|
|
35
|
+
core.addNonEnumerableProperty(scope, HONO_SHOULD_HANDLE_ERROR, void 0);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
core.addNonEnumerableProperty(middleware, SENTRY_HONO_MIDDLEWARE, true);
|
|
39
|
+
return middleware;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.SENTRY_HONO_MIDDLEWARE = SENTRY_HONO_MIDDLEWARE;
|
|
43
|
+
exports.createHonoRequestMiddleware = createHonoRequestMiddleware;
|
|
44
|
+
//# sourceMappingURL=createHonoMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHonoMiddleware.js","sources":["../../../../src/integrations/hono/createHonoMiddleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getDefaultIsolationScope, getIsolationScope } from '@sentry/core';\nimport type { Context, GetConnInfo, MiddlewareHandler } from './honoTypes';\nimport { captureContextError, requestHandler, responseHandler } from './middlewareHandlers';\nimport type { SentryHonoMiddlewareOptions } from './types';\n\n// Marks the Sentry request/response middleware so the span-wrapping patches never turn it into a\n// middleware span — most importantly when an auto-instrumented sub-app carrying this middleware is\n// mounted into a parent and `wrapSubAppMiddleware` wraps its handlers. Read by `wrapMiddlewareWithSpan`.\nexport const SENTRY_HONO_MIDDLEWARE = '__SENTRY_HONO_MIDDLEWARE__';\n\n// `Symbol.for` (global registry) so the markers are shared even if this module is evaluated from more\n// than one copy of `@sentry/server-utils`.\nconst HONO_REQUEST_HANDLED = Symbol.for('sentry.hono.requestHandled');\n// The effective `shouldHandleError` for the request, recorded even by a deduplicated middleware so a\n// user-provided callback wins over the default (see below).\nconst HONO_SHOULD_HANDLE_ERROR = Symbol.for('sentry.hono.shouldHandleError');\n\nexport interface CreateHonoRequestMiddlewareOptions {\n /**\n * Runtime-specific `getConnInfo` helper (e.g. `@hono/node-server/conninfo`, `hono/bun`).\n * Optional — connection-info attributes are simply skipped when it is not provided.\n */\n getConnInfo?: GetConnInfo;\n\n /** Static `shouldHandleError` callback (Node/Bun/Deno). */\n shouldHandleError?: SentryHonoMiddlewareOptions['shouldHandleError'];\n\n /**\n * Resolves `shouldHandleError` per request from the context. Cloudflare accepts\n * middleware options as a function of `env`, so the callback is only known once a\n * request comes in. When provided, this wins over the static `shouldHandleError`.\n */\n resolveShouldHandleError?: (context: Context) => SentryHonoMiddlewareOptions['shouldHandleError'];\n}\n\n/**\n * The object that carries the per-request dedup/config markers.\n *\n * Prefer the per-request isolation scope over the Hono `Context`, so the request is treated as one\n * even when several Sentry middlewares run for it:\n * - a mounted sub-app that carries its own auto-registered middleware (same context, same scope),\n * - an internal `app.request()` dispatch, which runs in a *new* Hono context but the *same*\n * isolation scope (so it must not re-record the transaction name or overwrite the request data),\n * - a manual `sentry()` middleware registered alongside the auto-instrumentation.\n *\n * When there is no per-request isolation scope (the default scope), fall back to the context so that\n * at least same-context duplicates are still deduplicated.\n */\nfunction getRequestScope(context: Context): Record<PropertyKey, unknown> {\n const isolationScope = getIsolationScope();\n const target: object = isolationScope === getDefaultIsolationScope() ? context : isolationScope;\n return target as Record<PropertyKey, unknown>;\n}\n\n/**\n * Builds the core Sentry request/response Hono middleware: it names the transaction, records the\n * request, and captures unhandled context errors around `next()`.\n *\n * Idempotent per request (see {@link getRequestScope}), so duplicate registrations — a manual\n * `sentry()` alongside the auto-instrumentation, mounted sub-apps, internal `.request()` dispatches —\n * are all safe and run the handling exactly once.\n *\n * A user-provided `shouldHandleError` still takes effect even when the middleware carrying it is\n * deduplicated behind the auto-instrumentation (which is prepended first, per request, from the\n * `Context` constructor hook): the deduplicated middleware records its callback on the request scope, and the\n * middleware that actually runs `responseHandler` uses it in preference to its own default.\n */\nexport function createHonoRequestMiddleware(options: CreateHonoRequestMiddlewareOptions = {}): MiddlewareHandler {\n const middleware: MiddlewareHandler = async (context, next) => {\n const scope = getRequestScope(context);\n\n const shouldHandleError = options.resolveShouldHandleError\n ? options.resolveShouldHandleError(context)\n : options.shouldHandleError;\n // Record a user-provided callback so it wins even if this middleware is deduplicated. Runs before\n // the dedup check so a later manual `sentry({ shouldHandleError })` overrides the auto default.\n if (shouldHandleError) {\n addNonEnumerableProperty(scope, HONO_SHOULD_HANDLE_ERROR, shouldHandleError);\n }\n\n if (scope[HONO_REQUEST_HANDLED]) {\n await next();\n // A deduplicated middleware still reports errors from its own context — e.g. an inner\n // `.request()` whose route threw but whose failed response the outer handler swallowed, so the\n // outer context never sees the error. Route naming and request data stay owned by the request\n // that ran first, so only the error is captured here.\n const dedupShouldHandleError =\n (scope[HONO_SHOULD_HANDLE_ERROR] as SentryHonoMiddlewareOptions['shouldHandleError']) ?? shouldHandleError;\n captureContextError(context, dedupShouldHandleError);\n return;\n }\n addNonEnumerableProperty(scope, HONO_REQUEST_HANDLED, true);\n\n try {\n requestHandler(context, options.getConnInfo);\n\n await next(); // Handler runs in between Request above ⤴ and Response below ⤵\n\n const effectiveShouldHandleError =\n (scope[HONO_SHOULD_HANDLE_ERROR] as SentryHonoMiddlewareOptions['shouldHandleError']) ?? shouldHandleError;\n responseHandler(context, effectiveShouldHandleError);\n } finally {\n // An isolation scope that outlives the request (e.g. forked once around the whole server on a\n // runtime without per-request isolation) must not dedupe the next request against this one.\n addNonEnumerableProperty(scope, HONO_REQUEST_HANDLED, undefined);\n addNonEnumerableProperty(scope, HONO_SHOULD_HANDLE_ERROR, undefined);\n }\n };\n\n addNonEnumerableProperty(middleware, SENTRY_HONO_MIDDLEWARE, true);\n return middleware;\n}\n"],"names":["getIsolationScope","getDefaultIsolationScope","addNonEnumerableProperty","captureContextError","requestHandler","responseHandler"],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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAsB,MAAS,CAAA;AAC/D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAA,6BAAA,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAA0B,MAAS,CAAA;AAAA,CAAA,CAAA,CAAA,CACrE;AAAA,CAAA,CACF,CAAA;AAEA,CAAA,CAAAA,6BAAA,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAwB,IAAI,CAAA;AACjE,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACT;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
function defaultShouldHandleError(error) {
|
|
4
|
+
if (typeof error !== "object" || error === null) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
const status = error.status;
|
|
8
|
+
return !(typeof status === "number" && status >= 300 && status < 500);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.defaultShouldHandleError = defaultShouldHandleError;
|
|
12
|
+
//# sourceMappingURL=defaultShouldHandleError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultShouldHandleError.js","sources":["../../../../src/integrations/hono/defaultShouldHandleError.ts"],"sourcesContent":["/**\n * Default implementation of the `shouldHandleError` callback.\n *\n * Returns `true` (capture) for 5xx errors and any error without a `status` property\n *\n * Returns `false` (skip) for 3xx and 4xx errors (they still generate spans and transactions for tracing)\n *\n * Checks any error-like value that carries a numeric `status` property. This covers\n * Hono's `HTTPException`, third-party middleware errors, and custom error subclasses.\n */\nexport function defaultShouldHandleError(error: unknown): boolean {\n if (typeof error !== 'object' || error === null) {\n return true;\n }\n\n const status = (error as { status?: unknown }).status;\n\n return !(typeof status === 'number' && status >= 300 && status < 500);\n}\n"],"names":[],"mappings":";;AAUO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB;AAChE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,QAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM;AAC/C,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,IAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAE/C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,GAAA,CAAA;AACnE;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
function hasFetchEvent(c) {
|
|
4
|
+
let hasFetchEvent2 = true;
|
|
5
|
+
try {
|
|
6
|
+
c.event;
|
|
7
|
+
} catch {
|
|
8
|
+
hasFetchEvent2 = false;
|
|
9
|
+
}
|
|
10
|
+
return hasFetchEvent2;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.hasFetchEvent = hasFetchEvent;
|
|
14
|
+
//# sourceMappingURL=hono-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono-context.js","sources":["../../../../src/integrations/hono/hono-context.ts"],"sourcesContent":["import type { Context } from './honoTypes';\n\n/**\n * Checks whether the given Hono context has a fetch event.\n */\nexport function hasFetchEvent(c: Context): boolean {\n let hasFetchEvent = true;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n c.event;\n } catch {\n hasFetchEvent = false;\n }\n return hasFetchEvent;\n}\n"],"names":["hasFetchEvent"],"mappings":";;AAKO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAc,CAAA,CAAA,CAAqB;AACjD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAIA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAgB,CAAA,CAAA,CAAA,CAAA;AACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI;AAEF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ;AACN,CAAA,CAAA,CAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAgB,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAClB;AACA,CAAA,CAAA,OAAOA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AACT;;"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('../../utils/diagnosticsChannel.js');
|
|
4
|
+
const node_module = require('node:module');
|
|
5
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
+
const op = require('@sentry/conventions/op');
|
|
7
|
+
const core = require('@sentry/core');
|
|
8
|
+
const debugBuild = require('../../debug-build.js');
|
|
9
|
+
const channels = require('../../orchestrion/channels.js');
|
|
10
|
+
const hono = require('../../orchestrion/config/hono.js');
|
|
11
|
+
const instrumentation = require('../../orchestrion/instrumentation.js');
|
|
12
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
13
|
+
const applyPatches = require('./applyPatches.js');
|
|
14
|
+
const constants = require('./constants.js');
|
|
15
|
+
const createHonoMiddleware = require('./createHonoMiddleware.js');
|
|
16
|
+
const isMiddleware = require('./isMiddleware.js');
|
|
17
|
+
const patchAppRequest = require('./patchAppRequest.js');
|
|
18
|
+
const wrapMiddlewareSpan = require('./wrapMiddlewareSpan.js');
|
|
19
|
+
|
|
20
|
+
const INTEGRATION_NAME = "Hono";
|
|
21
|
+
const globalAny = globalThis;
|
|
22
|
+
const isBun = typeof globalAny.Bun !== "undefined";
|
|
23
|
+
const isDeno = typeof globalAny.Deno !== "undefined";
|
|
24
|
+
const isCloudflare = globalAny.navigator?.userAgent === "Cloudflare-Workers";
|
|
25
|
+
let connInfoResolved = false;
|
|
26
|
+
let cachedGetConnInfo;
|
|
27
|
+
function resolveGetConnInfo() {
|
|
28
|
+
if (connInfoResolved) {
|
|
29
|
+
return cachedGetConnInfo;
|
|
30
|
+
}
|
|
31
|
+
connInfoResolved = true;
|
|
32
|
+
const specifier = isBun ? "hono/bun" : isDeno ? "hono/deno" : isCloudflare ? void 0 : "@hono/node-server/conninfo";
|
|
33
|
+
if (!specifier) {
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const appRequire = node_module.createRequire(`${process.cwd()}/noop.js`);
|
|
38
|
+
cachedGetConnInfo = appRequire(specifier).getConnInfo;
|
|
39
|
+
} catch {
|
|
40
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[instrumentation:hono] could not resolve \`getConnInfo\` from "${specifier}"`);
|
|
41
|
+
cachedGetConnInfo = void 0;
|
|
42
|
+
}
|
|
43
|
+
return cachedGetConnInfo;
|
|
44
|
+
}
|
|
45
|
+
function honoMiddleware(app, options = {}) {
|
|
46
|
+
applyPatches.applyPatches(app);
|
|
47
|
+
return createHonoMiddleware.createHonoRequestMiddleware({
|
|
48
|
+
getConnInfo: resolveGetConnInfo(),
|
|
49
|
+
shouldHandleError: options.shouldHandleError
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function injectHonoInstrumentation(message, requestMiddleware, injectedHandlerLists) {
|
|
53
|
+
const ctorOptions = message.arguments?.[1];
|
|
54
|
+
const handlers = ctorOptions?.matchResult?.[0];
|
|
55
|
+
if (!Array.isArray(handlers) || injectedHandlerLists.has(handlers)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
injectedHandlerLists.add(handlers);
|
|
59
|
+
const lastIndexByKey = /* @__PURE__ */ new Map();
|
|
60
|
+
for (const [i, entry] of handlers.entries()) {
|
|
61
|
+
const routeMeta2 = entry?.[0]?.[1];
|
|
62
|
+
if (routeMeta2?.method != null && routeMeta2.path != null) {
|
|
63
|
+
lastIndexByKey.set(`${routeMeta2.method}\0${routeMeta2.path}`, i);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const [i, entry] of handlers.entries()) {
|
|
67
|
+
const pair = entry?.[0];
|
|
68
|
+
const handler = pair?.[0];
|
|
69
|
+
if (typeof handler !== "function") {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const routeMeta2 = pair?.[1];
|
|
73
|
+
const isMW = routeMeta2?.method != null && routeMeta2.path != null ? lastIndexByKey.get(`${routeMeta2.method}\0${routeMeta2.path}`) !== i || routeMeta2.method === "ALL" && isMiddleware.isMiddleware(handler) : isMiddleware.isMiddleware(handler);
|
|
74
|
+
if (isMW) {
|
|
75
|
+
pair[0] = wrapMiddlewareSpan.wrapMiddlewareWithSpan(handler);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const routeMeta = { basePath: "/", path: "/*", method: "ALL", handler: requestMiddleware };
|
|
79
|
+
handlers.unshift([[requestMiddleware, routeMeta], {}]);
|
|
80
|
+
}
|
|
81
|
+
function instrumentInternalRequests() {
|
|
82
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
83
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.HONO_REQUEST),
|
|
84
|
+
(data) => {
|
|
85
|
+
if (patchAppRequest.isInternalRequestSpanActive()) {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
const [input, requestInit] = data.arguments;
|
|
89
|
+
const method = (requestInit?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
|
90
|
+
return core.startInactiveSpan({
|
|
91
|
+
name: `${method} ${patchAppRequest.extractPathname(input)}`,
|
|
92
|
+
attributes: {
|
|
93
|
+
[attributes.SENTRY_OP]: op.HTTP_SERVER,
|
|
94
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: constants.INTERNAL_REQUEST_ORIGIN
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
{ requiresParentSpan: true }
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function instrumentHono(options) {
|
|
102
|
+
const injectedHandlerLists = /* @__PURE__ */ new WeakSet();
|
|
103
|
+
const requestMiddleware = createHonoMiddleware.createHonoRequestMiddleware({
|
|
104
|
+
getConnInfo: resolveGetConnInfo(),
|
|
105
|
+
shouldHandleError: options.shouldHandleError
|
|
106
|
+
});
|
|
107
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.HONO_CONTEXT).end.subscribe((message) => {
|
|
108
|
+
tracingChannel.safeChannelCallback(
|
|
109
|
+
() => injectHonoInstrumentation(message, requestMiddleware, injectedHandlerLists)
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
instrumentInternalRequests();
|
|
113
|
+
}
|
|
114
|
+
const _honoIntegration = ((options = {}) => {
|
|
115
|
+
return {
|
|
116
|
+
name: INTEGRATION_NAME,
|
|
117
|
+
setup(client) {
|
|
118
|
+
instrumentation.invokeOrchestrionInstrumentation(client, hono.honoModuleNames, instrumentHono, [options]);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
const honoIntegration = core.defineIntegration(_honoIntegration);
|
|
123
|
+
|
|
124
|
+
exports.honoIntegration = honoIntegration;
|
|
125
|
+
exports.honoMiddleware = honoMiddleware;
|
|
126
|
+
//# sourceMappingURL=honoIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"honoIntegration.js","sources":["../../../../src/integrations/hono/honoIntegration.ts"],"sourcesContent":["import * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport { createRequire } from 'node:module';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\nimport { HTTP_SERVER } from '@sentry/conventions/op';\nimport type { IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { Env, GetConnInfo, Hono, MiddlewareHandler } from './honoTypes';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { honoModuleNames } from '../../orchestrion/config/hono';\nimport { invokeOrchestrionInstrumentation } from '../../orchestrion/instrumentation';\nimport { bindTracingChannelToSpan, safeChannelCallback } from '../../tracing-channel';\nimport { applyPatches } from './applyPatches';\nimport { INTERNAL_REQUEST_ORIGIN } from './constants';\nimport { createHonoRequestMiddleware } from './createHonoMiddleware';\nimport { isMiddleware } from './isMiddleware';\nimport { extractPathname, isInternalRequestSpanActive } from './patchAppRequest';\nimport { wrapMiddlewareWithSpan } from './wrapMiddlewareSpan';\nimport type { SentryHonoMiddlewareOptions } from './types';\n\n// Matches the `@sentry/hono` SDK's integration name, so the SDK filters its own out of the\n// forwarded defaults and the two never stack.\nconst INTEGRATION_NAME = 'Hono' as const;\n\nexport interface HonoIntegrationOptions extends SentryHonoMiddlewareOptions {}\n\nconst globalAny = globalThis as { Bun?: unknown; Deno?: unknown; navigator?: { userAgent?: string } };\nconst isBun = typeof globalAny.Bun !== 'undefined';\nconst isDeno = typeof globalAny.Deno !== 'undefined';\nconst isCloudflare = globalAny.navigator?.userAgent === 'Cloudflare-Workers';\n\nlet connInfoResolved = false;\nlet cachedGetConnInfo: GetConnInfo | undefined;\n\n/**\n * Resolves the runtime's `getConnInfo` helper once, best-effort.\n *\n * Cloudflare Workers can't `require()` out of a bundle at runtime, so there conn-info is left to the\n * platform's `requestDataIntegration`. On Node/Bun/Deno a missing optional peer dependency degrades\n * to `undefined`, which just skips the connection-info attributes.\n */\nfunction resolveGetConnInfo(): GetConnInfo | undefined {\n if (connInfoResolved) {\n return cachedGetConnInfo;\n }\n connInfoResolved = true;\n\n const specifier = isBun ? 'hono/bun' : isDeno ? 'hono/deno' : isCloudflare ? undefined : '@hono/node-server/conninfo';\n\n if (!specifier) {\n return undefined;\n }\n\n try {\n // `createRequire` resolves relative to its argument's directory, so a never-loaded dummy path\n // roots resolution at the app directory, where the runtime helper is installed.\n const appRequire = createRequire(`${process.cwd()}/noop.js`);\n cachedGetConnInfo = (appRequire(specifier) as { getConnInfo?: GetConnInfo }).getConnInfo;\n } catch {\n DEBUG_BUILD && debug.log(`[instrumentation:hono] could not resolve \\`getConnInfo\\` from \"${specifier}\"`);\n cachedGetConnInfo = undefined;\n }\n\n return cachedGetConnInfo;\n}\n\n/**\n * Manually instruments a Hono app and returns the Sentry request/response middleware to register\n * first: `app.use(honoMiddleware(app))`.\n *\n * Only needed when neither the Sentry runtime hook nor the bundler plugin is active — otherwise\n * {@link honoIntegration} does this automatically. Safe to combine with the automatic instrumentation\n * (request handling is deduplicated per request, `applyPatches` is idempotent). `Sentry.init(...)`\n * must still be called separately.\n */\nexport function honoMiddleware<E extends Env>(app: Hono<E>, options: HonoIntegrationOptions = {}): MiddlewareHandler {\n applyPatches(app);\n\n return createHonoRequestMiddleware({\n getConnInfo: resolveGetConnInfo(),\n shouldHandleError: options.shouldHandleError,\n });\n}\n\ntype ChannelArgs = { arguments: unknown[] };\n\n// A Hono `matchResult[0]` entry: `[[handler, routeMeta], paramIndexMap]` — `compose` runs the\n// handler (`entry[0][0]`) and the `matchedRoutes` getter reads `routeMeta` (`entry[0][1]`).\n// oxlint-disable-next-line typescript/no-explicit-any\ntype MatchedHandlerEntry = [[any, any], any];\n\n/**\n * Per-request Context hook. `#dispatch` builds `new Context(req, { matchResult })` before its\n * single-handler fast-path check, so from the live `matchResult` we:\n * 1. wrap the matched middleware handlers for spans (route handlers are covered by the request span);\n * 2. prepend the Sentry request/response middleware — it drives route naming, request data and error\n * capture from inside the chain, and forces the ≥2-handler `compose` path so the fast-path is\n * never taken.\n *\n * Running per request (no module-scope state) is what lets this work on Cloudflare.\n */\nfunction injectHonoInstrumentation(\n message: ChannelArgs,\n requestMiddleware: MiddlewareHandler,\n injectedHandlerLists: WeakSet<object>,\n): void {\n const ctorOptions = message.arguments?.[1] as { matchResult?: [MatchedHandlerEntry[], unknown] } | undefined;\n const handlers = ctorOptions?.matchResult?.[0];\n if (!Array.isArray(handlers) || injectedHandlerLists.has(handlers)) {\n return;\n }\n injectedHandlerLists.add(handlers);\n\n // Classify matched handlers with the same positional heuristic as `wrapSubAppMiddleware`: within a\n // method+path group the last handler is the route handler and earlier ones are middleware; `.use()`\n // registers as method 'ALL' with a lone genuine-middleware entry, so fall back to arity there.\n // Position is needed because a route handler declared with an unused `next` param has middleware arity.\n const lastIndexByKey = new Map<string, number>();\n for (const [i, entry] of handlers.entries()) {\n const routeMeta = entry?.[0]?.[1] as { method?: string; path?: string } | undefined;\n if (routeMeta?.method != null && routeMeta.path != null) {\n // \\0 is a collision-free delimiter: it cannot appear in a valid HTTP method or URL path.\n lastIndexByKey.set(`${routeMeta.method}\\0${routeMeta.path}`, i);\n }\n }\n\n for (const [i, entry] of handlers.entries()) {\n const pair = entry?.[0];\n const handler = pair?.[0];\n if (typeof handler !== 'function') {\n continue;\n }\n\n const routeMeta = pair?.[1] as { method?: string; path?: string } | undefined;\n const isMW =\n routeMeta?.method != null && routeMeta.path != null\n ? lastIndexByKey.get(`${routeMeta.method}\\0${routeMeta.path}`) !== i ||\n (routeMeta.method === 'ALL' && isMiddleware(handler))\n : isMiddleware(handler);\n\n if (isMW) {\n pair[0] = wrapMiddlewareWithSpan(handler as MiddlewareHandler);\n }\n }\n\n // Prepend the Sentry request/response middleware. `routeMeta` is what the `matchedRoutes` getter\n // exposes; its middleware arity keeps route-name resolution from picking it.\n const routeMeta = { basePath: '/', path: '/*', method: 'ALL', handler: requestMiddleware };\n handlers.unshift([[requestMiddleware, routeMeta], {}]);\n}\n\n/**\n * Traces Hono's internal `app.request(...)` dispatches (sub-app-to-sub-app fetches) as `http.server`\n * child spans, but only when there is a parent span (so a top-level `.request()` is not traced).\n */\nfunction instrumentInternalRequests(): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<ChannelArgs>(CHANNELS.HONO_REQUEST),\n data => {\n // Alongside the manual middleware, the instance `app.request` Proxy has already opened this\n // span and is calling through — returning `undefined` (no span) avoids nesting a duplicate.\n if (isInternalRequestSpanActive()) {\n return undefined;\n }\n\n const [input, requestInit] = data.arguments;\n const method = (\n (requestInit as RequestInit | undefined)?.method ?? (input instanceof Request ? input.method : 'GET')\n ).toUpperCase();\n return startInactiveSpan({\n name: `${method} ${extractPathname(input)}`,\n attributes: {\n [SENTRY_OP]: HTTP_SERVER,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN,\n },\n });\n },\n { requiresParentSpan: true },\n );\n}\n\n/**\n * Wires the per-request Hono hooks (Context constructor + internal `app.request`) to the diagnostics\n * channel.\n *\n * Note:\n * Because the Sentry request/response middleware is prepended into the matched-handler list (`matchResult[0]`),\n * it also shows up in `c.req.matchedRoutes` — apps that inspect `matchedRoutes`\n * will see an extra `ALL /*` entry (the Sentry middleware) that they did not register themselves.\n */\nfunction instrumentHono(options: HonoIntegrationOptions): void {\n // `router.match` may hand back a cached handler array for a route, so track the lists we've already\n // prepended into and never inject the Sentry middleware twice.\n const injectedHandlerLists = new WeakSet<object>();\n\n // The request/response middleware is stateless (per-request state lives on the request scope) and\n // `options` is fixed, so build it once and reuse it across every dispatched Context.\n const requestMiddleware = createHonoRequestMiddleware({\n getConnInfo: resolveGetConnInfo(),\n shouldHandleError: options.shouldHandleError,\n });\n\n // The Context constructor's `end` fires synchronously inside `new Context()`, before `#dispatch`\n // reads `matchResult[0].length`, so the injected middleware is in place for the same request.\n diagnosticsChannel.tracingChannel<ChannelArgs>(CHANNELS.HONO_CONTEXT).end.subscribe(message => {\n safeChannelCallback(() =>\n injectHonoInstrumentation(message as ChannelArgs, requestMiddleware, injectedHandlerLists),\n );\n });\n\n instrumentInternalRequests();\n}\n\nconst _honoIntegration = ((options: HonoIntegrationOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n invokeOrchestrionInstrumentation(client, honoModuleNames, instrumentHono, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Automatically instruments Hono applications for Sentry tracing.\n *\n * Hooks Hono's per-request internals (the `Context` constructor and `app.request`) via the\n * orchestrion diagnostics channel — so instrumentation happens per request, never at module scope,\n * which is what lets it work on Cloudflare Workers with no manual middleware. Enabled by default in\n * the Node, Bun, Deno and Cloudflare SDKs; requires the Sentry runtime hook or bundler plugin.\n *\n * Registering `@sentry/hono`'s `sentry()` middleware manually alongside it is safe — request handling\n * is deduplicated per request.\n */\nexport const honoIntegration = defineIntegration(_honoIntegration);\n"],"names":["createRequire","DEBUG_BUILD","debug","applyPatches","createHonoRequestMiddleware","routeMeta","isMiddleware","wrapMiddlewareWithSpan","bindTracingChannelToSpan","diagnosticsChannel.tracingChannel","CHANNELS","isInternalRequestSpanActive","startInactiveSpan","extractPathname","SENTRY_OP","HTTP_SERVER","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","INTERNAL_REQUEST_ORIGIN","safeChannelCallback","invokeOrchestrionInstrumentation","honoModuleNames","defineIntegration"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAIzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAClB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,KAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CA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,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAA;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
4
|
+
function isMiddleware(handler) {
|
|
5
|
+
if (typeof handler !== "function") {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const composed = handler[COMPOSED_HANDLER];
|
|
9
|
+
const original = typeof composed === "function" ? composed : handler;
|
|
10
|
+
return original.length >= 2;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.isMiddleware = isMiddleware;
|
|
14
|
+
//# sourceMappingURL=isMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMiddleware.js","sources":["../../../../src/integrations/hono/isMiddleware.ts"],"sourcesContent":["// Hono stores the original (unwrapped) handler under this key when it wraps a sub-app's handlers\n// for a custom `onError`. Unwrapping it lets us inspect the real handler instead of the wrapper.\n// See https://github.com/honojs/hono/blob/9f0dadf141a3242a6c3b77462c7d33c6ce0f599d/src/hono-base.ts#L224-L226\nconst COMPOSED_HANDLER = '__COMPOSED_HANDLER';\n\n/**\n * Infers whether a Hono route entry is a middleware (rather than a route handler).\n *\n * Hono has no \"isMiddleware\" flag, so we rely on arity: middleware is `(context, next)` (arity >= 2)\n * while route handlers are `(context)` (arity < 2). `onError`-wrapped sub-app handlers are unwrapped\n * first so we check the original handler's arity, not the wrapper's `(c, next)` signature.\n * https://github.com/honojs/hono/blob/97c6fe1f12298c715eb7b2da65b4b6e0d81682bb/src/utils/handler.ts#L8\n *\n * This is only one signal — callers that must classify inline middleware sharing a method+path with\n * their handler (e.g. `wrapSubAppMiddleware`) additionally need positional information.\n */\nexport function isMiddleware(handler: unknown): boolean {\n if (typeof handler !== 'function') {\n return false;\n }\n\n const composed = (handler as unknown as Record<string, unknown>)[COMPOSED_HANDLER];\n const original = typeof composed === 'function' ? composed : handler;\n\n return (original as (...args: unknown[]) => unknown).length >= 2;\n}\n"],"names":[],"mappings":";;AAGA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAalB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B;AACtD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAY,UAAA,CAAA,CAAY;AACjC,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT;AAEA,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAA+C,gBAAgB,CAAA;AACjF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAE7D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAA6C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAU,CAAA;AACjE;;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const honoContext = require('./hono-context.js');
|
|
5
|
+
const defaultShouldHandleError = require('./defaultShouldHandleError.js');
|
|
6
|
+
const resolveRouteName = require('./resolveRouteName.js');
|
|
7
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
8
|
+
|
|
9
|
+
function requestHandler(context, getConnInfo) {
|
|
10
|
+
const isolationScope = getCurrentIsolationScope();
|
|
11
|
+
updateSpanRouteName(isolationScope, context);
|
|
12
|
+
isolationScope.setSDKProcessingMetadata({
|
|
13
|
+
normalizedRequest: core.winterCGRequestToRequestData(honoContext.hasFetchEvent(context) ? context.event.request : context.req.raw)
|
|
14
|
+
});
|
|
15
|
+
if (getConnInfo) {
|
|
16
|
+
setConnInfoAttributes(context, getConnInfo, isolationScope);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getCurrentIsolationScope() {
|
|
20
|
+
const defaultScope = core.getDefaultIsolationScope();
|
|
21
|
+
const currentIsolationScope = core.getIsolationScope();
|
|
22
|
+
return defaultScope === currentIsolationScope ? defaultScope : currentIsolationScope;
|
|
23
|
+
}
|
|
24
|
+
function setConnInfoAttributes(context, getConnInfo, isolationScope) {
|
|
25
|
+
const activeSpan = core.getActiveSpan();
|
|
26
|
+
if (!activeSpan) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let remote;
|
|
30
|
+
try {
|
|
31
|
+
remote = getConnInfo(context).remote;
|
|
32
|
+
} catch {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const { address, port, transport, addressType } = remote || {};
|
|
36
|
+
const ipAddress = address && core.getClient()?.getDataCollectionOptions().userInfo ? address : void 0;
|
|
37
|
+
core.getRootSpan(activeSpan).setAttributes({
|
|
38
|
+
"client.port": port,
|
|
39
|
+
"network.peer.port": port,
|
|
40
|
+
"network.transport": transport,
|
|
41
|
+
"network.type": addressType?.toLowerCase(),
|
|
42
|
+
"client.address": ipAddress,
|
|
43
|
+
"network.peer.address": ipAddress
|
|
44
|
+
});
|
|
45
|
+
if (ipAddress) {
|
|
46
|
+
isolationScope.setUser({ ...isolationScope.getUser(), ip_address: ipAddress });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function responseHandler(context, shouldHandleError) {
|
|
50
|
+
updateSpanRouteName(getCurrentIsolationScope(), context);
|
|
51
|
+
captureContextError(context, shouldHandleError);
|
|
52
|
+
}
|
|
53
|
+
function captureContextError(context, shouldHandleError) {
|
|
54
|
+
if (context.error) {
|
|
55
|
+
if ((shouldHandleError ?? defaultShouldHandleError.defaultShouldHandleError)(context.error)) {
|
|
56
|
+
core.captureException(context.error, {
|
|
57
|
+
mechanism: { handled: false, type: "auto.http.hono.context_error" }
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function updateSpanRouteName(isolationScope, context) {
|
|
63
|
+
const route = resolveRouteName.resolveRouteName(context);
|
|
64
|
+
const routeName = `${context.req.method} ${route}`;
|
|
65
|
+
const activeSpan = core.getActiveSpan();
|
|
66
|
+
if (activeSpan) {
|
|
67
|
+
activeSpan.updateName(routeName);
|
|
68
|
+
const rootSpan = core.getRootSpan(activeSpan);
|
|
69
|
+
core.updateSpanName(rootSpan, routeName);
|
|
70
|
+
core.INTERNAL_setSegmentNameSourceIfSegment(rootSpan, "route");
|
|
71
|
+
rootSpan.setAttribute(attributes.HTTP_ROUTE, route);
|
|
72
|
+
}
|
|
73
|
+
isolationScope.setTransactionName(routeName);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
exports.captureContextError = captureContextError;
|
|
77
|
+
exports.requestHandler = requestHandler;
|
|
78
|
+
exports.responseHandler = responseHandler;
|
|
79
|
+
//# sourceMappingURL=middlewareHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middlewareHandlers.js","sources":["../../../../src/integrations/hono/middlewareHandlers.ts"],"sourcesContent":["import {\n captureException,\n getActiveSpan,\n getClient,\n getDefaultIsolationScope,\n getIsolationScope,\n getRootSpan,\n INTERNAL_setSegmentNameSourceIfSegment,\n updateSpanName,\n type Scope,\n winterCGRequestToRequestData,\n} from '@sentry/core';\nimport type { Context, GetConnInfo } from './honoTypes';\nimport { hasFetchEvent } from './hono-context';\nimport { defaultShouldHandleError } from './defaultShouldHandleError';\nimport { resolveRouteName } from './resolveRouteName';\nimport { type SentryHonoMiddlewareOptions } from './types';\nimport { HTTP_ROUTE } from '@sentry/conventions/attributes';\n\n/**\n * Request handler for Hono framework\n */\nexport function requestHandler(context: Context, getConnInfo?: GetConnInfo): void {\n const isolationScope = getCurrentIsolationScope();\n\n // Set a provisional route name as early as possible so events captured during the request already carry the route.\n // It is re-resolved in `responseHandler` once the middleware chain has run.\n updateSpanRouteName(isolationScope, context);\n\n isolationScope.setSDKProcessingMetadata({\n normalizedRequest: winterCGRequestToRequestData(hasFetchEvent(context) ? context.event.request : context.req.raw),\n });\n\n if (getConnInfo) {\n setConnInfoAttributes(context, getConnInfo, isolationScope);\n }\n}\n\nfunction getCurrentIsolationScope(): Scope {\n const defaultScope = getDefaultIsolationScope();\n const currentIsolationScope = getIsolationScope();\n\n return defaultScope === currentIsolationScope ? defaultScope : currentIsolationScope;\n}\n\n/**\n * Adds HTTP connection info (client IP, port, transport, address type) from Hono's `getConnInfo`\n * helper to the root (server) span and the isolation scope.\n */\nfunction setConnInfoAttributes(context: Context, getConnInfo: GetConnInfo, isolationScope: Scope): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n let remote: ReturnType<GetConnInfo>['remote'] | undefined;\n try {\n remote = getConnInfo(context).remote;\n } catch {\n // The helper can throw when the underlying socket/env is unavailable (e.g. unsupported runtime).\n return;\n }\n\n const { address, port, transport, addressType } = remote || {};\n\n // Only collect client IP if `userInfo` is enabled (this is primarily for setting data with `.setUser`, but in this case we cannot check for `dataCollection.headers` or similar)\n const ipAddress = address && getClient()?.getDataCollectionOptions().userInfo ? address : undefined;\n\n getRootSpan(activeSpan).setAttributes({\n 'client.port': port,\n 'network.peer.port': port,\n 'network.transport': transport,\n 'network.type': addressType?.toLowerCase(),\n 'client.address': ipAddress,\n 'network.peer.address': ipAddress,\n });\n\n if (ipAddress) {\n isolationScope.setUser({ ...isolationScope.getUser(), ip_address: ipAddress });\n }\n}\n\n/**\n * Response handler for Hono framework\n */\nexport function responseHandler(\n context: Context,\n shouldHandleError?: SentryHonoMiddlewareOptions['shouldHandleError'],\n): void {\n // Overwrite the route name now that the middleware chain has run: `routeIndex` is accurate here\n updateSpanRouteName(getCurrentIsolationScope(), context);\n\n captureContextError(context, shouldHandleError);\n}\n\n/**\n * Captures an unhandled context error, gated by the user's `shouldHandleError` (or the default).\n *\n * Split out from {@link responseHandler} so a deduplicated middleware can still report its own\n * context's error without re-resolving the route name or overwriting request data — e.g. the inner\n * context of an internal `.request()` whose route threw but whose failed response the outer handler\n * swallowed.\n */\nexport function captureContextError(\n context: Context,\n shouldHandleError?: SentryHonoMiddlewareOptions['shouldHandleError'],\n): void {\n if (context.error) {\n if ((shouldHandleError ?? defaultShouldHandleError)(context.error)) {\n captureException(context.error, {\n mechanism: { handled: false, type: 'auto.http.hono.context_error' },\n });\n }\n }\n}\n\nfunction updateSpanRouteName(isolationScope: Scope, context: Context): void {\n const route = resolveRouteName(context);\n const routeName = `${context.req.method} ${route}`;\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n activeSpan.updateName(routeName);\n\n const rootSpan = getRootSpan(activeSpan);\n updateSpanName(rootSpan, routeName);\n INTERNAL_setSegmentNameSourceIfSegment(rootSpan, 'route');\n rootSpan.setAttribute(HTTP_ROUTE, route);\n }\n\n isolationScope.setTransactionName(routeName);\n}\n"],"names":["winterCGRequestToRequestData","hasFetchEvent","getDefaultIsolationScope","getIsolationScope","getActiveSpan","getClient","getRootSpan","defaultShouldHandleError","captureException","resolveRouteName","updateSpanName","INTERNAL_setSegmentNameSourceIfSegment","HTTP_ROUTE"],"mappings":";;;;;;;;AAsBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAkB,WAAA,CAAA,CAAiC;AAChF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB;AAIhD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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AAK,CAAA;AAAA,CAAA,CACzC;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAmB,SAAS,CAAA;AAC7C;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
4
|
+
const op = require('@sentry/conventions/op');
|
|
5
|
+
const core = require('@sentry/core');
|
|
6
|
+
const constants = require('./constants.js');
|
|
7
|
+
const debugBuild = require('../../debug-build.js');
|
|
8
|
+
|
|
9
|
+
const INTERNAL_REQUEST_OP = op.HTTP_SERVER;
|
|
10
|
+
const INTERNAL_REQUEST_SPAN_ACTIVE = /* @__PURE__ */ Symbol.for("sentry.hono.internalRequestSpanActive");
|
|
11
|
+
function isInternalRequestSpanActive() {
|
|
12
|
+
return !!globalThis[INTERNAL_REQUEST_SPAN_ACTIVE];
|
|
13
|
+
}
|
|
14
|
+
function setInternalRequestSpanActive(active) {
|
|
15
|
+
globalThis[INTERNAL_REQUEST_SPAN_ACTIVE] = active;
|
|
16
|
+
}
|
|
17
|
+
function stripQueryAndHash(path) {
|
|
18
|
+
const end = path.search(/[?#]/);
|
|
19
|
+
return end === -1 ? path : path.slice(0, end);
|
|
20
|
+
}
|
|
21
|
+
function extractPathname(input) {
|
|
22
|
+
if (typeof input === "string") {
|
|
23
|
+
try {
|
|
24
|
+
const url = /^https?:\/\//.test(input) ? new URL(input) : new URL(`http://localhost${input.startsWith("/") ? "" : "/"}${input}`);
|
|
25
|
+
return url.pathname;
|
|
26
|
+
} catch {
|
|
27
|
+
return stripQueryAndHash(input);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (input instanceof Request) {
|
|
31
|
+
return new URL(input.url).pathname;
|
|
32
|
+
}
|
|
33
|
+
return input instanceof URL ? input.pathname : "/";
|
|
34
|
+
}
|
|
35
|
+
function patchAppRequest(app) {
|
|
36
|
+
if (core.getOriginalFunction(app.request)) {
|
|
37
|
+
debugBuild.DEBUG_BUILD && core.debug.log("[hono] app.request already patched \u2014 skipping.");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const originalRequest = app.request;
|
|
41
|
+
app.request = new Proxy(originalRequest, {
|
|
42
|
+
apply(_target, thisArg, args) {
|
|
43
|
+
const [input, requestInit, ...rest] = args;
|
|
44
|
+
if (!core.getActiveSpan()) {
|
|
45
|
+
return Reflect.apply(_target, thisArg, args);
|
|
46
|
+
}
|
|
47
|
+
let method = requestInit?.method ?? (input instanceof Request ? input.method : "GET");
|
|
48
|
+
method = method.toUpperCase();
|
|
49
|
+
const path = extractPathname(input);
|
|
50
|
+
return core.startSpan(
|
|
51
|
+
{
|
|
52
|
+
name: `${method} ${path}`,
|
|
53
|
+
onlyIfParent: true,
|
|
54
|
+
attributes: {
|
|
55
|
+
[attributes.SENTRY_OP]: INTERNAL_REQUEST_OP,
|
|
56
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: constants.INTERNAL_REQUEST_ORIGIN
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
() => {
|
|
60
|
+
setInternalRequestSpanActive(true);
|
|
61
|
+
try {
|
|
62
|
+
return Reflect.apply(_target, thisArg, [input, requestInit, ...rest]);
|
|
63
|
+
} finally {
|
|
64
|
+
setInternalRequestSpanActive(false);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
get(target, prop, receiver) {
|
|
70
|
+
if (prop === "__sentry_original__") {
|
|
71
|
+
return originalRequest;
|
|
72
|
+
}
|
|
73
|
+
return Reflect.get(target, prop, receiver);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
debugBuild.DEBUG_BUILD && core.debug.log("[hono] Patched app.request for internal dispatch tracing.");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.extractPathname = extractPathname;
|
|
80
|
+
exports.isInternalRequestSpanActive = isInternalRequestSpanActive;
|
|
81
|
+
exports.patchAppRequest = patchAppRequest;
|
|
82
|
+
//# sourceMappingURL=patchAppRequest.js.map
|