@sentry/node 11.0.0-alpha.1 → 11.0.0-alpha.2
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/bundler-plugin/esbuild.js.map +1 -1
- package/build/cjs/bundler-plugin/rollup.js.map +1 -1
- package/build/cjs/bundler-plugin/vite.js.map +1 -1
- package/build/cjs/bundler-plugin/webpack.js.map +1 -1
- package/build/cjs/index.js +52 -53
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/anr/index.js +1 -1
- package/build/cjs/integrations/childProcess.js +0 -24
- package/build/cjs/integrations/childProcess.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js +2 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/http/SentryHttpInstrumentation.js +2 -8
- package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +1 -1
- package/build/cjs/integrations/http/httpServerIntegration.js.map +1 -1
- package/build/cjs/integrations/http/httpServerSpansIntegration.js +34 -60
- package/build/cjs/integrations/http/httpServerSpansIntegration.js.map +1 -1
- package/build/cjs/integrations/http/index.js +9 -27
- package/build/cjs/integrations/http/index.js.map +1 -1
- package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js +2 -5
- package/build/cjs/integrations/node-fetch/undici-instrumentation.js.map +1 -1
- package/build/cjs/integrations/pino.js +2 -3
- package/build/cjs/integrations/pino.js.map +1 -1
- package/build/cjs/integrations/processSession.js +1 -1
- package/build/cjs/integrations/processSession.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi.js +10 -0
- package/build/cjs/integrations/tracing/hapi.js.map +1 -0
- package/build/cjs/integrations/tracing/index.js +1 -34
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/koa.js +10 -0
- package/build/cjs/integrations/tracing/koa.js.map +1 -0
- package/build/cjs/integrations/workerThreads.js +35 -0
- package/build/cjs/integrations/workerThreads.js.map +1 -0
- package/build/cjs/sdk/client.js +23 -13
- package/build/cjs/sdk/client.js.map +1 -1
- package/build/cjs/sdk/index.js +16 -29
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/cjs/transports/http.js +10 -3
- package/build/cjs/transports/http.js.map +1 -1
- package/build/cjs/utils/outgoingFetchRequest.js +1 -1
- package/build/cjs/utils/outgoingFetchRequest.js.map +1 -1
- package/build/esm/bundler-plugin/esbuild.js.map +1 -1
- package/build/esm/bundler-plugin/rollup.js.map +1 -1
- package/build/esm/bundler-plugin/vite.js.map +1 -1
- package/build/esm/bundler-plugin/webpack.js.map +1 -1
- package/build/esm/index.js +6 -8
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/anr/index.js +1 -1
- package/build/esm/integrations/anr/worker-script.js +2 -2
- package/build/esm/integrations/childProcess.js +1 -25
- package/build/esm/integrations/childProcess.js.map +1 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js +2 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/http/SentryHttpInstrumentation.js +3 -9
- package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +1 -1
- package/build/esm/integrations/http/httpServerIntegration.js.map +1 -1
- package/build/esm/integrations/http/httpServerSpansIntegration.js +36 -62
- package/build/esm/integrations/http/httpServerSpansIntegration.js.map +1 -1
- package/build/esm/integrations/http/index.js +10 -28
- package/build/esm/integrations/http/index.js.map +1 -1
- package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/build/esm/integrations/local-variables/worker-script.js +1 -1
- package/build/esm/integrations/node-fetch/undici-instrumentation.js +3 -6
- package/build/esm/integrations/node-fetch/undici-instrumentation.js.map +1 -1
- package/build/esm/integrations/pino.js +2 -3
- package/build/esm/integrations/pino.js.map +1 -1
- package/build/esm/integrations/processSession.js +1 -1
- package/build/esm/integrations/processSession.js.map +1 -1
- package/build/esm/integrations/tracing/hapi.js +8 -0
- package/build/esm/integrations/tracing/hapi.js.map +1 -0
- package/build/esm/integrations/tracing/index.js +2 -35
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/koa.js +8 -0
- package/build/esm/integrations/tracing/koa.js.map +1 -0
- package/build/esm/integrations/workerThreads.js +33 -0
- package/build/esm/integrations/workerThreads.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/client.js +23 -13
- package/build/esm/sdk/client.js.map +1 -1
- package/build/esm/sdk/index.js +10 -23
- package/build/esm/sdk/index.js.map +1 -1
- package/build/esm/transports/http.js +10 -3
- package/build/esm/transports/http.js.map +1 -1
- package/build/esm/utils/outgoingFetchRequest.js +2 -2
- package/build/esm/utils/outgoingFetchRequest.js.map +1 -1
- package/build/types/bundler-plugin/esbuild.d.ts +3 -4
- package/build/types/bundler-plugin/esbuild.d.ts.map +1 -1
- package/build/types/bundler-plugin/rollup.d.ts +3 -4
- package/build/types/bundler-plugin/rollup.d.ts.map +1 -1
- package/build/types/bundler-plugin/vite.d.ts +3 -4
- package/build/types/bundler-plugin/vite.d.ts.map +1 -1
- package/build/types/bundler-plugin/webpack.d.ts +2 -2
- package/build/types/bundler-plugin/webpack.d.ts.map +1 -1
- package/build/types/index.d.ts +6 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/childProcess.d.ts +2 -7
- package/build/types/integrations/childProcess.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +6 -61
- package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +1 -1
- package/build/types/integrations/http/httpServerIntegration.d.ts +1 -1
- package/build/types/integrations/http/httpServerSpansIntegration.d.ts +1 -9
- package/build/types/integrations/http/httpServerSpansIntegration.d.ts.map +1 -1
- package/build/types/integrations/http/index.d.ts +16 -74
- package/build/types/integrations/http/index.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/undici-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/pino.d.ts.map +1 -1
- package/build/types/integrations/tracing/hapi.d.ts +13 -0
- package/build/types/integrations/tracing/hapi.d.ts.map +1 -0
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/koa.d.ts +27 -0
- package/build/types/integrations/tracing/koa.d.ts.map +1 -0
- package/build/types/integrations/workerThreads.d.ts +8 -0
- package/build/types/integrations/workerThreads.d.ts.map +1 -0
- package/build/types/sdk/client.d.ts +2 -0
- package/build/types/sdk/client.d.ts.map +1 -1
- package/build/types/sdk/index.d.ts.map +1 -1
- package/build/types/transports/http.d.ts +1 -1
- package/build/types/transports/http.d.ts.map +1 -1
- package/build/types/types.d.ts +11 -0
- package/build/types/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/build/cjs/integrations/tracing/express.js +0 -11
- package/build/cjs/integrations/tracing/express.js.map +0 -1
- package/build/cjs/integrations/tracing/fastify/index.js +0 -40
- package/build/cjs/integrations/tracing/fastify/index.js.map +0 -1
- package/build/cjs/integrations/tracing/hapi/index.js +0 -44
- package/build/cjs/integrations/tracing/hapi/index.js.map +0 -1
- package/build/cjs/integrations/tracing/koa/index.js +0 -22
- package/build/cjs/integrations/tracing/koa/index.js.map +0 -1
- package/build/cjs/integrations/tracing/redis/cache.js +0 -43
- package/build/cjs/integrations/tracing/redis/cache.js.map +0 -1
- package/build/cjs/integrations/tracing/redis/index.js +0 -34
- package/build/cjs/integrations/tracing/redis/index.js.map +0 -1
- package/build/cjs/utils/redisCache.js +0 -98
- package/build/cjs/utils/redisCache.js.map +0 -1
- package/build/esm/integrations/tracing/express.js +0 -9
- package/build/esm/integrations/tracing/express.js.map +0 -1
- package/build/esm/integrations/tracing/fastify/index.js +0 -37
- package/build/esm/integrations/tracing/fastify/index.js.map +0 -1
- package/build/esm/integrations/tracing/hapi/index.js +0 -41
- package/build/esm/integrations/tracing/hapi/index.js.map +0 -1
- package/build/esm/integrations/tracing/koa/index.js +0 -20
- package/build/esm/integrations/tracing/koa/index.js.map +0 -1
- package/build/esm/integrations/tracing/redis/cache.js +0 -40
- package/build/esm/integrations/tracing/redis/cache.js.map +0 -1
- package/build/esm/integrations/tracing/redis/index.js +0 -28
- package/build/esm/integrations/tracing/redis/index.js.map +0 -1
- package/build/esm/utils/redisCache.js +0 -89
- package/build/esm/utils/redisCache.js.map +0 -1
- package/build/types/integrations/tracing/express.d.ts +0 -6
- package/build/types/integrations/tracing/express.d.ts.map +0 -1
- package/build/types/integrations/tracing/fastify/index.d.ts +0 -115
- package/build/types/integrations/tracing/fastify/index.d.ts.map +0 -1
- package/build/types/integrations/tracing/fastify/types.d.ts +0 -33
- package/build/types/integrations/tracing/fastify/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/hapi/index.d.ts +0 -29
- package/build/types/integrations/tracing/hapi/index.d.ts.map +0 -1
- package/build/types/integrations/tracing/hapi/types.d.ts +0 -166
- package/build/types/integrations/tracing/hapi/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/koa/index.d.ts +0 -26
- package/build/types/integrations/tracing/koa/index.d.ts.map +0 -1
- package/build/types/integrations/tracing/redis/cache.d.ts +0 -22
- package/build/types/integrations/tracing/redis/cache.d.ts.map +0 -1
- package/build/types/integrations/tracing/redis/index.d.ts +0 -21
- package/build/types/integrations/tracing/redis/index.d.ts.map +0 -1
- package/build/types/integrations/tracing/redis/vendored/types.d.ts +0 -9
- package/build/types/integrations/tracing/redis/vendored/types.d.ts.map +0 -1
- package/build/types/utils/redisCache.d.ts +0 -17
- package/build/types/utils/redisCache.d.ts.map +0 -1
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const redisCache = require('../../../utils/redisCache.js');
|
|
5
|
-
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
-
|
|
7
|
-
exports._redisOptions = {};
|
|
8
|
-
function setRedisOptions(options) {
|
|
9
|
-
exports._redisOptions = options;
|
|
10
|
-
}
|
|
11
|
-
const cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
12
|
-
const safeKey = redisCache.getCacheKeySafely(redisCommand, cmdArgs);
|
|
13
|
-
const cacheOperation = redisCache.getCacheOperation(redisCommand);
|
|
14
|
-
if (!safeKey || !cacheOperation || !exports._redisOptions.cachePrefixes || !redisCache.shouldConsiderForCache(redisCommand, safeKey, exports._redisOptions.cachePrefixes)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const attributes$1 = core.spanToJSON(span).attributes;
|
|
18
|
-
const networkPeerAddress = attributes$1[attributes.NET_PEER_NAME] ?? attributes$1[attributes.SERVER_ADDRESS];
|
|
19
|
-
const networkPeerPort = attributes$1[attributes.NET_PEER_PORT] ?? attributes$1[attributes.SERVER_PORT];
|
|
20
|
-
if (networkPeerPort && networkPeerAddress) {
|
|
21
|
-
span.setAttributes({ [attributes.NETWORK_PEER_ADDRESS]: networkPeerAddress, [attributes.NETWORK_PEER_PORT]: networkPeerPort });
|
|
22
|
-
}
|
|
23
|
-
const cacheItemSize = redisCache.isInCommands(redisCache.REMOVE_COMMANDS, redisCommand) ? void 0 : redisCache.calculateCacheItemSize(response);
|
|
24
|
-
if (cacheItemSize) {
|
|
25
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);
|
|
26
|
-
}
|
|
27
|
-
if (redisCache.isInCommands(redisCache.GET_COMMANDS, redisCommand) && cacheItemSize !== void 0) {
|
|
28
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);
|
|
29
|
-
}
|
|
30
|
-
span.setAttributes({
|
|
31
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,
|
|
32
|
-
[core.SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey
|
|
33
|
-
});
|
|
34
|
-
const spanDescription = safeKey.join(", ");
|
|
35
|
-
span.updateName(
|
|
36
|
-
exports._redisOptions.maxCacheKeyLength ? core.truncate(spanDescription, exports._redisOptions.maxCacheKeyLength) : spanDescription
|
|
37
|
-
);
|
|
38
|
-
span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, void 0);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
exports.cacheResponseHook = cacheResponseHook;
|
|
42
|
-
exports.setRedisOptions = setRedisOptions;
|
|
43
|
-
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sources":["../../../../../src/integrations/tracing/redis/cache.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_CACHE_HIT,\n SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,\n SEMANTIC_ATTRIBUTE_CACHE_KEY,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n truncate,\n} from '@sentry/core';\nimport type { IORedisCommandArgs } from '../../../utils/redisCache';\nimport {\n calculateCacheItemSize,\n GET_COMMANDS,\n getCacheKeySafely,\n getCacheOperation,\n isInCommands,\n REMOVE_COMMANDS,\n shouldConsiderForCache,\n} from '../../../utils/redisCache';\nimport type { IORedisResponseCustomAttributeFunction } from './vendored/types';\nimport {\n NET_PEER_NAME,\n NET_PEER_PORT,\n NETWORK_PEER_ADDRESS,\n NETWORK_PEER_PORT,\n SERVER_ADDRESS,\n SERVER_PORT,\n} from '@sentry/conventions/attributes';\n\n// This module deliberately does NOT import the vendored OTel `IORedisInstrumentation`/\n// `RedisInstrumentation`, so the orchestrion opt-in can pull `cacheResponseHook`\n// without dragging the OTel redis instrumentation into its module graph.\n\nexport interface RedisOptions {\n /**\n * Define cache prefixes for cache keys that should be captured as a cache span.\n *\n * Setting this to, for example, `['user:']` will capture cache keys that start with `user:`.\n */\n cachePrefixes?: string[];\n /**\n * Maximum length of the cache key added to the span description. If the key exceeds this length, it will be truncated.\n *\n * Passing `0` will use the full cache key without truncation.\n *\n * By default, the full cache key is used.\n */\n maxCacheKeyLength?: number;\n}\n\n/* Only exported for testing purposes */\nexport let _redisOptions: RedisOptions = {};\n\n/** Set the options consumed by {@link cacheResponseHook}. */\nexport function setRedisOptions(options: RedisOptions): void {\n _redisOptions = options;\n}\n\n/* Only exported for testing purposes */\nexport const cacheResponseHook: IORedisResponseCustomAttributeFunction = (\n span: Span,\n redisCommand: string,\n cmdArgs: IORedisCommandArgs,\n response: unknown,\n) => {\n const safeKey = getCacheKeySafely(redisCommand, cmdArgs);\n const cacheOperation = getCacheOperation(redisCommand);\n\n if (\n !safeKey ||\n !cacheOperation ||\n !_redisOptions.cachePrefixes ||\n !shouldConsiderForCache(redisCommand, safeKey, _redisOptions.cachePrefixes)\n ) {\n // not relevant for cache\n return;\n }\n\n // otel/ioredis seems to be using the old standard, as there was a change to those params: https://github.com/open-telemetry/opentelemetry-specification/issues/3199\n // We are using params based on the docs: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/\n // Fall back to stable semconv attributes (server.address/server.port) when\n // old-semconv ones are absent, eg OTEL_SEMCONV_STABILITY_OPT_IN=database\n // set for node-redis v4/v5.\n const attributes = spanToJSON(span).attributes;\n // oxlint-disable-next-line typescript/no-deprecated\n const networkPeerAddress = (attributes[NET_PEER_NAME] ?? attributes[SERVER_ADDRESS]) as string | undefined;\n // oxlint-disable-next-line typescript/no-deprecated\n const networkPeerPort = (attributes[NET_PEER_PORT] ?? attributes[SERVER_PORT]) as number | undefined;\n\n if (networkPeerPort && networkPeerAddress) {\n span.setAttributes({ [NETWORK_PEER_ADDRESS]: networkPeerAddress, [NETWORK_PEER_PORT]: networkPeerPort });\n }\n\n // A remove response is a delete-count, not a cached value, so its size is meaningless.\n const cacheItemSize = isInCommands(REMOVE_COMMANDS, redisCommand) ? undefined : calculateCacheItemSize(response);\n\n if (cacheItemSize) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);\n }\n\n if (isInCommands(GET_COMMANDS, redisCommand) && cacheItemSize !== undefined) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,\n [SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey,\n });\n\n // todo: change to string[] once EAP supports it\n const spanDescription = safeKey.join(', ');\n\n span.updateName(\n _redisOptions.maxCacheKeyLength ? truncate(spanDescription, _redisOptions.maxCacheKeyLength) : spanDescription,\n );\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, undefined);\n};\n"],"names":["_redisOptions","getCacheKeySafely","getCacheOperation","shouldConsiderForCache","attributes","spanToJSON","NET_PEER_NAME","SERVER_ADDRESS","NET_PEER_PORT","SERVER_PORT","NETWORK_PEER_ADDRESS","NETWORK_PEER_PORT","isInCommands","REMOVE_COMMANDS","calculateCacheItemSize","SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE","GET_COMMANDS","SEMANTIC_ATTRIBUTE_CACHE_HIT","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_CACHE_KEY","truncate","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE"],"mappings":";;;;;;AAoDWA,wBAA8B;AAGlC,SAAS,gBAAgB,OAAA,EAA6B;AAC3D,EAAAA,qBAAA,GAAgB,OAAA;AAClB;AAGO,MAAM,iBAAA,GAA4D,CACvE,IAAA,EACA,YAAA,EACA,SACA,QAAA,KACG;AACH,EAAA,MAAM,OAAA,GAAUC,4BAAA,CAAkB,YAAA,EAAc,OAAO,CAAA;AACvD,EAAA,MAAM,cAAA,GAAiBC,6BAAkB,YAAY,CAAA;AAErD,EAAA,IACE,CAAC,OAAA,IACD,CAAC,cAAA,IACD,CAACF,qBAAA,CAAc,aAAA,IACf,CAACG,iCAAA,CA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,CAAK,YAAA,CAAaqB,uCAAkC,MAAS,CAAA;AAC/D;;;;;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const serverUtils = require('@sentry/server-utils');
|
|
5
|
-
const orchestrion = require('@sentry/server-utils/orchestrion');
|
|
6
|
-
const cache = require('./cache.js');
|
|
7
|
-
|
|
8
|
-
const INTEGRATION_NAME = "Redis";
|
|
9
|
-
const _redisIntegration = ((options = {}) => {
|
|
10
|
-
const orchestrionIntegrations = [
|
|
11
|
-
orchestrion.ioredisChannelIntegration({ responseHook: cache.cacheResponseHook }),
|
|
12
|
-
orchestrion.redisChannelIntegration({ responseHook: cache.cacheResponseHook })
|
|
13
|
-
];
|
|
14
|
-
return core.extendIntegration(serverUtils.redisIntegration({ responseHook: cache.cacheResponseHook }), {
|
|
15
|
-
name: INTEGRATION_NAME,
|
|
16
|
-
setupOnce() {
|
|
17
|
-
cache.setRedisOptions(options);
|
|
18
|
-
},
|
|
19
|
-
setup(client) {
|
|
20
|
-
for (const integration of orchestrionIntegrations) {
|
|
21
|
-
integration.setup?.(client);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
const redisIntegration = core.defineIntegration(_redisIntegration);
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "_redisOptions", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: () => cache._redisOptions
|
|
31
|
-
});
|
|
32
|
-
exports.cacheResponseHook = cache.cacheResponseHook;
|
|
33
|
-
exports.redisIntegration = redisIntegration;
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/redis/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration } from '@sentry/core';\nimport { redisIntegration as redisNativeChannelIntegration } from '@sentry/server-utils';\nimport { ioredisChannelIntegration, redisChannelIntegration } from '@sentry/server-utils/orchestrion';\nimport { cacheResponseHook, type RedisOptions, setRedisOptions } from './cache';\n\n// `cacheResponseHook`/`_redisOptions` live in `./cache` (which has no OTel\n// instrumentation imports) so the orchestrion opt-in can pull the hook without\n// dragging the OTel redis instrumentation in. Re-exported here for tests.\nexport { _redisOptions, cacheResponseHook } from './cache';\n\nconst INTEGRATION_NAME = 'Redis' as const;\n\nconst _redisIntegration = ((options: RedisOptions = {}) => {\n // A single public `Redis` integration covers every redis client version. The native\n // diagnostics_channel subscription (node-redis >= 5.12.0, ioredis >= 5.11.0, and batches) lives in\n // server-utils so it is shared across server runtimes; the orchestrion channel integrations cover\n // the older node-redis (`<5.12.0`) and ioredis (`<5.11.0`) ranges. We fold the orchestrion\n // subscribers into this integration's `setup` so `Sentry.redisIntegration()` alone instruments\n // all ranges, even with `defaultIntegrations: []`. All three share the node cache `responseHook`,\n // which reads the options set below but only runs at command time, by which point they are set.\n const orchestrionIntegrations = [\n ioredisChannelIntegration({ responseHook: cacheResponseHook }),\n redisChannelIntegration({ responseHook: cacheResponseHook }),\n ];\n\n return extendIntegration(redisNativeChannelIntegration({ responseHook: cacheResponseHook }), {\n name: INTEGRATION_NAME,\n setupOnce() {\n setRedisOptions(options);\n },\n setup(client) {\n for (const integration of orchestrionIntegrations) {\n integration.setup?.(client);\n }\n },\n });\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [redis](https://www.npmjs.com/package/redis) and\n * [ioredis](https://www.npmjs.com/package/ioredis) libraries.\n *\n * For more information, see the [`redisIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/redis/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.redisIntegration()],\n * });\n * ```\n */\nexport const redisIntegration = defineIntegration(_redisIntegration);\n"],"names":["ioredisChannelIntegration","cacheResponseHook","redisChannelIntegration","extendIntegration","redisNativeChannelIntegration","setRedisOptions","defineIntegration"],"mappings":";;;;;;;AAWA,MAAM,gBAAA,GAAmB,OAAA;AAEzB,MAAM,iBAAA,IAAqB,CAAC,OAAA,GAAwB,EAAC,KAAM;AAQzD,EAAA,MAAM,uBAAA,GAA0B;AAAA,IAC9BA,qCAAA,CAA0B,EAAE,YAAA,EAAcC,uBAAA,EAAmB,CAAA;AAAA,IAC7DC,mCAAA,CAAwB,EAAE,YAAA,EAAcD,uBAAA,EAAmB;AAAA,GAC7D;AAEA,EAAA,OAAOE,uBAAkBC,4BAAA,CAA8B,EAAE,YAAA,EAAcH,uBAAA,EAAmB,CAAA,EAAG;AAAA,IAC3F,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAAI,qBAAA,CAAgB,OAAO,CAAA;AAAA,IACzB,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,KAAA,MAAW,eAAe,uBAAA,EAAyB;AACjD,QAAA,WAAA,CAAY,QAAQ,MAAM,CAAA;AAAA,MAC5B;AAAA,IACF;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAiBO,MAAM,gBAAA,GAAmBC,uBAAkB,iBAAiB;;;;;;;;;"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const SINGLE_ARG_COMMANDS = ["get", "set", "setex"];
|
|
4
|
-
const GET_COMMANDS = ["get", "mget"];
|
|
5
|
-
const SET_COMMANDS = ["set", "setex"];
|
|
6
|
-
const REMOVE_COMMANDS = ["del", "unlink"];
|
|
7
|
-
function isInCommands(redisCommands, command) {
|
|
8
|
-
return redisCommands.includes(command.toLowerCase());
|
|
9
|
-
}
|
|
10
|
-
function getCacheOperation(command) {
|
|
11
|
-
if (isInCommands(GET_COMMANDS, command)) {
|
|
12
|
-
return "cache.get";
|
|
13
|
-
} else if (isInCommands(SET_COMMANDS, command)) {
|
|
14
|
-
return "cache.put";
|
|
15
|
-
} else if (isInCommands(REMOVE_COMMANDS, command)) {
|
|
16
|
-
return "cache.remove";
|
|
17
|
-
} else {
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function keyHasPrefix(key, prefixes) {
|
|
22
|
-
return prefixes.some((prefix) => key.startsWith(prefix));
|
|
23
|
-
}
|
|
24
|
-
function getCacheKeySafely(redisCommand, cmdArgs) {
|
|
25
|
-
try {
|
|
26
|
-
if (cmdArgs.length === 0) {
|
|
27
|
-
return void 0;
|
|
28
|
-
}
|
|
29
|
-
const processArg = (arg) => {
|
|
30
|
-
if (typeof arg === "string" || typeof arg === "number" || Buffer.isBuffer(arg)) {
|
|
31
|
-
return [arg.toString()];
|
|
32
|
-
} else if (Array.isArray(arg)) {
|
|
33
|
-
return flatten(arg.map((arg2) => processArg(arg2)));
|
|
34
|
-
} else {
|
|
35
|
-
return ["<unknown>"];
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const firstArg = cmdArgs[0];
|
|
39
|
-
if (isInCommands(SINGLE_ARG_COMMANDS, redisCommand) && firstArg != null) {
|
|
40
|
-
return processArg(firstArg);
|
|
41
|
-
}
|
|
42
|
-
return flatten(cmdArgs.map((arg) => processArg(arg)));
|
|
43
|
-
} catch {
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function shouldConsiderForCache(redisCommand, keys, prefixes) {
|
|
48
|
-
if (!getCacheOperation(redisCommand)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
for (const key of keys) {
|
|
52
|
-
if (keyHasPrefix(key, prefixes)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
function calculateCacheItemSize(response) {
|
|
59
|
-
const getSize = (value) => {
|
|
60
|
-
try {
|
|
61
|
-
if (Buffer.isBuffer(value)) return value.byteLength;
|
|
62
|
-
else if (typeof value === "string") return value.length;
|
|
63
|
-
else if (typeof value === "number") return value.toString().length;
|
|
64
|
-
else if (value === null || value === void 0) return 0;
|
|
65
|
-
return JSON.stringify(value).length;
|
|
66
|
-
} catch {
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return Array.isArray(response) ? response.reduce((acc, curr) => {
|
|
71
|
-
const size = getSize(curr);
|
|
72
|
-
return typeof size === "number" ? acc !== void 0 ? acc + size : size : acc;
|
|
73
|
-
}, 0) : getSize(response);
|
|
74
|
-
}
|
|
75
|
-
function flatten(input) {
|
|
76
|
-
const result = [];
|
|
77
|
-
const flattenHelper = (input2) => {
|
|
78
|
-
input2.forEach((el) => {
|
|
79
|
-
if (Array.isArray(el)) {
|
|
80
|
-
flattenHelper(el);
|
|
81
|
-
} else {
|
|
82
|
-
result.push(el);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
flattenHelper(input);
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
exports.GET_COMMANDS = GET_COMMANDS;
|
|
91
|
-
exports.REMOVE_COMMANDS = REMOVE_COMMANDS;
|
|
92
|
-
exports.SET_COMMANDS = SET_COMMANDS;
|
|
93
|
-
exports.calculateCacheItemSize = calculateCacheItemSize;
|
|
94
|
-
exports.getCacheKeySafely = getCacheKeySafely;
|
|
95
|
-
exports.getCacheOperation = getCacheOperation;
|
|
96
|
-
exports.isInCommands = isInCommands;
|
|
97
|
-
exports.shouldConsiderForCache = shouldConsiderForCache;
|
|
98
|
-
//# sourceMappingURL=redisCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redisCache.js","sources":["../../../src/utils/redisCache.ts"],"sourcesContent":["export type IORedisCommandArgs = Array<string | Buffer | number | unknown[]>;\n\nconst SINGLE_ARG_COMMANDS = ['get', 'set', 'setex'];\n\nexport const GET_COMMANDS = ['get', 'mget'];\nexport const SET_COMMANDS = ['set', 'setex'];\nexport const REMOVE_COMMANDS = ['del', 'unlink'];\n// todo: expire (no matching cache convention op yet)\n\n/** Checks if a given command is in the list of redis commands.\n * Useful because commands can come in lowercase or uppercase (depending on the library). */\nexport function isInCommands(redisCommands: string[], command: string): boolean {\n return redisCommands.includes(command.toLowerCase());\n}\n\n/** Determine cache operation based on redis statement */\nexport function getCacheOperation(command: string): 'cache.get' | 'cache.put' | 'cache.remove' | undefined {\n if (isInCommands(GET_COMMANDS, command)) {\n return 'cache.get';\n } else if (isInCommands(SET_COMMANDS, command)) {\n return 'cache.put';\n } else if (isInCommands(REMOVE_COMMANDS, command)) {\n return 'cache.remove';\n } else {\n return undefined;\n }\n}\n\nfunction keyHasPrefix(key: string, prefixes: string[]): boolean {\n return prefixes.some(prefix => key.startsWith(prefix));\n}\n\n/** Safely converts a redis key to a string (comma-separated if there are multiple keys) */\nexport function getCacheKeySafely(redisCommand: string, cmdArgs: IORedisCommandArgs): string[] | undefined {\n try {\n if (cmdArgs.length === 0) {\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const processArg = (arg: string | Buffer | number | any[]): string[] => {\n if (typeof arg === 'string' || typeof arg === 'number' || Buffer.isBuffer(arg)) {\n return [arg.toString()];\n } else if (Array.isArray(arg)) {\n return flatten(arg.map(arg => processArg(arg)));\n } else {\n return ['<unknown>'];\n }\n };\n\n const firstArg = cmdArgs[0];\n if (isInCommands(SINGLE_ARG_COMMANDS, redisCommand) && firstArg != null) {\n return processArg(firstArg);\n }\n\n return flatten(cmdArgs.map(arg => processArg(arg)));\n } catch {\n return undefined;\n }\n}\n\n/** Determines whether a redis operation should be considered as \"cache operation\" by checking if a key is prefixed.\n * We only support certain commands (such as 'set', 'get', 'mget'). */\nexport function shouldConsiderForCache(redisCommand: string, keys: string[], prefixes: string[]): boolean {\n if (!getCacheOperation(redisCommand)) {\n return false;\n }\n\n for (const key of keys) {\n if (keyHasPrefix(key, prefixes)) {\n return true;\n }\n }\n return false;\n}\n\n/** Calculates size based on the cache response value */\nexport function calculateCacheItemSize(response: unknown): number | undefined {\n const getSize = (value: unknown): number | undefined => {\n try {\n if (Buffer.isBuffer(value)) return value.byteLength;\n else if (typeof value === 'string') return value.length;\n else if (typeof value === 'number') return value.toString().length;\n else if (value === null || value === undefined) return 0;\n return JSON.stringify(value).length;\n } catch {\n return undefined;\n }\n };\n\n return Array.isArray(response)\n ? response.reduce((acc: number | undefined, curr) => {\n const size = getSize(curr);\n return typeof size === 'number' ? (acc !== undefined ? acc + size : size) : acc;\n }, 0)\n : getSize(response);\n}\n\ntype NestedArray<T> = Array<NestedArray<T> | T>;\n\nfunction flatten<T>(input: NestedArray<T>): T[] {\n const result: T[] = [];\n\n const flattenHelper = (input: NestedArray<T>): void => {\n input.forEach((el: T | NestedArray<T>) => {\n if (Array.isArray(el)) {\n flattenHelper(el);\n } else {\n result.push(el);\n }\n });\n };\n\n flattenHelper(input);\n return result;\n}\n"],"names":["arg","input"],"mappings":";;AAEA,MAAM,mBAAA,GAAsB,CAAC,KAAA,EAAO,KAAA,EAAO,OAAO,CAAA;AAE3C,MAAM,YAAA,GAAe,CAAC,KAAA,EAAO,MAAM;AACnC,MAAM,YAAA,GAAe,CAAC,KAAA,EAAO,OAAO;AACpC,MAAM,eAAA,GAAkB,CAAC,KAAA,EAAO,QAAQ;AAKxC,SAAS,YAAA,CAAa,eAAyB,OAAA,EAA0B;AAC9E,EAAA,OAAO,aAAA,CAAc,QAAA,CAAS,OAAA,CAAQ,WAAA,EAAa,CAAA;AACrD;AAGO,SAAS,kBAAkB,OAAA,EAAyE;AACzG,EAAA,IAAI,YAAA,CAAa,YAAA,EAAc,OAAO,CAAA,EAAG;AACvC,IAAA,OAAO,WAAA;AAAA,EACT,CAAA,MAAA,IAAW,YAAA,CAAa,YAAA,EAAc,OAAO,CAAA,EAAG;AAC9C,IAAA,OAAO,WAAA;A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CAAC,CAAA,GACJ,OAAA,CAAQ,QAAQ,CAAA;AACtB;AAIA,SAAS,QAAW,KAAA,EAA4B;AAC9C,EAAA,MAAM,SAAc,EAAC;AAErB,EAAA,MAAM,aAAA,GAAgB,CAACC,MAAAA,KAAgC;AACrD,IAAAA,MAAAA,CAAM,OAAA,CAAQ,CAAC,EAAA,KAA2B;AACxC,MAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,EAAE,CAAA,EAAG;AACrB,QAAA,aAAA,CAAc,EAAE,CAAA;AAAA,MAClB,CAAA,MAAO;AACL,QAAA,MAAA,CAAO,KAAK,EAAE,CAAA;AAAA,MAChB;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA;AAEA,EAAA,aAAA,CAAc,KAAK,CAAA;AACnB,EAAA,OAAO,MAAA;AACT;;;;;;;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { setupExpressErrorHandler as setupExpressErrorHandler$1 } from '@sentry/core';
|
|
2
|
-
export { expressErrorHandler } from '@sentry/core';
|
|
3
|
-
|
|
4
|
-
function setupExpressErrorHandler(app, options) {
|
|
5
|
-
setupExpressErrorHandler$1(app, options);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export { setupExpressErrorHandler };
|
|
9
|
-
//# sourceMappingURL=express.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["import { setupExpressErrorHandler as coreSetupExpressErrorHandler, type ExpressHandlerOptions } from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n}\n"],"names":["coreSetupExpressErrorHandler"],"mappings":";;;AAGO,SAAS,wBAAA,CAEd,KACA,OAAA,EACM;AACN,EAAAA,0BAAA,CAA6B,KAAK,OAAO,CAAA;AAC3C;;;;"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, getClient } from '@sentry/core';
|
|
2
|
-
import { fastifyIntegration as fastifyIntegration$1, handleFastifyError } from '@sentry/server-utils';
|
|
3
|
-
export { instrumentFastify } from '@sentry/server-utils';
|
|
4
|
-
|
|
5
|
-
const INTEGRATION_NAME = "Fastify";
|
|
6
|
-
function getFastifyIntegration() {
|
|
7
|
-
const client = getClient();
|
|
8
|
-
if (!client) {
|
|
9
|
-
return void 0;
|
|
10
|
-
} else {
|
|
11
|
-
return client.getIntegrationByName(INTEGRATION_NAME);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const fastifyIntegration = defineIntegration(
|
|
15
|
-
(options = {}) => fastifyIntegration$1(options)
|
|
16
|
-
);
|
|
17
|
-
function setupFastifyErrorHandler(fastify, options) {
|
|
18
|
-
if (options?.shouldHandleError) {
|
|
19
|
-
getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);
|
|
20
|
-
}
|
|
21
|
-
const plugin = Object.assign(
|
|
22
|
-
function(fastify2, _options, done) {
|
|
23
|
-
fastify2.addHook("onError", async (request, reply, error) => {
|
|
24
|
-
handleFastifyError.call(handleFastifyError, error, request, reply, "onError-hook");
|
|
25
|
-
});
|
|
26
|
-
done();
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
[/* @__PURE__ */ Symbol.for("skip-override")]: true,
|
|
30
|
-
[/* @__PURE__ */ Symbol.for("fastify.display-name")]: "sentry-fastify-error-handler"
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
fastify.register(plugin);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { fastifyIntegration, setupFastifyErrorHandler };
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { defineIntegration, getClient } from '@sentry/core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\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\ninterface FastifyHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\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 * @example\n *\n *\n * ```javascript\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 400;\n * },\n * });\n * ```\n *\n *\n * If using TypeScript, you can cast the request and reply to get full type safety.\n *\n * ```typescript\n * import type { FastifyRequest, FastifyReply } from 'fastify';\n *\n * setupFastifyErrorHandler(app, {\n * shouldHandleError(error, minimalRequest, minimalReply) {\n * const request = minimalRequest as FastifyRequest;\n * const reply = minimalReply as FastifyReply;\n * return reply.statusCode >= 500;\n * },\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst INTEGRATION_NAME = 'Fastify' as const;\n\nfunction getFastifyIntegration(): FastifyIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n } else {\n return client.getIntegrationByName(INTEGRATION_NAME);\n }\n}\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n *\n * If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.\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 serverUtilsFastifyIntegration(options),\n);\n\n/**\n * Add an Fastify error handler to capture errors to Sentry.\n *\n * @param fastify The Fastify instance to which to add the error handler\n * @param options Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Fastify = require(\"fastify\");\n *\n * const app = Fastify();\n *\n * Sentry.setupFastifyErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen({ port: 3000 });\n * ```\n */\nexport function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {\n if (options?.shouldHandleError) {\n getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);\n }\n\n const plugin = Object.assign(\n function (fastify: FastifyInstance, _options: unknown, done: () => void): void {\n fastify.addHook('onError', async (request, reply, error) => {\n // oxlint-disable-next-line typescript/no-deprecated\n handleFastifyError.call(handleFastifyError, error, request, reply, 'onError-hook');\n });\n done();\n },\n {\n [Symbol.for('skip-override')]: true,\n [Symbol.for('fastify.display-name')]: 'sentry-fastify-error-handler',\n },\n );\n\n fastify.register(plugin);\n}\n"],"names":["serverUtilsFastifyIntegration","fastify"],"mappings":";;;;AA4FA,MAAM,gBAAA,GAAmB,SAAA;AAEzB,SAAS,qBAAA,GAAwD;AAC/D,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,MAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,MAAA,CAAO,qBAAqB,gBAAgB,CAAA;AAAA,EACrD;AACF;AAkBO,MAAM,kBAAA,GAAqB,iBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClGA,qBAA8B,OAAO;AACvC;AAsBO,SAAS,wBAAA,CAAyB,SAAyB,OAAA,EAAgD;AAChH,EAAA,IAAI,SAAS,iBAAA,EAAmB;AAC9B,IAAA,qBAAA,EAAsB,EAAG,oBAAA,CAAqB,OAAA,CAAQ,iBAAiB,CAAA;AAAA,EACzE;AAEA,EAAA,MAAM,SAAS,MAAA,CAAO,MAAA;AAAA,IACpB,SAAUC,QAAAA,EAA0B,QAAA,EAAmB,IAAA,EAAwB;AAC7E,MAAAA,SAAQ,OAAA,CAAQ,SAAA,EAAW,OAAO,OAAA,EAAS,OAAO,KAAA,KAAU;AAE1D,QAAA,kBAAA,CAAmB,IAAA,CAAK,kBAAA,EAAoB,KAAA,EAAO,OAAA,EAAS,OAAO,cAAc,CAAA;AAAA,MACnF,CAAC,CAAA;AACD,MAAA,IAAA,EAAK;AAAA,IACP,CAAA;AAAA,IACA;AAAA,MACE,iBAAC,MAAA,CAAO,GAAA,CAAI,eAAe,CAAC,GAAG,IAAA;AAAA,MAC/B,iBAAC,MAAA,CAAO,GAAA,CAAI,sBAAsB,CAAC,GAAG;AAAA;AACxC,GACF;AAEA,EAAA,OAAA,CAAQ,SAAS,MAAM,CAAA;AACzB;;;;"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SDK_VERSION, getIsolationScope, getDefaultIsolationScope, debug, captureException } from '@sentry/core';
|
|
2
|
-
import { DEBUG_BUILD } from '../../../debug-build.js';
|
|
3
|
-
|
|
4
|
-
function isErrorEvent(event) {
|
|
5
|
-
return !!(event && typeof event === "object" && "error" in event && event.error);
|
|
6
|
-
}
|
|
7
|
-
function sendErrorToSentry(errorData) {
|
|
8
|
-
captureException(errorData, {
|
|
9
|
-
mechanism: {
|
|
10
|
-
type: "auto.function.hapi",
|
|
11
|
-
handled: false
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
const hapiErrorPlugin = {
|
|
16
|
-
name: "SentryHapiErrorPlugin",
|
|
17
|
-
version: SDK_VERSION,
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
register: async function(serverArg) {
|
|
20
|
-
const server = serverArg;
|
|
21
|
-
server.events.on({ name: "request", channels: ["error"] }, (request, event) => {
|
|
22
|
-
if (getIsolationScope() !== getDefaultIsolationScope()) {
|
|
23
|
-
const route = request.route;
|
|
24
|
-
if (route.path) {
|
|
25
|
-
getIsolationScope().setTransactionName(`${route.method.toUpperCase()} ${route.path}`);
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
DEBUG_BUILD && debug.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");
|
|
29
|
-
}
|
|
30
|
-
if (isErrorEvent(event)) {
|
|
31
|
-
sendErrorToSentry(event.error);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
async function setupHapiErrorHandler(server) {
|
|
37
|
-
await server.register(hapiErrorPlugin);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { hapiErrorPlugin, setupHapiErrorHandler };
|
|
41
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/hapi/index.ts"],"sourcesContent":["import { captureException, debug, getDefaultIsolationScope, getIsolationScope, SDK_VERSION } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport type { Request, RequestEvent, Server } from './types';\n\nfunction isErrorEvent(event: unknown): event is RequestEvent {\n return !!(event && typeof event === 'object' && 'error' in event && event.error);\n}\n\nfunction sendErrorToSentry(errorData: object): void {\n captureException(errorData, {\n mechanism: {\n type: 'auto.function.hapi',\n handled: false,\n },\n });\n}\n\nexport const hapiErrorPlugin = {\n name: 'SentryHapiErrorPlugin',\n version: SDK_VERSION,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register: async function (serverArg: Record<any, any>) {\n const server = serverArg as unknown as Server;\n\n server.events.on({ name: 'request', channels: ['error'] }, (request: Request, event: RequestEvent) => {\n if (getIsolationScope() !== getDefaultIsolationScope()) {\n const route = request.route;\n if (route.path) {\n getIsolationScope().setTransactionName(`${route.method.toUpperCase()} ${route.path}`);\n }\n } else {\n DEBUG_BUILD &&\n debug.warn('Isolation scope is still the default isolation scope - skipping setting transactionName');\n }\n\n if (isErrorEvent(event)) {\n sendErrorToSentry(event.error);\n }\n });\n },\n};\n\n/**\n * Add a Hapi plugin to capture errors to Sentry.\n *\n * @param server The Hapi server to attach the error handler to\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Hapi = require('@hapi/hapi');\n *\n * const init = async () => {\n * const server = Hapi.server();\n *\n * // all your routes here\n *\n * await Sentry.setupHapiErrorHandler(server);\n *\n * await server.start();\n * };\n * ```\n */\nexport async function setupHapiErrorHandler(server: Server): Promise<void> {\n await server.register(hapiErrorPlugin);\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,aAAa,KAAA,EAAuC;AAC3D,EAAA,OAAO,CAAC,EAAE,KAAA,IAAS,OAAO,UAAU,QAAA,IAAY,OAAA,IA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|
-
|
|
3
|
-
const setupKoaErrorHandler = (app) => {
|
|
4
|
-
app.use(async (ctx, next) => {
|
|
5
|
-
try {
|
|
6
|
-
await next();
|
|
7
|
-
} catch (error) {
|
|
8
|
-
captureException(error, {
|
|
9
|
-
mechanism: {
|
|
10
|
-
handled: false,
|
|
11
|
-
type: "auto.middleware.koa"
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { setupKoaErrorHandler };
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/koa/index.ts"],"sourcesContent":["import { captureException } from '@sentry/core';\n\n/**\n * Add an Koa error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Koa = require(\"koa\");\n *\n * const app = new Koa();\n *\n * Sentry.setupKoaErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen(3000);\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => Promise<void>) => void }): void => {\n app.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.middleware.koa',\n },\n });\n throw error;\n }\n });\n};\n"],"names":[],"mappings":";;AAyBO,MAAM,oBAAA,GAAuB,CAAC,GAAA,KAA+E;AAClH,EAAA,GAAA,CAAI,GAAA,CAAI,OAAO,GAAA,EAAK,IAAA,KAAS;AAC3B,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,EAAK;AAAA,IACb,SAAS,KAAA,EAAO;AACd,MAAA,gBAAA,CAAiB,KAAA,EAAO;AAAA,QACtB,SAAA,EAAW;AAAA,UACT,OAAA,EAAS,KAAA;AAAA,UACT,IAAA,EAAM;AAAA;AACR,OACD,CAAA;AACD,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { spanToJSON, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_SENTRY_OP, truncate, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
|
|
2
|
-
import { getCacheKeySafely, getCacheOperation, shouldConsiderForCache, isInCommands, calculateCacheItemSize, REMOVE_COMMANDS, GET_COMMANDS } from '../../../utils/redisCache.js';
|
|
3
|
-
import { NET_PEER_NAME, SERVER_ADDRESS, NET_PEER_PORT, SERVER_PORT, NETWORK_PEER_PORT, NETWORK_PEER_ADDRESS } from '@sentry/conventions/attributes';
|
|
4
|
-
|
|
5
|
-
let _redisOptions = {};
|
|
6
|
-
function setRedisOptions(options) {
|
|
7
|
-
_redisOptions = options;
|
|
8
|
-
}
|
|
9
|
-
const cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
10
|
-
const safeKey = getCacheKeySafely(redisCommand, cmdArgs);
|
|
11
|
-
const cacheOperation = getCacheOperation(redisCommand);
|
|
12
|
-
if (!safeKey || !cacheOperation || !_redisOptions.cachePrefixes || !shouldConsiderForCache(redisCommand, safeKey, _redisOptions.cachePrefixes)) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const attributes = spanToJSON(span).attributes;
|
|
16
|
-
const networkPeerAddress = attributes[NET_PEER_NAME] ?? attributes[SERVER_ADDRESS];
|
|
17
|
-
const networkPeerPort = attributes[NET_PEER_PORT] ?? attributes[SERVER_PORT];
|
|
18
|
-
if (networkPeerPort && networkPeerAddress) {
|
|
19
|
-
span.setAttributes({ [NETWORK_PEER_ADDRESS]: networkPeerAddress, [NETWORK_PEER_PORT]: networkPeerPort });
|
|
20
|
-
}
|
|
21
|
-
const cacheItemSize = isInCommands(REMOVE_COMMANDS, redisCommand) ? void 0 : calculateCacheItemSize(response);
|
|
22
|
-
if (cacheItemSize) {
|
|
23
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);
|
|
24
|
-
}
|
|
25
|
-
if (isInCommands(GET_COMMANDS, redisCommand) && cacheItemSize !== void 0) {
|
|
26
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);
|
|
27
|
-
}
|
|
28
|
-
span.setAttributes({
|
|
29
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,
|
|
30
|
-
[SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey
|
|
31
|
-
});
|
|
32
|
-
const spanDescription = safeKey.join(", ");
|
|
33
|
-
span.updateName(
|
|
34
|
-
_redisOptions.maxCacheKeyLength ? truncate(spanDescription, _redisOptions.maxCacheKeyLength) : spanDescription
|
|
35
|
-
);
|
|
36
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, void 0);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { _redisOptions, cacheResponseHook, setRedisOptions };
|
|
40
|
-
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sources":["../../../../../src/integrations/tracing/redis/cache.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_CACHE_HIT,\n SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE,\n SEMANTIC_ATTRIBUTE_CACHE_KEY,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n truncate,\n} from '@sentry/core';\nimport type { IORedisCommandArgs } from '../../../utils/redisCache';\nimport {\n calculateCacheItemSize,\n GET_COMMANDS,\n getCacheKeySafely,\n getCacheOperation,\n isInCommands,\n REMOVE_COMMANDS,\n shouldConsiderForCache,\n} from '../../../utils/redisCache';\nimport type { IORedisResponseCustomAttributeFunction } from './vendored/types';\nimport {\n NET_PEER_NAME,\n NET_PEER_PORT,\n NETWORK_PEER_ADDRESS,\n NETWORK_PEER_PORT,\n SERVER_ADDRESS,\n SERVER_PORT,\n} from '@sentry/conventions/attributes';\n\n// This module deliberately does NOT import the vendored OTel `IORedisInstrumentation`/\n// `RedisInstrumentation`, so the orchestrion opt-in can pull `cacheResponseHook`\n// without dragging the OTel redis instrumentation into its module graph.\n\nexport interface RedisOptions {\n /**\n * Define cache prefixes for cache keys that should be captured as a cache span.\n *\n * Setting this to, for example, `['user:']` will capture cache keys that start with `user:`.\n */\n cachePrefixes?: string[];\n /**\n * Maximum length of the cache key added to the span description. If the key exceeds this length, it will be truncated.\n *\n * Passing `0` will use the full cache key without truncation.\n *\n * By default, the full cache key is used.\n */\n maxCacheKeyLength?: number;\n}\n\n/* Only exported for testing purposes */\nexport let _redisOptions: RedisOptions = {};\n\n/** Set the options consumed by {@link cacheResponseHook}. */\nexport function setRedisOptions(options: RedisOptions): void {\n _redisOptions = options;\n}\n\n/* Only exported for testing purposes */\nexport const cacheResponseHook: IORedisResponseCustomAttributeFunction = (\n span: Span,\n redisCommand: string,\n cmdArgs: IORedisCommandArgs,\n response: unknown,\n) => {\n const safeKey = getCacheKeySafely(redisCommand, cmdArgs);\n const cacheOperation = getCacheOperation(redisCommand);\n\n if (\n !safeKey ||\n !cacheOperation ||\n !_redisOptions.cachePrefixes ||\n !shouldConsiderForCache(redisCommand, safeKey, _redisOptions.cachePrefixes)\n ) {\n // not relevant for cache\n return;\n }\n\n // otel/ioredis seems to be using the old standard, as there was a change to those params: https://github.com/open-telemetry/opentelemetry-specification/issues/3199\n // We are using params based on the docs: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/\n // Fall back to stable semconv attributes (server.address/server.port) when\n // old-semconv ones are absent, eg OTEL_SEMCONV_STABILITY_OPT_IN=database\n // set for node-redis v4/v5.\n const attributes = spanToJSON(span).attributes;\n // oxlint-disable-next-line typescript/no-deprecated\n const networkPeerAddress = (attributes[NET_PEER_NAME] ?? attributes[SERVER_ADDRESS]) as string | undefined;\n // oxlint-disable-next-line typescript/no-deprecated\n const networkPeerPort = (attributes[NET_PEER_PORT] ?? attributes[SERVER_PORT]) as number | undefined;\n\n if (networkPeerPort && networkPeerAddress) {\n span.setAttributes({ [NETWORK_PEER_ADDRESS]: networkPeerAddress, [NETWORK_PEER_PORT]: networkPeerPort });\n }\n\n // A remove response is a delete-count, not a cached value, so its size is meaningless.\n const cacheItemSize = isInCommands(REMOVE_COMMANDS, redisCommand) ? undefined : calculateCacheItemSize(response);\n\n if (cacheItemSize) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, cacheItemSize);\n }\n\n if (isInCommands(GET_COMMANDS, redisCommand) && cacheItemSize !== undefined) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_CACHE_HIT, cacheItemSize > 0);\n }\n\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation,\n [SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey,\n });\n\n // todo: change to string[] once EAP supports it\n const spanDescription = safeKey.join(', ');\n\n span.updateName(\n _redisOptions.maxCacheKeyLength ? truncate(spanDescription, _redisOptions.maxCacheKeyLength) : spanDescription,\n );\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, undefined);\n};\n"],"names":[],"mappings":";;;;AAoDO,IAAI,gBAA8B;AAGlC,SAAS,gBAAgB,OAAA,EAA6B;AAC3D,EAAA,aAAA,GAAgB,OAAA;AAClB;AAGO,MAAM,iBAAA,GAA4D,CACvE,IAAA,EACA,YAAA,EACA,SACA,QAAA,KACG;AACH,EAAA,MAAM,OAAA,GAAU,i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,EAAA,IAAA,CAAK,UAAA;AAAA,IACH,cAAc,iBAAA,GAAoB,QAAA,CAAS,eAAA,EAAiB,aAAA,CAAc,iBAAiB,CAAA,GAAI;AAAA,GACjG;AACA,EAAA,IAAA,CAAK,YAAA,CAAa,kCAAkC,MAAS,CAAA;AAC/D;;;;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineIntegration, extendIntegration } from '@sentry/core';
|
|
2
|
-
import { redisIntegration as redisIntegration$1 } from '@sentry/server-utils';
|
|
3
|
-
import { ioredisChannelIntegration, redisChannelIntegration } from '@sentry/server-utils/orchestrion';
|
|
4
|
-
import { cacheResponseHook, setRedisOptions } from './cache.js';
|
|
5
|
-
export { _redisOptions } from './cache.js';
|
|
6
|
-
|
|
7
|
-
const INTEGRATION_NAME = "Redis";
|
|
8
|
-
const _redisIntegration = ((options = {}) => {
|
|
9
|
-
const orchestrionIntegrations = [
|
|
10
|
-
ioredisChannelIntegration({ responseHook: cacheResponseHook }),
|
|
11
|
-
redisChannelIntegration({ responseHook: cacheResponseHook })
|
|
12
|
-
];
|
|
13
|
-
return extendIntegration(redisIntegration$1({ responseHook: cacheResponseHook }), {
|
|
14
|
-
name: INTEGRATION_NAME,
|
|
15
|
-
setupOnce() {
|
|
16
|
-
setRedisOptions(options);
|
|
17
|
-
},
|
|
18
|
-
setup(client) {
|
|
19
|
-
for (const integration of orchestrionIntegrations) {
|
|
20
|
-
integration.setup?.(client);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
const redisIntegration = defineIntegration(_redisIntegration);
|
|
26
|
-
|
|
27
|
-
export { cacheResponseHook, redisIntegration };
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/redis/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration } from '@sentry/core';\nimport { redisIntegration as redisNativeChannelIntegration } from '@sentry/server-utils';\nimport { ioredisChannelIntegration, redisChannelIntegration } from '@sentry/server-utils/orchestrion';\nimport { cacheResponseHook, type RedisOptions, setRedisOptions } from './cache';\n\n// `cacheResponseHook`/`_redisOptions` live in `./cache` (which has no OTel\n// instrumentation imports) so the orchestrion opt-in can pull the hook without\n// dragging the OTel redis instrumentation in. Re-exported here for tests.\nexport { _redisOptions, cacheResponseHook } from './cache';\n\nconst INTEGRATION_NAME = 'Redis' as const;\n\nconst _redisIntegration = ((options: RedisOptions = {}) => {\n // A single public `Redis` integration covers every redis client version. The native\n // diagnostics_channel subscription (node-redis >= 5.12.0, ioredis >= 5.11.0, and batches) lives in\n // server-utils so it is shared across server runtimes; the orchestrion channel integrations cover\n // the older node-redis (`<5.12.0`) and ioredis (`<5.11.0`) ranges. We fold the orchestrion\n // subscribers into this integration's `setup` so `Sentry.redisIntegration()` alone instruments\n // all ranges, even with `defaultIntegrations: []`. All three share the node cache `responseHook`,\n // which reads the options set below but only runs at command time, by which point they are set.\n const orchestrionIntegrations = [\n ioredisChannelIntegration({ responseHook: cacheResponseHook }),\n redisChannelIntegration({ responseHook: cacheResponseHook }),\n ];\n\n return extendIntegration(redisNativeChannelIntegration({ responseHook: cacheResponseHook }), {\n name: INTEGRATION_NAME,\n setupOnce() {\n setRedisOptions(options);\n },\n setup(client) {\n for (const integration of orchestrionIntegrations) {\n integration.setup?.(client);\n }\n },\n });\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [redis](https://www.npmjs.com/package/redis) and\n * [ioredis](https://www.npmjs.com/package/ioredis) libraries.\n *\n * For more information, see the [`redisIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/redis/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.redisIntegration()],\n * });\n * ```\n */\nexport const redisIntegration = defineIntegration(_redisIntegration);\n"],"names":["redisNativeChannelIntegration"],"mappings":";;;;;;AAWA,MAAM,gBAAA,GAAmB,OAAA;AAEzB,MAAM,iBAAA,IAAqB,CAAC,OAAA,GAAwB,EAAC,KAAM;AAQzD,EAAA,MAAM,uBAAA,GAA0B;AAAA,IAC9B,yBAAA,CAA0B,EAAE,YAAA,EAAc,iBAAA,EAAmB,CAAA;AAAA,IAC7D,uBAAA,CAAwB,EAAE,YAAA,EAAc,iBAAA,EAAmB;AAAA,GAC7D;AAEA,EAAA,OAAO,kBAAkBA,kBAAA,CAA8B,EAAE,YAAA,EAAc,iBAAA,EAAmB,CAAA,EAAG;AAAA,IAC3F,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,eAAA,CAAgB,OAAO,CAAA;AAAA,IACzB,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,KAAA,MAAW,eAAe,uBAAA,EAAyB;AACjD,QAAA,WAAA,CAAY,QAAQ,MAAM,CAAA;AAAA,MAC5B;AAAA,IACF;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAiBO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const SINGLE_ARG_COMMANDS = ["get", "set", "setex"];
|
|
2
|
-
const GET_COMMANDS = ["get", "mget"];
|
|
3
|
-
const SET_COMMANDS = ["set", "setex"];
|
|
4
|
-
const REMOVE_COMMANDS = ["del", "unlink"];
|
|
5
|
-
function isInCommands(redisCommands, command) {
|
|
6
|
-
return redisCommands.includes(command.toLowerCase());
|
|
7
|
-
}
|
|
8
|
-
function getCacheOperation(command) {
|
|
9
|
-
if (isInCommands(GET_COMMANDS, command)) {
|
|
10
|
-
return "cache.get";
|
|
11
|
-
} else if (isInCommands(SET_COMMANDS, command)) {
|
|
12
|
-
return "cache.put";
|
|
13
|
-
} else if (isInCommands(REMOVE_COMMANDS, command)) {
|
|
14
|
-
return "cache.remove";
|
|
15
|
-
} else {
|
|
16
|
-
return void 0;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function keyHasPrefix(key, prefixes) {
|
|
20
|
-
return prefixes.some((prefix) => key.startsWith(prefix));
|
|
21
|
-
}
|
|
22
|
-
function getCacheKeySafely(redisCommand, cmdArgs) {
|
|
23
|
-
try {
|
|
24
|
-
if (cmdArgs.length === 0) {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
|
-
const processArg = (arg) => {
|
|
28
|
-
if (typeof arg === "string" || typeof arg === "number" || Buffer.isBuffer(arg)) {
|
|
29
|
-
return [arg.toString()];
|
|
30
|
-
} else if (Array.isArray(arg)) {
|
|
31
|
-
return flatten(arg.map((arg2) => processArg(arg2)));
|
|
32
|
-
} else {
|
|
33
|
-
return ["<unknown>"];
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const firstArg = cmdArgs[0];
|
|
37
|
-
if (isInCommands(SINGLE_ARG_COMMANDS, redisCommand) && firstArg != null) {
|
|
38
|
-
return processArg(firstArg);
|
|
39
|
-
}
|
|
40
|
-
return flatten(cmdArgs.map((arg) => processArg(arg)));
|
|
41
|
-
} catch {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function shouldConsiderForCache(redisCommand, keys, prefixes) {
|
|
46
|
-
if (!getCacheOperation(redisCommand)) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
for (const key of keys) {
|
|
50
|
-
if (keyHasPrefix(key, prefixes)) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
function calculateCacheItemSize(response) {
|
|
57
|
-
const getSize = (value) => {
|
|
58
|
-
try {
|
|
59
|
-
if (Buffer.isBuffer(value)) return value.byteLength;
|
|
60
|
-
else if (typeof value === "string") return value.length;
|
|
61
|
-
else if (typeof value === "number") return value.toString().length;
|
|
62
|
-
else if (value === null || value === void 0) return 0;
|
|
63
|
-
return JSON.stringify(value).length;
|
|
64
|
-
} catch {
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
return Array.isArray(response) ? response.reduce((acc, curr) => {
|
|
69
|
-
const size = getSize(curr);
|
|
70
|
-
return typeof size === "number" ? acc !== void 0 ? acc + size : size : acc;
|
|
71
|
-
}, 0) : getSize(response);
|
|
72
|
-
}
|
|
73
|
-
function flatten(input) {
|
|
74
|
-
const result = [];
|
|
75
|
-
const flattenHelper = (input2) => {
|
|
76
|
-
input2.forEach((el) => {
|
|
77
|
-
if (Array.isArray(el)) {
|
|
78
|
-
flattenHelper(el);
|
|
79
|
-
} else {
|
|
80
|
-
result.push(el);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
flattenHelper(input);
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { GET_COMMANDS, REMOVE_COMMANDS, SET_COMMANDS, calculateCacheItemSize, getCacheKeySafely, getCacheOperation, isInCommands, shouldConsiderForCache };
|
|
89
|
-
//# sourceMappingURL=redisCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redisCache.js","sources":["../../../src/utils/redisCache.ts"],"sourcesContent":["export type IORedisCommandArgs = Array<string | Buffer | number | unknown[]>;\n\nconst SINGLE_ARG_COMMANDS = ['get', 'set', 'setex'];\n\nexport const GET_COMMANDS = ['get', 'mget'];\nexport const SET_COMMANDS = ['set', 'setex'];\nexport const REMOVE_COMMANDS = ['del', 'unlink'];\n// todo: expire (no matching cache convention op yet)\n\n/** Checks if a given command is in the list of redis commands.\n * Useful because commands can come in lowercase or uppercase (depending on the library). */\nexport function isInCommands(redisCommands: string[], command: string): boolean {\n return redisCommands.includes(command.toLowerCase());\n}\n\n/** Determine cache operation based on redis statement */\nexport function getCacheOperation(command: string): 'cache.get' | 'cache.put' | 'cache.remove' | undefined {\n if (isInCommands(GET_COMMANDS, command)) {\n return 'cache.get';\n } else if (isInCommands(SET_COMMANDS, command)) {\n return 'cache.put';\n } else if (isInCommands(REMOVE_COMMANDS, command)) {\n return 'cache.remove';\n } else {\n return undefined;\n }\n}\n\nfunction keyHasPrefix(key: string, prefixes: string[]): boolean {\n return prefixes.some(prefix => key.startsWith(prefix));\n}\n\n/** Safely converts a redis key to a string (comma-separated if there are multiple keys) */\nexport function getCacheKeySafely(redisCommand: string, cmdArgs: IORedisCommandArgs): string[] | undefined {\n try {\n if (cmdArgs.length === 0) {\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const processArg = (arg: string | Buffer | number | any[]): string[] => {\n if (typeof arg === 'string' || typeof arg === 'number' || Buffer.isBuffer(arg)) {\n return [arg.toString()];\n } else if (Array.isArray(arg)) {\n return flatten(arg.map(arg => processArg(arg)));\n } else {\n return ['<unknown>'];\n }\n };\n\n const firstArg = cmdArgs[0];\n if (isInCommands(SINGLE_ARG_COMMANDS, redisCommand) && firstArg != null) {\n return processArg(firstArg);\n }\n\n return flatten(cmdArgs.map(arg => processArg(arg)));\n } catch {\n return undefined;\n }\n}\n\n/** Determines whether a redis operation should be considered as \"cache operation\" by checking if a key is prefixed.\n * We only support certain commands (such as 'set', 'get', 'mget'). */\nexport function shouldConsiderForCache(redisCommand: string, keys: string[], prefixes: string[]): boolean {\n if (!getCacheOperation(redisCommand)) {\n return false;\n }\n\n for (const key of keys) {\n if (keyHasPrefix(key, prefixes)) {\n return true;\n }\n }\n return false;\n}\n\n/** Calculates size based on the cache response value */\nexport function calculateCacheItemSize(response: unknown): number | undefined {\n const getSize = (value: unknown): number | undefined => {\n try {\n if (Buffer.isBuffer(value)) return value.byteLength;\n else if (typeof value === 'string') return value.length;\n else if (typeof value === 'number') return value.toString().length;\n else if (value === null || value === undefined) return 0;\n return JSON.stringify(value).length;\n } catch {\n return undefined;\n }\n };\n\n return Array.isArray(response)\n ? response.reduce((acc: number | undefined, curr) => {\n const size = getSize(curr);\n return typeof size === 'number' ? (acc !== undefined ? acc + size : size) : acc;\n }, 0)\n : getSize(response);\n}\n\ntype NestedArray<T> = Array<NestedArray<T> | T>;\n\nfunction flatten<T>(input: NestedArray<T>): T[] {\n const result: T[] = [];\n\n const flattenHelper = (input: NestedArray<T>): void => {\n input.forEach((el: T | NestedArray<T>) => {\n if (Array.isArray(el)) {\n flattenHelper(el);\n } else {\n result.push(el);\n }\n });\n };\n\n flattenHelper(input);\n return result;\n}\n"],"names":["arg","input"],"mappings":"AAEA,MAAM,mBAAA,GAAsB,CAAC,KAAA,EAAO,KAAA,EAAO,OAAO,CAAA;AAE3C,MAAM,YAAA,GAAe,CAAC,KAAA,EAAO,MAAM;AACnC,MAAM,YAAA,GAAe,CAAC,KAAA,EAAO,OAAO;AACpC,MAAM,eAAA,GAAkB,CAAC,KAAA,EAAO,QAAQ;AAKxC,SAAS,YAAA,CAAa,eAAyB,OAAA,EAA0B;AAC9E,EAAA,OAAO,aAAA,CAAc,QAAA,CAAS,OAAA,CAAQ,WAAA,EAAa,CAAA;AACrD;AAGO,SAAS,kBAAkB,OAAA,EAAyE;AACzG,EAAA,IAAI,YAAA,CAAa,YAAA,EAAc,OAAO,CAAA,EAAG;AACvC,IAAA,OAAO,WAAA;AAAA,EACT,CAAA,MAAA,IAAW,YAAA,CAAa,YAAA,EAAc,OAAO,CAAA,EAAG;AAC9C,IAAA,OAAO,WAAA;AAAA,EACT,CAAA,MAAA,IAAW,YAAA,CAAa,eAAA,EAAiB,OAAO,CAAA,EAAG;AACjD,IAAA,OAAO,cAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,YAAA,CAAa,KAAa,QAAA,EAA6B;AAC9D,EAAA,OAAO,SAAS,IAAA,CAAK,CAAA,MAAA,KAAU,GAAA,CAAI,UAAA,CAAW,MAAM,CAAC,CAAA;AACvD;AAGO,SAAS,iBAAA,CAAkB,cAAsB,OAAA,EAAmD;AACzG,EAAA,IAAI;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KAAK,EAAE,CAAA;AAAA,MAChB;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA;AAEA,EAAA,aAAA,CAAc,KAAK,CAAA;AACnB,EAAA,OAAO,MAAA;AACT;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ExpressHandlerOptions } from '@sentry/core';
|
|
2
|
-
export { expressErrorHandler } from '@sentry/core';
|
|
3
|
-
export declare function setupExpressErrorHandler(app: {
|
|
4
|
-
use: (middleware: any) => unknown;
|
|
5
|
-
}, options?: ExpressHandlerOptions): void;
|
|
6
|
-
//# sourceMappingURL=express.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,wBAAgB,wBAAwB,CAEtC,GAAG,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,OAAO,CAAA;CAAE,EAC1C,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAEN"}
|