@sentry/server-utils 10.62.0 → 10.64.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/cjs/index.js +10 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/anthropic.js +101 -0
- package/build/cjs/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/errors.js +42 -0
- package/build/cjs/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js +34 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +279 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js +11 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi-types.js +30 -0
- package/build/cjs/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js +177 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi.js +52 -0
- package/build/cjs/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js +96 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js +31 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js +46 -83
- package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/openai.js +83 -0
- package/build/cjs/integrations/tracing-channel/openai.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/postgres.js +170 -0
- package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js +25 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/cjs/mongoose/index.js +23 -0
- package/build/cjs/mongoose/index.js.map +1 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js +97 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +3 -3
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +17 -1
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +43 -0
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/cjs/orchestrion/config/hapi.js +26 -0
- package/build/cjs/orchestrion/config/hapi.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +35 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -0
- package/build/cjs/orchestrion/config/ioredis.js +35 -0
- package/build/cjs/orchestrion/config/ioredis.js.map +1 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js +17 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/cjs/orchestrion/config/mysql.js +16 -0
- package/build/cjs/orchestrion/config/mysql.js.map +1 -0
- package/build/cjs/orchestrion/config/openai.js +40 -0
- package/build/cjs/orchestrion/config/openai.js.map +1 -0
- package/build/cjs/orchestrion/config/pg.js +51 -0
- package/build/cjs/orchestrion/config/pg.js.map +1 -0
- package/build/cjs/orchestrion/config/vercel-ai.js +44 -0
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/cjs/orchestrion/detect.js +6 -1
- package/build/cjs/orchestrion/detect.js.map +1 -1
- package/build/cjs/orchestrion/index.js +27 -3
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/orchestrion/runtime/register.js +10 -7
- package/build/cjs/orchestrion/runtime/register.js.map +1 -1
- package/build/cjs/redis/redis-statement-serializer.js +34 -0
- package/build/cjs/redis/redis-statement-serializer.js.map +1 -0
- package/build/cjs/tracing-channel.js +50 -11
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/cjs/vercel-ai/index.js +5 -3
- package/build/cjs/vercel-ai/index.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +11 -4
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +256 -0
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
- package/build/esm/index.js +3 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/anthropic.js +99 -0
- package/build/esm/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/errors.js +39 -0
- package/build/esm/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js +30 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +277 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js +8 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi-types.js +25 -0
- package/build/esm/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js +172 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi.js +50 -0
- package/build/esm/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/esm/integrations/tracing-channel/ioredis.js +94 -0
- package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js +29 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql.js +47 -84
- package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/esm/integrations/tracing-channel/openai.js +81 -0
- package/build/esm/integrations/tracing-channel/openai.js.map +1 -0
- package/build/esm/integrations/tracing-channel/postgres.js +168 -0
- package/build/esm/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js +23 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/esm/mongoose/index.js +21 -0
- package/build/esm/mongoose/index.js.map +1 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js +89 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/esm/orchestrion/bundler/vite.js +1 -1
- package/build/esm/orchestrion/channels.js +17 -1
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +40 -0
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/esm/orchestrion/config/hapi.js +23 -0
- package/build/esm/orchestrion/config/hapi.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +31 -0
- package/build/esm/orchestrion/config/index.js.map +1 -0
- package/build/esm/orchestrion/config/ioredis.js +32 -0
- package/build/esm/orchestrion/config/ioredis.js.map +1 -0
- package/build/esm/orchestrion/config/lru-memoizer.js +14 -0
- package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/esm/orchestrion/config/mysql.js +13 -0
- package/build/esm/orchestrion/config/mysql.js.map +1 -0
- package/build/esm/orchestrion/config/openai.js +37 -0
- package/build/esm/orchestrion/config/openai.js.map +1 -0
- package/build/esm/orchestrion/config/pg.js +48 -0
- package/build/esm/orchestrion/config/pg.js.map +1 -0
- package/build/esm/orchestrion/config/vercel-ai.js +41 -0
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/esm/orchestrion/detect.js +6 -2
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/orchestrion/index.js +21 -2
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/orchestrion/runtime/register.js +8 -4
- package/build/esm/orchestrion/runtime/register.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/redis/redis-statement-serializer.js +32 -0
- package/build/esm/redis/redis-statement-serializer.js.map +1 -0
- package/build/esm/tracing-channel.js +51 -12
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/vercel-ai/index.js +6 -4
- package/build/esm/vercel-ai/index.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +14 -8
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js +254 -0
- package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/anthropic.d.ts +10 -0
- package/build/types/integrations/tracing-channel/anthropic.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/errors.d.ts +12 -0
- package/build/types/integrations/tracing-channel/fastify/errors.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts +9 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi-types.d.ts +53 -0
- package/build/types/integrations/tracing-channel/hapi-types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts +17 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts +3 -1
- package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/openai.d.ts +10 -0
- package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts +15 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -0
- package/build/types/mongoose/index.d.ts +11 -0
- package/build/types/mongoose/index.d.ts.map +1 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -0
- package/build/types/orchestrion/channels.d.ts +21 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/anthropic-ai.d.ts +31 -0
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -0
- package/build/types/orchestrion/config/hapi.d.ts +17 -0
- package/build/types/orchestrion/config/hapi.d.ts.map +1 -0
- package/build/types/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
- package/build/types/orchestrion/config/index.d.ts.map +1 -0
- package/build/types/orchestrion/config/ioredis.d.ts +7 -0
- package/build/types/orchestrion/config/ioredis.d.ts.map +1 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -0
- package/build/types/orchestrion/config/mysql.d.ts +16 -0
- package/build/types/orchestrion/config/mysql.d.ts.map +1 -0
- package/build/types/orchestrion/config/openai.d.ts +20 -0
- package/build/types/orchestrion/config/openai.d.ts.map +1 -0
- package/build/types/orchestrion/config/pg.d.ts +33 -0
- package/build/types/orchestrion/config/pg.d.ts.map +1 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts +11 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -0
- package/build/types/orchestrion/detect.d.ts +10 -0
- package/build/types/orchestrion/detect.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +53 -2
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
- package/build/types/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types/redis/redis-statement-serializer.d.ts.map +1 -0
- package/build/types/tracing-channel.d.ts +22 -0
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/build/types/vercel-ai/index.d.ts +3 -1
- package/build/types/vercel-ai/index.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
- package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts.map +1 -0
- package/build/types-ts3.8/index.d.ts +4 -0
- package/build/types-ts3.8/integrations/tracing-channel/anthropic.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/errors.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi-types.d.ts +65 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +17 -0
- package/build/types-ts3.8/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql.d.ts +3 -1
- package/build/types-ts3.8/integrations/tracing-channel/openai.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/postgres.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types-ts3.8/mongoose/index.d.ts +11 -0
- package/build/types-ts3.8/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types-ts3.8/node-diagnostics-channel.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/hapi.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/{config.d.ts → config/index.d.ts} +1 -12
- package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +7 -0
- package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types-ts3.8/orchestrion/config/mysql.d.ts +16 -0
- package/build/types-ts3.8/orchestrion/config/openai.d.ts +20 -0
- package/build/types-ts3.8/orchestrion/config/pg.d.ts +33 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +11 -0
- package/build/types-ts3.8/orchestrion/detect.d.ts +10 -0
- package/build/types-ts3.8/orchestrion/index.d.ts +53 -2
- package/build/types-ts3.8/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types-ts3.8/tracing-channel.d.ts +22 -0
- package/build/types-ts3.8/vercel-ai/index.d.ts +3 -1
- package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +10 -4
- package/build/types-ts3.8/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts +12 -0
- package/package.json +10 -10
- package/build/cjs/orchestrion/config.js +0 -38
- package/build/cjs/orchestrion/config.js.map +0 -1
- package/build/esm/orchestrion/config.js +0 -34
- package/build/esm/orchestrion/config.js.map +0 -1
- package/build/types/orchestrion/config.d.ts.map +0 -1
package/build/cjs/index.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
+
const index$1 = require('./mongoose/index.js');
|
|
3
4
|
const redisDcSubscriber = require('./redis/redis-dc-subscriber.js');
|
|
5
|
+
const redisStatementSerializer = require('./redis/redis-statement-serializer.js');
|
|
4
6
|
const tracingChannel = require('./tracing-channel.js');
|
|
5
|
-
const index = require('./vercel-ai/index.js');
|
|
7
|
+
const index$2 = require('./vercel-ai/index.js');
|
|
8
|
+
const index = require('./integrations/tracing-channel/fastify/index.js');
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
|
|
12
|
+
exports.mongooseIntegration = index$1.mongooseIntegration;
|
|
9
13
|
exports.IOREDIS_DC_CHANNEL_COMMAND = redisDcSubscriber.IOREDIS_DC_CHANNEL_COMMAND;
|
|
10
14
|
exports.IOREDIS_DC_CHANNEL_CONNECT = redisDcSubscriber.IOREDIS_DC_CHANNEL_CONNECT;
|
|
11
15
|
exports.REDIS_DC_CHANNEL_BATCH = redisDcSubscriber.REDIS_DC_CHANNEL_BATCH;
|
|
12
16
|
exports.REDIS_DC_CHANNEL_COMMAND = redisDcSubscriber.REDIS_DC_CHANNEL_COMMAND;
|
|
13
17
|
exports.REDIS_DC_CHANNEL_CONNECT = redisDcSubscriber.REDIS_DC_CHANNEL_CONNECT;
|
|
14
18
|
exports.subscribeRedisDiagnosticChannels = redisDcSubscriber.subscribeRedisDiagnosticChannels;
|
|
19
|
+
exports.defaultDbStatementSerializer = redisStatementSerializer.defaultDbStatementSerializer;
|
|
15
20
|
exports.bindTracingChannelToSpan = tracingChannel.bindTracingChannelToSpan;
|
|
16
|
-
exports.vercelAiIntegration = index.vercelAiIntegration;
|
|
21
|
+
exports.vercelAiIntegration = index$2.vercelAiIntegration;
|
|
22
|
+
exports.fastifyIntegration = index.fastifyIntegration;
|
|
23
|
+
exports.handleFastifyError = index.handleFastifyError;
|
|
24
|
+
exports.instrumentFastify = index.instrumentFastify;
|
|
17
25
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const debugBuild = require('../../debug-build.js');
|
|
6
|
+
const channels = require('../../orchestrion/channels.js');
|
|
7
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "Anthropic_AI";
|
|
10
|
+
const ORIGIN = "auto.ai.orchestrion.anthropic";
|
|
11
|
+
const INSTRUMENTED_CHANNELS = [
|
|
12
|
+
{ channel: channels.CHANNELS.ANTHROPIC_CHAT, operation: "chat", methodPath: "messages.create", stream: "async-iterable" },
|
|
13
|
+
{ channel: channels.CHANNELS.ANTHROPIC_MODELS, operation: "models", methodPath: "models.retrieve", stream: "none" },
|
|
14
|
+
{
|
|
15
|
+
channel: channels.CHANNELS.ANTHROPIC_MESSAGES_STREAM,
|
|
16
|
+
operation: "chat",
|
|
17
|
+
methodPath: "messages.stream",
|
|
18
|
+
stream: "message-stream"
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
let subscribed = false;
|
|
22
|
+
const _anthropicChannelIntegration = ((options = {}) => {
|
|
23
|
+
return {
|
|
24
|
+
name: INTEGRATION_NAME,
|
|
25
|
+
setupOnce() {
|
|
26
|
+
if (!diagnosticsChannel.tracingChannel || subscribed) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
subscribed = true;
|
|
30
|
+
core.waitForTracingChannelBinding(() => {
|
|
31
|
+
for (const { channel, operation, methodPath, stream } of INSTRUMENTED_CHANNELS) {
|
|
32
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:anthropic] subscribing to channel "${channel}"`);
|
|
33
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
34
|
+
diagnosticsChannel.tracingChannel(channel),
|
|
35
|
+
(data) => createGenAiSpan(data, operation, methodPath, options),
|
|
36
|
+
{
|
|
37
|
+
beforeSpanEnd: (span, data) => {
|
|
38
|
+
core.addAnthropicResponseAttributes(
|
|
39
|
+
span,
|
|
40
|
+
data.result,
|
|
41
|
+
core.resolveAIRecordingOptions(options).recordOutputs
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, stream, options)
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
function createGenAiSpan(data, operation, methodPath, options) {
|
|
53
|
+
const args = data.arguments ?? [];
|
|
54
|
+
if (core._INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
const requestOptions = args[1];
|
|
58
|
+
if (requestOptions?.headers?.["X-Stainless-Helper-Method"] === "stream") {
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
|
|
62
|
+
const { recordInputs } = core.resolveAIRecordingOptions(options);
|
|
63
|
+
const enableTruncation = core.shouldEnableTruncation(options.enableTruncation);
|
|
64
|
+
const attributes = core.extractAnthropicRequestAttributes(args, methodPath, operation);
|
|
65
|
+
const model = attributes[core.GEN_AI_REQUEST_MODEL_ATTRIBUTE] || "unknown";
|
|
66
|
+
attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;
|
|
67
|
+
const span = core.startInactiveSpan({
|
|
68
|
+
name: `${operation} ${model}`,
|
|
69
|
+
op: `gen_ai.${operation}`,
|
|
70
|
+
attributes
|
|
71
|
+
});
|
|
72
|
+
if (recordInputs && params) {
|
|
73
|
+
core.addAnthropicRequestAttributes(span, params, enableTruncation);
|
|
74
|
+
}
|
|
75
|
+
return span;
|
|
76
|
+
}
|
|
77
|
+
function isAsyncIterable(value) {
|
|
78
|
+
return !!value && typeof value[Symbol.asyncIterator] === "function";
|
|
79
|
+
}
|
|
80
|
+
function isMessageStream(value) {
|
|
81
|
+
return !!value && typeof value.on === "function";
|
|
82
|
+
}
|
|
83
|
+
function wrapStreamResult(span, data, stream, options) {
|
|
84
|
+
const { recordOutputs } = core.resolveAIRecordingOptions(options);
|
|
85
|
+
const result = data.result;
|
|
86
|
+
if (stream === "async-iterable" && isAsyncIterable(result)) {
|
|
87
|
+
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
88
|
+
const instrumented = core.instrumentAsyncIterableStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs);
|
|
89
|
+
result[Symbol.asyncIterator] = () => instrumented;
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
if (stream === "message-stream" && isMessageStream(result)) {
|
|
93
|
+
core.instrumentMessageStream(result, span, recordOutputs);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const anthropicChannelIntegration = core.defineIntegration(_anthropicChannelIntegration);
|
|
99
|
+
|
|
100
|
+
exports.anthropicChannelIntegration = anthropicChannelIntegration;
|
|
101
|
+
//# sourceMappingURL=anthropic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.js","sources":["../../../../src/integrations/tracing-channel/anthropic.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { AnthropicAiOptions, AnthropicAiResponse, IntegrationFn, Span, SpanAttributeValue } from '@sentry/core';\nimport {\n _INTERNAL_shouldSkipAiProviderWrapping,\n addAnthropicRequestAttributes,\n addAnthropicResponseAttributes,\n debug,\n defineIntegration,\n extractAnthropicRequestAttributes,\n GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n instrumentAsyncIterableStream,\n instrumentMessageStream,\n resolveAIRecordingOptions,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n shouldEnableTruncation,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design: when enabled, the OTel 'Anthropic_AI'\n// integration is dropped from the default set (see the Node opt-in loader).\nconst INTEGRATION_NAME = 'Anthropic_AI' as const;\n\n// Distinct from the proxy's `auto.ai.anthropic` so spans from the orchestrion path\n// are attributable separately from the OTel/proxy one.\nconst ORIGIN = 'auto.ai.orchestrion.anthropic';\n\n// `stream` determines how the span is ended\nconst INSTRUMENTED_CHANNELS = [\n { channel: CHANNELS.ANTHROPIC_CHAT, operation: 'chat', methodPath: 'messages.create', stream: 'async-iterable' },\n { channel: CHANNELS.ANTHROPIC_MODELS, operation: 'models', methodPath: 'models.retrieve', stream: 'none' },\n {\n channel: CHANNELS.ANTHROPIC_MESSAGES_STREAM,\n operation: 'chat',\n methodPath: 'messages.stream',\n stream: 'message-stream',\n },\n] as const;\n\ntype StreamMode = (typeof INSTRUMENTED_CHANNELS)[number]['stream'];\n\ninterface AnthropicChannelContext {\n arguments: unknown[];\n result?: unknown;\n}\n\nlet subscribed = false;\n\nconst _anthropicChannelIntegration = ((options: AnthropicAiOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // tracingChannel is unavailable before Node 18.19 and prevent double-subscribe\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n\n // `bindTracingChannelToSpan` needs the async-context binding that `initOpenTelemetry()` registers\n // after `setupOnce` runs, so wait for it before subscribing.\n waitForTracingChannelBinding(() => {\n for (const { channel, operation, methodPath, stream } of INSTRUMENTED_CHANNELS) {\n DEBUG_BUILD && debug.log(`[orchestrion:anthropic] subscribing to channel \"${channel}\"`);\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<AnthropicChannelContext>(channel),\n data => createGenAiSpan(data, operation, methodPath, options),\n {\n beforeSpanEnd: (span, data) => {\n addAnthropicResponseAttributes(\n span,\n data.result as AnthropicAiResponse,\n resolveAIRecordingOptions(options).recordOutputs,\n );\n },\n deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, stream, options),\n },\n );\n }\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Build the span for an instrumented call.\n * Returning `undefined` opts the payload out so no span is opened.\n */\nfunction createGenAiSpan(\n data: AnthropicChannelContext,\n operation: string,\n methodPath: string,\n options: AnthropicAiOptions,\n): Span | undefined {\n const args = data.arguments ?? [];\n\n // When LangChain (or another provider) is driving the SDK, it records the spans itself and marks this\n // provider as skipped — mirror the OTel integration and don't double-instrument.\n if (_INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {\n return undefined;\n }\n\n // `messages.stream()` internally calls the instrumented `messages.create({ stream: true })` tagged with\n // an `X-Stainless-Helper-Method: 'stream'` header. The messages-stream channel already covers it, so skip\n // the nested create to avoid a duplicate span.\n const requestOptions = args[1] as { headers?: Record<string, unknown> } | undefined;\n if (requestOptions?.headers?.['X-Stainless-Helper-Method'] === 'stream') {\n return undefined;\n }\n\n const params = typeof args[0] === 'object' && args[0] !== null ? (args[0] as Record<string, unknown>) : undefined;\n\n const { recordInputs } = resolveAIRecordingOptions(options);\n const enableTruncation = shouldEnableTruncation(options.enableTruncation);\n\n const attributes = extractAnthropicRequestAttributes(args, methodPath, operation);\n const model = (attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] as string) || 'unknown';\n attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;\n\n const span = startInactiveSpan({\n name: `${operation} ${model}`,\n op: `gen_ai.${operation}`,\n attributes: attributes as Record<string, SpanAttributeValue>,\n });\n\n if (recordInputs && params) {\n addAnthropicRequestAttributes(span, params, enableTruncation);\n }\n\n return span;\n}\n\ntype AsyncIterableStream = { [Symbol.asyncIterator]: () => AsyncIterator<unknown> };\ntype MessageStreamEmitter = { on: (...args: unknown[]) => void };\n\nfunction isAsyncIterable(value: unknown): value is AsyncIterableStream {\n return !!value && typeof (value as AsyncIterableStream)[Symbol.asyncIterator] === 'function';\n}\n\nfunction isMessageStream(value: unknown): value is MessageStreamEmitter {\n return !!value && typeof (value as MessageStreamEmitter).on === 'function';\n}\n\n/**\n * Hand span-ending ownership to a streamed result: returns `true` to skip the normal `beforeSpanEnd`,\n * `false` for non-streaming results (which end via `beforeSpanEnd`).\n *\n * - `async-iterable`: patch the `Stream`'s async iterator in place so `instrumentAsyncIterableStream` ends\n * the span when iteration finishes.\n * - `message-stream`: `instrumentMessageStream` attaches `'message'`/`'error'` listeners that end the span.\n */\nfunction wrapStreamResult(\n span: Span,\n data: AnthropicChannelContext,\n stream: StreamMode,\n options: AnthropicAiOptions,\n): boolean {\n const { recordOutputs } = resolveAIRecordingOptions(options);\n const result = data.result;\n\n if (stream === 'async-iterable' && isAsyncIterable(result)) {\n const iterate = result[Symbol.asyncIterator].bind(result);\n const instrumented = instrumentAsyncIterableStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs);\n result[Symbol.asyncIterator] = () => instrumented;\n return true;\n }\n\n if (stream === 'message-stream' && isMessageStream(result)) {\n instrumentMessageStream(result, span, recordOutputs);\n return true;\n }\n\n return false;\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven Anthropic integration. Subscribes to the `orchestrion:@anthropic-ai/sdk:*`\n * diagnostics_channels injected into the SDK's chat (`messages`/`completions`/beta `messages`), `models`, and\n * `messages.stream()` methods, so it requires the orchestrion runtime hook or bundler plugin.\n */\nexport const anthropicChannelIntegration = defineIntegration(_anthropicChannelIntegration);\n"],"names":["CHANNELS","waitForTracingChannelBinding","DEBUG_BUILD","debug","bindTracingChannelToSpan","addAnthropicResponseAttributes","resolveAIRecordingOptions","_INTERNAL_shouldSkipAiProviderWrapping","shouldEnableTruncation","extractAnthropicRequestAttributes","GEN_AI_REQUEST_MODEL_ATTRIBUTE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startInactiveSpan","addAnthropicRequestAttributes","instrumentAsyncIterableStream","instrumentMessageStream","defineIntegration"],"mappings":";;;;;;;;AAwBA,MAAM,gBAAA,GAAmB,cAAA;AAIzB,MAAM,MAAA,GAAS,+BAAA;AAGf,MAAM,qBAAA,GAAwB;AAAA,EAC5B,EAAE,SAASA,iBAAA,CAAS,cAAA,EAAgB,WAAW,MAAA,EAAQ,UAAA,EAAY,iBAAA,EAAmB,MAAA,EAAQ,gBAAA,EAAiB;AAAA,EAC/G,EAAE,SAASA,iBAAA,CAAS,gBAAA,EAAkB,WAAW,QAAA,EAAU,UAAA,EAAY,iBAAA,EAAmB,MAAA,EAAQ,MAAA,EAAO;AAAA,EACzG;AAAA,IACE,SAASA,iBAAA,CAAS,yBAAA;AAAA,IAClB,SAAA,EAAW,MAAA;AAAA,IACX,UAAA,EAAY,iBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA;AAEZ,CAAA;AASA,IAAI,UAAA,GAAa,KAAA;AAEjB,MAAM,4BAAA,IAAgC,CAAC,OAAA,GAA8B,EAAC,KAAM;AAC1E,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,kBAAA,CAAmB,cAAA,IAAkB,UAAA,EAAY;AACpD,QAAA;AAAA,MACF;AACA,MAAA,UAAA,GAAa,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AAA;AAEpB,EAAA,IAAI,MAAA,KAAW,gBAAA,IAAoB,eAAA,CAAgB,MAAM,CAAA,EAAG;AAC1D,IAAA,MAAM,UAAU,MAAA,CAAO,MAAA,CAAO,aAAa,CAAA,CAAE,KAAK,MAAM,CAAA;AACxD,IAAA,MAAM,YAAA,GAAeQ,kCAAA,CAA8B,EAAE,CAAC,MAAA,CAAO,aAAa,GAAG,OAAA,EAAQ,EAAG,IAAA,EAAM,aAAa,CAAA;AAC3G,IAAA,MAAA,CAAO,MAAA,CAAO,aAAa,CAAA,GAAI,MAAM,YAAA;AACrC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,MAAA,KAAW,gBAAA,IAAoB,eAAA,CAAgB,MAAM,CAAA,EAAG;AAC1D,IAAAC,4BAAA,CAAwB,MAAA,EAAQ,MAAM,aAAa,CAAA;AACnD,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAOO,MAAM,2BAAA,GAA8BC,uBAAkB,4BAA4B;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const debugBuild = require('../../../debug-build.js');
|
|
5
|
+
const core = require('@sentry/core');
|
|
6
|
+
const utils = require('./utils.js');
|
|
7
|
+
|
|
8
|
+
function getFastifyIntegration() {
|
|
9
|
+
const client = core.getClient();
|
|
10
|
+
return client?.getIntegrationByName(utils.INTEGRATION_NAME);
|
|
11
|
+
}
|
|
12
|
+
function subscribeToFastifyErrorChannel() {
|
|
13
|
+
diagnosticsChannel.subscribe("tracing:fastify.request.handler:error", (message) => {
|
|
14
|
+
const { error, request, reply } = message;
|
|
15
|
+
handleFastifyError.call(handleFastifyError, error, request, reply, "diagnostics-channel");
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function handleFastifyError(error, request, reply, handlerOrigin) {
|
|
19
|
+
const shouldHandleError = getFastifyIntegration()?.getShouldHandleError() || utils.defaultShouldHandleError;
|
|
20
|
+
if (handlerOrigin === "diagnostics-channel") {
|
|
21
|
+
this.diagnosticsChannelExists = true;
|
|
22
|
+
}
|
|
23
|
+
if (this.diagnosticsChannelExists && handlerOrigin === "onError-hook") {
|
|
24
|
+
debugBuild.DEBUG_BUILD && core.debug.warn(
|
|
25
|
+
"Fastify error handler was already registered via diagnostics channel.",
|
|
26
|
+
"You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options."
|
|
27
|
+
);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (shouldHandleError(error, request, reply)) {
|
|
31
|
+
core.captureException(error, {
|
|
32
|
+
mechanism: {
|
|
33
|
+
handled: false,
|
|
34
|
+
type: "auto.function.fastify"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.handleFastifyError = handleFastifyError;
|
|
41
|
+
exports.subscribeToFastifyErrorChannel = subscribeToFastifyErrorChannel;
|
|
42
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../../../src/integrations/tracing-channel/fastify/errors.ts"],"sourcesContent":["import type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { getClient, debug, captureException } from '@sentry/core';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\n\nfunction getFastifyIntegration(): FastifyIntegration | undefined {\n const client = getClient();\n return client?.getIntegrationByName(INTEGRATION_NAME);\n}\n\n/**\n * Subscribe to the Fastify v5 error diagnostics channel.\n */\nexport function subscribeToFastifyErrorChannel(): void {\n diagnosticsChannel.subscribe('tracing:fastify.request.handler:error', message => {\n const { error, request, reply } = message as {\n error: Error;\n request: FastifyRequest;\n reply: FastifyReply;\n };\n\n handleFastifyError.call(handleFastifyError, error, request, reply, 'diagnostics-channel');\n });\n}\n\n/**\n * Handle a Fastify error, and possibly send it to Sentry.\n */\nexport function handleFastifyError(\n this: {\n diagnosticsChannelExists?: boolean;\n },\n error: Error,\n request: FastifyRequest,\n reply: FastifyReply,\n handlerOrigin: 'diagnostics-channel' | 'onError-hook',\n): void {\n const shouldHandleError = getFastifyIntegration()?.getShouldHandleError() || defaultShouldHandleError;\n // Diagnostics channel runs before the onError hook, so we can use it to check if the handler was already registered\n if (handlerOrigin === 'diagnostics-channel') {\n this.diagnosticsChannelExists = true;\n }\n\n if (this.diagnosticsChannelExists && handlerOrigin === 'onError-hook') {\n DEBUG_BUILD &&\n debug.warn(\n 'Fastify error handler was already registered via diagnostics channel.',\n 'You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.',\n );\n\n // If the diagnostics channel already exists, we don't need to handle the error again\n return;\n }\n\n if (shouldHandleError(error, request, reply)) {\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.function.fastify',\n },\n });\n }\n}\n"],"names":["getClient","INTEGRATION_NAME","defaultShouldHandleError","DEBUG_BUILD","debug","captureException"],"mappings":";;;;;;;AAMA,SAAS,qBAAA,GAAwD;AAC/D,EAAA,MAAM,SAASA,cAAA,EAAU;AACzB,EAAA,OAAO,MAAA,EAAQ,qBAAqBC,sBAAgB,CAAA;AACtD;AAKO,SAAS,8BAAA,GAAuC;AACrD,EAAA,kBAAA,CAAmB,SAAA,CAAU,yCAAyC,CAAA,OAAA,KAAW;AAC/E,IAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,KAAA,EAAM,GAAI,OAAA;AAMlC,IAAA,kBAAA,CAAmB,IAAA,CAAK,kBAAA,EAAoB,KAAA,EAAO,OAAA,EAAS,OAAO,qBAAqB,CAAA;AAAA,EAC1F,CAAC,CAAA;AACH;AAKO,SAAS,kBAAA,CAId,KAAA,EACA,OAAA,EACA,KAAA,EACA,aAAA,EACM;AACN,EAAA,MAAM,iBAAA,GAAoB,qBAAA,EAAsB,EAAG,oBAAA,EAAqB,IAAKC,8BAAA;AAE7E,EAAA,IAAI,kBAAkB,qBAAA,EAAuB;AAC3C,IAAA,IAAA,CAAK,wBAAA,GAA2B,IAAA;AAAA,EAClC;AAEA,EAAA,IAAI,IAAA,CAAK,wBAAA,IAA4B,aAAA,KAAkB,cAAA,EAAgB;AACrE,IAAAC,sBAAA,IACEC,UAAA,CAAM,IAAA;AAAA,MACJ,uEAAA;AAAA,MACA;AAAA,KACF;AAGF,IAAA;AAAA,EACF;AAEA,EAAA,IAAI,iBAAA,CAAkB,KAAA,EAAO,OAAA,EAAS,KAAK,CAAA,EAAG;AAC5C,IAAAC,qBAAA,CAAiB,KAAA,EAAO;AAAA,MACtB,SAAA,EAAW;AAAA,QACT,OAAA,EAAS,KAAA;AAAA,QACT,IAAA,EAAM;AAAA;AACR,KACD,CAAA;AAAA,EACH;AACF;;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const instrumentation = require('./instrumentation.js');
|
|
5
|
+
const utils = require('./utils.js');
|
|
6
|
+
const errors = require('./errors.js');
|
|
7
|
+
|
|
8
|
+
const _fastifyIntegration = (({ shouldHandleError }) => {
|
|
9
|
+
let _shouldHandleError;
|
|
10
|
+
return {
|
|
11
|
+
name: utils.INTEGRATION_NAME,
|
|
12
|
+
setupOnce() {
|
|
13
|
+
_shouldHandleError = shouldHandleError || utils.defaultShouldHandleError;
|
|
14
|
+
errors.subscribeToFastifyErrorChannel();
|
|
15
|
+
instrumentation.instrumentFastify();
|
|
16
|
+
},
|
|
17
|
+
getShouldHandleError() {
|
|
18
|
+
return _shouldHandleError;
|
|
19
|
+
},
|
|
20
|
+
setShouldHandleError(shouldHandleError2) {
|
|
21
|
+
_shouldHandleError = shouldHandleError2;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
const fastifyIntegration = core.defineIntegration(
|
|
26
|
+
(options = {}) => _fastifyIntegration(options)
|
|
27
|
+
);
|
|
28
|
+
const instrumentFastify = instrumentation.instrumentFastify;
|
|
29
|
+
const handleFastifyError = errors.handleFastifyError;
|
|
30
|
+
|
|
31
|
+
exports.fastifyIntegration = fastifyIntegration;
|
|
32
|
+
exports.handleFastifyError = handleFastifyError;
|
|
33
|
+
exports.instrumentFastify = instrumentFastify;
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\n\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions>) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["INTEGRATION_NAME","defaultShouldHandleError","subscribeToFastifyErrorChannel","_instrumentFastify","shouldHandleError","defineIntegration","_handleFastifyError"],"mappings":";;;;;;;AA2CA,MAAM,mBAAA,IAAuB,CAAC,EAAE,iBAAA,EAAkB,KAA0C;AAC1F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAMA,sBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqBC,8BAAA;AAE1C,MAAAC,qCAAA,EAA+B;AAC/B,MAAAC,iCAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqBC,sBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClG,oBAAoB,OAAO;AAC7B;AAKO,MAAM,iBAAA,GAAoBF;AAK1B,MAAM,kBAAA,GAAqBG;;;;;;"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
5
|
+
const core = require('@sentry/core');
|
|
6
|
+
const debugBuild = require('../../../debug-build.js');
|
|
7
|
+
|
|
8
|
+
const PACKAGE_NAME = "@sentry/instrumentation-fastify";
|
|
9
|
+
const SUPPORTED_VERSIONS = ">=3.21.0 <6";
|
|
10
|
+
const ORIGIN = "auto.http.otel.fastify";
|
|
11
|
+
const HOOK_OP = "hook.fastify";
|
|
12
|
+
const REQUEST_HANDLER_OP = "request_handler.fastify";
|
|
13
|
+
const FASTIFY_HOOKS = [
|
|
14
|
+
"onRequest",
|
|
15
|
+
"preParsing",
|
|
16
|
+
"preValidation",
|
|
17
|
+
"preHandler",
|
|
18
|
+
"preSerialization",
|
|
19
|
+
"onSend",
|
|
20
|
+
"onResponse",
|
|
21
|
+
"onError"
|
|
22
|
+
];
|
|
23
|
+
const ATTRIBUTE_HOOK_NAME = "hook.name";
|
|
24
|
+
const ATTRIBUTE_FASTIFY_TYPE = "fastify.type";
|
|
25
|
+
const ATTRIBUTE_HOOK_CALLBACK_NAME = "hook.callback.name";
|
|
26
|
+
const ATTRIBUTE_FASTIFY_ROOT = "fastify.root";
|
|
27
|
+
const HOOK_TYPE_ROUTE = "route-hook";
|
|
28
|
+
const HOOK_TYPE_INSTANCE = "hook";
|
|
29
|
+
const HOOK_TYPE_HANDLER = "request-handler";
|
|
30
|
+
const ANONYMOUS_FUNCTION_NAME = "anonymous";
|
|
31
|
+
const kRequestSpan = /* @__PURE__ */ Symbol("sentry fastify request span");
|
|
32
|
+
const kAddHookOriginal = /* @__PURE__ */ Symbol("sentry fastify addHook original");
|
|
33
|
+
const kSetNotFoundOriginal = /* @__PURE__ */ Symbol("sentry fastify setNotFoundHandler original");
|
|
34
|
+
function getRequestRouteUrl(request) {
|
|
35
|
+
return request.routeOptions?.url ?? request.routerPath;
|
|
36
|
+
}
|
|
37
|
+
function getRequestRouteConfig(request) {
|
|
38
|
+
return request.routeOptions?.config ?? request.routeConfig;
|
|
39
|
+
}
|
|
40
|
+
function isFastifyRequest(arg) {
|
|
41
|
+
return !!arg && typeof arg === "object" && !!arg.method && !!arg.url && (!!arg.routeOptions || "routerPath" in arg);
|
|
42
|
+
}
|
|
43
|
+
function fastifyOtelPlugin(instance, _opts, done) {
|
|
44
|
+
instance.decorate(kAddHookOriginal, instance.addHook);
|
|
45
|
+
instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);
|
|
46
|
+
instance.decorateRequest("opentelemetry", function opentelemetry() {
|
|
47
|
+
return { span: this[kRequestSpan] };
|
|
48
|
+
});
|
|
49
|
+
instance.decorateRequest(kRequestSpan, null);
|
|
50
|
+
instance.addHook("onRoute", otelWireRoute);
|
|
51
|
+
instance.addHook("onRequest", startRequestSpanHook);
|
|
52
|
+
instance.addHook("onResponse", finalizeNotFoundSpanHook);
|
|
53
|
+
instance.addHook = addHookPatched;
|
|
54
|
+
instance.setNotFoundHandler = setNotFoundHandlerPatched;
|
|
55
|
+
done();
|
|
56
|
+
}
|
|
57
|
+
const pluginSymbols = fastifyOtelPlugin;
|
|
58
|
+
pluginSymbols[/* @__PURE__ */ Symbol.for("skip-override")] = true;
|
|
59
|
+
pluginSymbols[/* @__PURE__ */ Symbol.for("fastify.display-name")] = PACKAGE_NAME;
|
|
60
|
+
pluginSymbols[/* @__PURE__ */ Symbol.for("plugin-meta")] = {
|
|
61
|
+
fastify: SUPPORTED_VERSIONS,
|
|
62
|
+
name: PACKAGE_NAME
|
|
63
|
+
};
|
|
64
|
+
function otelWireRoute(routeOptions) {
|
|
65
|
+
if (routeOptions.config?.otel === false) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (const hook of FASTIFY_HOOKS) {
|
|
69
|
+
const handlerLike = routeOptions[hook];
|
|
70
|
+
if (typeof handlerLike === "function") {
|
|
71
|
+
routeOptions[hook] = handlerWrapper(
|
|
72
|
+
handlerLike,
|
|
73
|
+
hook,
|
|
74
|
+
routeHookAttributes(this.pluginName, hook, handlerLike, routeOptions.url)
|
|
75
|
+
);
|
|
76
|
+
} else if (Array.isArray(handlerLike)) {
|
|
77
|
+
routeOptions[hook] = handlerLike.map(
|
|
78
|
+
(handler) => handlerWrapper(handler, hook, routeHookAttributes(this.pluginName, hook, handler, routeOptions.url))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
routeOptions.onSend = appendRouteHook(routeOptions.onSend, finalizeResponseSpanHook);
|
|
83
|
+
routeOptions.onError = appendRouteHook(routeOptions.onError, recordErrorInSpanHook);
|
|
84
|
+
routeOptions.handler = handlerWrapper(routeOptions.handler, "handler", {
|
|
85
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - route-handler`,
|
|
86
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_HANDLER,
|
|
87
|
+
[attributes.HTTP_ROUTE]: routeOptions.url,
|
|
88
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function routeHookAttributes(pluginName, hook, handler, url) {
|
|
92
|
+
return {
|
|
93
|
+
[ATTRIBUTE_HOOK_NAME]: `${pluginName} - route -> ${hook}`,
|
|
94
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_ROUTE,
|
|
95
|
+
[attributes.HTTP_ROUTE]: url,
|
|
96
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function appendRouteHook(existing, hook) {
|
|
100
|
+
if (existing == null) {
|
|
101
|
+
return hook;
|
|
102
|
+
}
|
|
103
|
+
return Array.isArray(existing) ? [...existing, hook] : [existing, hook];
|
|
104
|
+
}
|
|
105
|
+
function startRequestSpanHook(request, _reply, hookDone) {
|
|
106
|
+
if (getRequestRouteConfig(request)?.otel === false) {
|
|
107
|
+
return hookDone();
|
|
108
|
+
}
|
|
109
|
+
const attributes$1 = {
|
|
110
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
111
|
+
[ATTRIBUTE_FASTIFY_ROOT]: PACKAGE_NAME,
|
|
112
|
+
[attributes.HTTP_REQUEST_METHOD]: request.method,
|
|
113
|
+
[attributes.URL_PATH]: request.url
|
|
114
|
+
};
|
|
115
|
+
const route = getRequestRouteUrl(request);
|
|
116
|
+
if (route != null) {
|
|
117
|
+
attributes$1[attributes.HTTP_ROUTE] = route;
|
|
118
|
+
const activeSpan = core.getActiveSpan();
|
|
119
|
+
const rootSpan = activeSpan && core.getRootSpan(activeSpan);
|
|
120
|
+
if (rootSpan && core.spanToJSON(rootSpan).data[core.SEMANTIC_ATTRIBUTE_SENTRY_OP] === "http.server") {
|
|
121
|
+
rootSpan.setAttribute(attributes.HTTP_ROUTE, route);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const requestSpan = core.startInactiveSpan({ name: "request", op: REQUEST_HANDLER_OP, attributes: attributes$1 });
|
|
125
|
+
request[kRequestSpan] = requestSpan;
|
|
126
|
+
core.withActiveSpan(requestSpan, () => {
|
|
127
|
+
hookDone();
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function finalizeNotFoundSpanHook(request, reply, hookDone) {
|
|
131
|
+
const span = request[kRequestSpan];
|
|
132
|
+
if (span != null) {
|
|
133
|
+
span.setAttributes({ [attributes.HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });
|
|
134
|
+
span.end();
|
|
135
|
+
}
|
|
136
|
+
request[kRequestSpan] = null;
|
|
137
|
+
hookDone();
|
|
138
|
+
}
|
|
139
|
+
function finalizeResponseSpanHook(request, reply, payload, hookDone) {
|
|
140
|
+
const span = request[kRequestSpan];
|
|
141
|
+
if (span != null) {
|
|
142
|
+
if (reply.statusCode >= 500) {
|
|
143
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR });
|
|
144
|
+
}
|
|
145
|
+
span.setAttributes({ [attributes.HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });
|
|
146
|
+
span.end();
|
|
147
|
+
}
|
|
148
|
+
request[kRequestSpan] = null;
|
|
149
|
+
hookDone(null, payload);
|
|
150
|
+
}
|
|
151
|
+
function recordErrorInSpanHook(request, _reply, error, hookDone) {
|
|
152
|
+
const span = request[kRequestSpan];
|
|
153
|
+
if (span != null) {
|
|
154
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: error.message });
|
|
155
|
+
}
|
|
156
|
+
hookDone();
|
|
157
|
+
}
|
|
158
|
+
function addHookPatched(name, hook) {
|
|
159
|
+
const addHookOriginal = this[kAddHookOriginal];
|
|
160
|
+
if (FASTIFY_HOOKS.includes(name)) {
|
|
161
|
+
return addHookOriginal.call(
|
|
162
|
+
this,
|
|
163
|
+
name,
|
|
164
|
+
handlerWrapper(hook, name, {
|
|
165
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - ${name}`,
|
|
166
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,
|
|
167
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME
|
|
168
|
+
})
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
return addHookOriginal.call(this, name, hook);
|
|
172
|
+
}
|
|
173
|
+
function setNotFoundHandlerPatched(hooks, handler) {
|
|
174
|
+
const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];
|
|
175
|
+
if (typeof hooks === "function") {
|
|
176
|
+
setNotFoundHandlerOriginal.call(
|
|
177
|
+
this,
|
|
178
|
+
handlerWrapper(hooks, "notFoundHandler", {
|
|
179
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,
|
|
180
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,
|
|
181
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (hooks.preValidation != null) {
|
|
187
|
+
hooks.preValidation = handlerWrapper(hooks.preValidation, "notFoundHandler - preValidation", {
|
|
188
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,
|
|
189
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,
|
|
190
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.preValidation.name?.length > 0 ? hooks.preValidation.name : ANONYMOUS_FUNCTION_NAME
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (hooks.preHandler != null) {
|
|
194
|
+
hooks.preHandler = handlerWrapper(hooks.preHandler, "notFoundHandler - preHandler", {
|
|
195
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,
|
|
196
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,
|
|
197
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.preHandler.name?.length > 0 ? hooks.preHandler.name : ANONYMOUS_FUNCTION_NAME
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (handler == null) {
|
|
201
|
+
setNotFoundHandlerOriginal.call(this, hooks);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
setNotFoundHandlerOriginal.call(
|
|
205
|
+
this,
|
|
206
|
+
hooks,
|
|
207
|
+
handlerWrapper(handler, "notFoundHandler", {
|
|
208
|
+
[ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,
|
|
209
|
+
[ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,
|
|
210
|
+
[ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME
|
|
211
|
+
})
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function getRequestFromArgs(args) {
|
|
215
|
+
for (const arg of args) {
|
|
216
|
+
if (isFastifyRequest(arg)) {
|
|
217
|
+
return arg;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function handlerWrapper(handler, hookName, spanAttributes = {}) {
|
|
223
|
+
return function handlerWrapped(...args) {
|
|
224
|
+
const request = getRequestFromArgs(args);
|
|
225
|
+
if (request === null || getRequestRouteConfig(request)?.otel === false) {
|
|
226
|
+
return handler.call(this, ...args);
|
|
227
|
+
}
|
|
228
|
+
const parentSpan = request[kRequestSpan] ?? void 0;
|
|
229
|
+
const handlerName = handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME;
|
|
230
|
+
const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];
|
|
231
|
+
const op = hookType === HOOK_TYPE_INSTANCE ? HOOK_OP : hookType === HOOK_TYPE_HANDLER ? REQUEST_HANDLER_OP : void 0;
|
|
232
|
+
const name = op ? stripFastifyPrefix(spanAttributes[ATTRIBUTE_HOOK_NAME]) : `${hookName} - ${handlerName}`;
|
|
233
|
+
return core.startSpan(
|
|
234
|
+
{
|
|
235
|
+
name,
|
|
236
|
+
op,
|
|
237
|
+
attributes: {
|
|
238
|
+
...spanAttributes,
|
|
239
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
240
|
+
},
|
|
241
|
+
parentSpan
|
|
242
|
+
},
|
|
243
|
+
() => handler.call(this, ...args)
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function stripFastifyPrefix(hookName = "") {
|
|
248
|
+
return hookName.replace(/^fastify -> /, "").replace(/^@fastify\/otel -> /, "").replace(/^@sentry\/instrumentation-fastify -> /, "");
|
|
249
|
+
}
|
|
250
|
+
function instrumentOnRequest(fastify) {
|
|
251
|
+
fastify.addHook("onRequest", async (request, _reply) => {
|
|
252
|
+
const routeName = getRequestRouteUrl(request);
|
|
253
|
+
const method = request.method || "GET";
|
|
254
|
+
core.getIsolationScope().setTransactionName(`${method} ${routeName}`);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
let _isInstrumented = false;
|
|
258
|
+
const instrumentFastify = Object.assign(
|
|
259
|
+
function instrumentFastify2() {
|
|
260
|
+
if (_isInstrumented) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
_isInstrumented = true;
|
|
264
|
+
diagnosticsChannel.subscribe("fastify.initialization", (message) => {
|
|
265
|
+
const fastifyInstance = message.fastify;
|
|
266
|
+
fastifyInstance?.register(fastifyOtelPlugin).after((err) => {
|
|
267
|
+
if (err) {
|
|
268
|
+
debugBuild.DEBUG_BUILD && core.debug.error("Failed to setup Fastify instrumentation", err);
|
|
269
|
+
} else if (fastifyInstance) {
|
|
270
|
+
instrumentOnRequest(fastifyInstance);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
{ id: "Fastify.v5" }
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
exports.instrumentFastify = instrumentFastify;
|
|
279
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing-channel/fastify/instrumentation.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-present The Fastify team <https://github.com/fastify/fastify#team>\n * SPDX-License-Identifier: MIT\n *\n * NOTICE from the Sentry authors:\n * - Based on: https://github.com/fastify/otel/tree/bae80d6caef4287e7f01ff3c8dc753243706ea86 (@fastify/otel@0.18.1)\n * - Streamlined to the Sentry SDK's needs: dropped the `InstrumentationBase` wrapper, the unused\n * request/lifecycle hooks, `ignorePaths`/`minimatch` support and the OpenTelemetry tracer/context\n * APIs in favor of the Sentry span API.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-this-alias */\n/* eslint-disable max-lines */\n\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, URL_PATH } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n debug,\n getActiveSpan,\n getIsolationScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startInactiveSpan,\n startSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport type { FastifyInstance, FastifyRequest } from './types';\nimport { DEBUG_BUILD } from '../../../debug-build';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fastify';\nconst SUPPORTED_VERSIONS = '>=3.21.0 <6';\n\nconst ORIGIN = 'auto.http.otel.fastify';\nconst HOOK_OP = 'hook.fastify';\nconst REQUEST_HANDLER_OP = 'request_handler.fastify';\n\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_HOOK_NAME = 'hook.name' as const;\nconst ATTRIBUTE_FASTIFY_TYPE = 'fastify.type' as const;\nconst ATTRIBUTE_HOOK_CALLBACK_NAME = 'hook.callback.name' as const;\nconst ATTRIBUTE_FASTIFY_ROOT = 'fastify.root' as const;\n\nconst HOOK_TYPE_ROUTE = 'route-hook' as const;\nconst HOOK_TYPE_INSTANCE = 'hook' as const;\nconst HOOK_TYPE_HANDLER = 'request-handler' as const;\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\nconst kRequestSpan = Symbol('sentry fastify request span');\nconst kAddHookOriginal = Symbol('sentry fastify addHook original');\nconst kSetNotFoundOriginal = Symbol('sentry fastify setNotFoundHandler original');\n\ntype AnyFn = (...args: any[]) => any;\n\n/**\n * Read the matched route URL off a request. Fastify >=4 exposes it on `request.routeOptions.url`,\n * while v3 only has the (since-removed-in-v5) `request.routerPath`.\n */\nfunction getRequestRouteUrl(request: any): string | undefined {\n return request.routeOptions?.url ?? request.routerPath;\n}\n\n/**\n * Read the per-route config off a request. Fastify >=4 exposes it on `request.routeOptions.config`,\n * while v3 uses `request.routeConfig`. Used to honor the `{ config: { otel: false } }` opt-out.\n */\nfunction getRequestRouteConfig(request: any): { otel?: boolean } | undefined {\n return request.routeOptions?.config ?? request.routeConfig;\n}\n\n/**\n * Detect whether one of a wrapped handler's arguments is the Fastify request. We can't rely on a\n * single property since the route metadata moved from `routerPath` (v3) to `routeOptions` (>=4),\n * so we accept either shape.\n */\nfunction isFastifyRequest(arg: any): boolean {\n return !!arg && typeof arg === 'object' && !!arg.method && !!arg.url && (!!arg.routeOptions || 'routerPath' in arg);\n}\n\n/**\n * The Fastify plugin that wires up the request/hook/handler spans. It is registered on every Fastify\n * instance via the `fastify.initialization` diagnostics channel.\n */\nfunction fastifyOtelPlugin(this: unknown, instance: any, _opts: unknown, done: () => void): void {\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function opentelemetry(this: any) {\n return { span: this[kRequestSpan] as Span | null };\n });\n instance.decorateRequest(kRequestSpan, null);\n\n instance.addHook('onRoute', otelWireRoute);\n instance.addHook('onRequest', startRequestSpanHook);\n instance.addHook('onResponse', finalizeNotFoundSpanHook);\n\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n\n done();\n}\n\nconst pluginSymbols = fastifyOtelPlugin as unknown as Record<symbol, unknown>;\npluginSymbols[Symbol.for('skip-override')] = true;\npluginSymbols[Symbol.for('fastify.display-name')] = PACKAGE_NAME;\npluginSymbols[Symbol.for('plugin-meta')] = {\n fastify: SUPPORTED_VERSIONS,\n name: PACKAGE_NAME,\n};\n\nfunction otelWireRoute(this: any, routeOptions: any): void {\n if (routeOptions.config?.otel === false) {\n return;\n }\n\n for (const hook of FASTIFY_HOOKS) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(\n handlerLike,\n hook,\n routeHookAttributes(this.pluginName, hook, handlerLike, routeOptions.url),\n );\n } else if (Array.isArray(handlerLike)) {\n routeOptions[hook] = handlerLike.map((handler: AnyFn) =>\n handlerWrapper(handler, hook, routeHookAttributes(this.pluginName, hook, handler, routeOptions.url)),\n );\n }\n }\n\n routeOptions.onSend = appendRouteHook(routeOptions.onSend, finalizeResponseSpanHook);\n routeOptions.onError = appendRouteHook(routeOptions.onError, recordErrorInSpanHook);\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, 'handler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_HANDLER,\n [HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n}\n\nfunction routeHookAttributes(pluginName: string, hook: string, handler: AnyFn, url: string): Record<string, string> {\n return {\n [ATTRIBUTE_HOOK_NAME]: `${pluginName} - route -> ${hook}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_ROUTE,\n [HTTP_ROUTE]: url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n };\n}\n\nfunction appendRouteHook(existing: AnyFn | AnyFn[] | undefined, hook: AnyFn): AnyFn | AnyFn[] {\n if (existing == null) {\n return hook;\n }\n return Array.isArray(existing) ? [...existing, hook] : [existing, hook];\n}\n\nfunction startRequestSpanHook(this: any, request: any, _reply: any, hookDone: () => void): void {\n if (getRequestRouteConfig(request)?.otel === false) {\n return hookDone();\n }\n\n const attributes: Record<string, string> = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [ATTRIBUTE_FASTIFY_ROOT]: PACKAGE_NAME,\n [HTTP_REQUEST_METHOD]: request.method,\n [URL_PATH]: request.url,\n };\n\n const route = getRequestRouteUrl(request);\n if (route != null) {\n attributes[HTTP_ROUTE] = route;\n\n // Update the route of the request on the root span, if it is a http.server span\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n if (rootSpan && spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'http.server') {\n rootSpan.setAttribute(HTTP_ROUTE, route);\n }\n }\n\n const requestSpan = startInactiveSpan({ name: 'request', op: REQUEST_HANDLER_OP, attributes });\n request[kRequestSpan] = requestSpan;\n\n // Set the request span as the active span for the remainder of the request lifecycle, so that\n // downstream hooks/handlers as well as errors captured via the error diagnostics channel are\n // parented to it (otherwise they would attach to the root `http.server` span instead).\n withActiveSpan(requestSpan, () => {\n hookDone();\n });\n}\n\nfunction finalizeNotFoundSpanHook(request: any, reply: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n}\n\nfunction finalizeResponseSpanHook(\n request: any,\n reply: any,\n payload: any,\n hookDone: (err: null, payload: any) => void,\n): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n if (reply.statusCode >= 500) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n}\n\nfunction recordErrorInSpanHook(request: any, _reply: any, error: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n\n hookDone();\n}\n\nfunction addHookPatched(this: any, name: string, hook: AnyFn): unknown {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, name, {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n return addHookOriginal.call(this, name, hook);\n}\n\nfunction setNotFoundHandlerPatched(this: any, hooks: any, handler?: any): void {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n\n if (typeof hooks === 'function') {\n setNotFoundHandlerOriginal.call(\n this,\n handlerWrapper(hooks, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n return;\n }\n\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, 'notFoundHandler - preValidation', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0 ? hooks.preValidation.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, 'notFoundHandler - preHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0 ? hooks.preHandler.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n // Fastify allows `setNotFoundHandler(opts)` without a handler, falling back to its built-in 404\n // handler. Forward the (already-wrapped) hooks unchanged so that fallback still applies.\n if (handler == null) {\n setNotFoundHandlerOriginal.call(this, hooks);\n return;\n }\n\n setNotFoundHandlerOriginal.call(\n this,\n hooks,\n handlerWrapper(handler, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n}\n\nfunction getRequestFromArgs(args: any[]): any | null {\n for (const arg of args) {\n if (isFastifyRequest(arg)) {\n return arg;\n }\n }\n return null;\n}\n\nfunction handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record<string, string> = {}): AnyFn {\n return function handlerWrapped(this: any, ...args: any[]) {\n const request = getRequestFromArgs(args);\n\n if (request === null || getRequestRouteConfig(request)?.otel === false) {\n return handler.call(this, ...args);\n }\n\n const parentSpan = (request[kRequestSpan] as Span | null) ?? undefined;\n const handlerName = handler.name?.length > 0 ? handler.name : (this.pluginName ?? ANONYMOUS_FUNCTION_NAME);\n\n const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];\n const op =\n hookType === HOOK_TYPE_INSTANCE ? HOOK_OP : hookType === HOOK_TYPE_HANDLER ? REQUEST_HANDLER_OP : undefined;\n\n const name = op ? stripFastifyPrefix(spanAttributes[ATTRIBUTE_HOOK_NAME]) : `${hookName} - ${handlerName}`;\n\n return startSpan(\n {\n name,\n op,\n attributes: {\n ...spanAttributes,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n parentSpan,\n },\n () => handler.call(this, ...args),\n );\n };\n}\n\n/**\n * Strip the framework/plugin prefixes from a Fastify `hook.name` to derive a readable span name.\n * This is a bit of a hack and does not always work for all spans, but it's the best we can do without a proper API.\n */\nfunction stripFastifyPrefix(hookName = ''): string {\n return hookName\n .replace(/^fastify -> /, '')\n .replace(/^@fastify\\/otel -> /, '')\n .replace(/^@sentry\\/instrumentation-fastify -> /, '');\n}\n\nfunction instrumentOnRequest(fastify: FastifyInstance): void {\n fastify.addHook('onRequest', async (request: FastifyRequest, _reply) => {\n const routeName = getRequestRouteUrl(request);\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n });\n}\n\nlet _isInstrumented = false;\n\n/**\n * Set up the Fastify (>= 3.21.0 < 6) instrumentation by subscribing to the `fastify.initialization`\n * diagnostics channel and registering the span-creating plugin on every Fastify instance.\n *\n * Idempotent and exposes an `id` so it can participate in the OpenTelemetry preload list.\n */\nexport const instrumentFastify = Object.assign(\n function instrumentFastify(): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n diagnosticsChannel.subscribe('fastify.initialization', message => {\n const fastifyInstance = (message as { fastify?: FastifyInstance }).fastify;\n\n fastifyInstance?.register(fastifyOtelPlugin).after(err => {\n if (err) {\n DEBUG_BUILD && debug.error('Failed to setup Fastify instrumentation', err);\n } else if (fastifyInstance) {\n instrumentOnRequest(fastifyInstance);\n }\n });\n });\n },\n { id: 'Fastify.v5' },\n);\n"],"names":["HTTP_ROUTE","attributes","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","HTTP_REQUEST_METHOD","URL_PATH","getActiveSpan","getRootSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP","startInactiveSpan","withActiveSpan","HTTP_RESPONSE_STATUS_CODE","SPAN_STATUS_ERROR","startSpan","getIsolationScope","instrumentFastify","DEBUG_BUILD","debug"],"mappings":";;;;;;;AAmCA,MAAM,YAAA,GAAe,iCAAA;AACrB,MAAM,kBAAA,GAAqB,aAAA;AAE3B,MAAM,MAAA,GAAS,wBAAA;AACf,MAAM,OAAA,GAAU,cAAA;AAChB,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,aAAA,GAAgB;AAAA,EACpB,WAAA;AAAA,EACA,YAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA;AACA,MAAM,mBAAA,GAAsB,WAAA;AAC5B,MAAM,sBAAA,GAAyB,cAAA;AAC/B,MAAM,4BAAA,GAA+B,oBAAA;AACrC,MAAM,sBAAA,GAAyB,cAAA;AAE/B,MAAM,eAAA,GAAkB,YAAA;AACxB,MAAM,kBAAA,GAAqB,MAAA;AAC3B,MAAM,iBAAA,GAAoB,iBAAA;AAC1B,MAAM,uBAAA,GAA0B,WAAA;AAEhC,MAAM,YAAA,0BAAsB,6BAA6B,CAAA;AACzD,MAAM,gBAAA,0BAA0B,iCAAiC,CAAA;AACjE,MAAM,oBAAA,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AA;AAEjC,IAAAY,sBAAA,GAAoB,kBAAA,CAAmB,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,CAAA;AAAA,EACjE,CAAC,CAAA;AACH;AAEA,IAAI,eAAA,GAAkB,KAAA;AAQf,MAAM,oBAAoB,MAAA,CAAO,MAAA;AAAA,EACtC,SAASC,kBAAAA,GAA0B;AACjC,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA;AAAA,IACF;AACA,IAAA,eAAA,GAAkB,IAAA;AAElB,IAAA,kBAAA,CAAmB,SAAA,CAAU,0BAA0B,CAAA,OAAA,KAAW;AAChE,MAAA,MAAM,kBAAmB,OAAA,CAA0C,OAAA;AAEnE,MAAA,eAAA,EAAiB,QAAA,CAAS,iBAAiB,CAAA,CAAE,KAAA,CAAM,CAAA,GAAA,KAAO;AACxD,QAAA,IAAI,GAAA,EAAK;AACP,UAAAC,sBAAA,IAAeC,UAAA,CAAM,KAAA,CAAM,yCAAA,EAA2C,GAAG,CAAA;AAAA,QAC3E,WAAW,eAAA,EAAiB;AAC1B,UAAA,mBAAA,CAAoB,eAAe,CAAA;AAAA,QACrC;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH,CAAA;AAAA,EACA,EAAE,IAAI,YAAA;AACR;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const INTEGRATION_NAME = "Fastify";
|
|
4
|
+
function defaultShouldHandleError(_error, _request, reply) {
|
|
5
|
+
const statusCode = reply.statusCode;
|
|
6
|
+
return statusCode >= 500 || statusCode <= 299;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
exports.INTEGRATION_NAME = INTEGRATION_NAME;
|
|
10
|
+
exports.defaultShouldHandleError = defaultShouldHandleError;
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify';\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const LIFECYCLE_EXT_POINTS = [
|
|
4
|
+
"onPreAuth",
|
|
5
|
+
"onCredentials",
|
|
6
|
+
"onPostAuth",
|
|
7
|
+
"onPreHandler",
|
|
8
|
+
"onPostHandler",
|
|
9
|
+
"onPreResponse",
|
|
10
|
+
"onRequest"
|
|
11
|
+
];
|
|
12
|
+
const handlerPatched = /* @__PURE__ */ Symbol("hapi-handler-patched");
|
|
13
|
+
const HapiLayerType = {
|
|
14
|
+
ROUTER: "router",
|
|
15
|
+
PLUGIN: "plugin",
|
|
16
|
+
EXT: "server.ext"
|
|
17
|
+
};
|
|
18
|
+
const HapiLifecycleMethodNames = new Set(LIFECYCLE_EXT_POINTS);
|
|
19
|
+
var AttributeNames = /* @__PURE__ */ ((AttributeNames2) => {
|
|
20
|
+
AttributeNames2["HAPI_TYPE"] = "hapi.type";
|
|
21
|
+
AttributeNames2["PLUGIN_NAME"] = "hapi.plugin.name";
|
|
22
|
+
AttributeNames2["EXT_TYPE"] = "server.ext.type";
|
|
23
|
+
return AttributeNames2;
|
|
24
|
+
})(AttributeNames || {});
|
|
25
|
+
|
|
26
|
+
exports.AttributeNames = AttributeNames;
|
|
27
|
+
exports.HapiLayerType = HapiLayerType;
|
|
28
|
+
exports.HapiLifecycleMethodNames = HapiLifecycleMethodNames;
|
|
29
|
+
exports.handlerPatched = handlerPatched;
|
|
30
|
+
//# sourceMappingURL=hapi-types.js.map
|