@sentry/node 9.16.1 → 9.17.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 +18 -18
- package/build/cjs/integrations/anr/index.js +1 -1
- package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +187 -0
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -0
- package/build/cjs/integrations/tracing/fastify/v3/constants.js +23 -0
- package/build/cjs/integrations/tracing/fastify/v3/constants.js.map +1 -0
- package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js +37 -0
- package/build/cjs/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -0
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js +303 -0
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/fastify/v3/utils.js +135 -0
- package/build/cjs/integrations/tracing/fastify/v3/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/index.js +11 -10
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/esm/index.js +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/local-variables/local-variables-async.js +1 -1
- package/build/esm/integrations/local-variables/worker-script.js +2 -2
- package/build/esm/integrations/tracing/fastify/index.js +182 -0
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -0
- package/build/esm/integrations/tracing/fastify/v3/constants.js +21 -0
- package/build/esm/integrations/tracing/fastify/v3/constants.js.map +1 -0
- package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js +37 -0
- package/build/esm/integrations/tracing/fastify/v3/enums/AttributeNames.js.map +1 -0
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js +301 -0
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/fastify/v3/utils.js +131 -0
- package/build/esm/integrations/tracing/fastify/v3/utils.js.map +1 -0
- package/build/esm/integrations/tracing/index.js +2 -1
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/{types-ts3.8/integrations/tracing/fastify.d.ts → types/integrations/tracing/fastify/index.d.ts} +83 -103
- package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/types.d.ts +25 -0
- package/build/types/integrations/tracing/fastify/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/constants.d.ts +3 -0
- package/build/types/integrations/tracing/fastify/v3/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts +15 -0
- package/build/types/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts +16 -0
- package/build/types/integrations/tracing/fastify/v3/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/internal-types.d.ts +7 -0
- package/build/types/integrations/tracing/fastify/v3/internal-types.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/types.d.ts +21 -0
- package/build/types/integrations/tracing/fastify/v3/types.d.ts.map +1 -0
- package/build/types/integrations/tracing/fastify/v3/utils.d.ts +28 -0
- package/build/types/integrations/tracing/fastify/v3/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/{types/integrations/tracing/fastify.d.ts → types-ts3.8/integrations/tracing/fastify/index.d.ts} +83 -103
- package/build/types-ts3.8/integrations/tracing/fastify/types.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/constants.d.ts +3 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/enums/AttributeNames.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/instrumentation.d.ts +16 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/internal-types.d.ts +7 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/types.d.ts +21 -0
- package/build/types-ts3.8/integrations/tracing/fastify/v3/utils.d.ts +28 -0
- package/package.json +4 -4
- package/build/cjs/integrations/tracing/fastify.js +0 -160
- package/build/cjs/integrations/tracing/fastify.js.map +0 -1
- package/build/esm/integrations/tracing/fastify.js +0 -156
- package/build/esm/integrations/tracing/fastify.js.map +0 -1
- package/build/types/integrations/tracing/fastify.d.ts.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { SpanStatusCode } from '@opentelemetry/api';
|
|
2
|
+
import { spanRequestSymbol } from './constants.js';
|
|
3
|
+
|
|
4
|
+
// Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/407f61591ba69a39a6908264379d4d98a48dbec4/plugins/node/opentelemetry-instrumentation-fastify/src/utils.ts
|
|
5
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-dynamic-delete */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
9
|
+
/*
|
|
10
|
+
* Copyright The OpenTelemetry Authors
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Starts Span
|
|
28
|
+
* @param reply - reply function
|
|
29
|
+
* @param tracer - tracer
|
|
30
|
+
* @param spanName - span name
|
|
31
|
+
* @param spanAttributes - span attributes
|
|
32
|
+
*/
|
|
33
|
+
function startSpan(
|
|
34
|
+
reply,
|
|
35
|
+
tracer,
|
|
36
|
+
spanName,
|
|
37
|
+
spanAttributes = {},
|
|
38
|
+
) {
|
|
39
|
+
const span = tracer.startSpan(spanName, { attributes: spanAttributes });
|
|
40
|
+
|
|
41
|
+
const spans = reply[spanRequestSymbol] || [];
|
|
42
|
+
spans.push(span);
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
45
|
+
Object.defineProperty(reply, spanRequestSymbol, {
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: true,
|
|
48
|
+
value: spans,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return span;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Ends span
|
|
56
|
+
* @param reply - reply function
|
|
57
|
+
* @param err - error
|
|
58
|
+
*/
|
|
59
|
+
function endSpan(reply, err) {
|
|
60
|
+
const spans = reply[spanRequestSymbol] || [];
|
|
61
|
+
// there is no active span, or it has already ended
|
|
62
|
+
if (!spans.length) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// biome-ignore lint/complexity/noForEach: <explanation>
|
|
66
|
+
spans.forEach((span) => {
|
|
67
|
+
if (err) {
|
|
68
|
+
span.setStatus({
|
|
69
|
+
code: SpanStatusCode.ERROR,
|
|
70
|
+
message: err.message,
|
|
71
|
+
});
|
|
72
|
+
span.recordException(err);
|
|
73
|
+
}
|
|
74
|
+
span.end();
|
|
75
|
+
});
|
|
76
|
+
delete reply[spanRequestSymbol];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// @TODO after approve add this to instrumentation package and replace usage
|
|
80
|
+
// when it will be released
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* This function handles the missing case from instrumentation package when
|
|
84
|
+
* execute can either return a promise or void. And using async is not an
|
|
85
|
+
* option as it is producing unwanted side effects.
|
|
86
|
+
* @param execute - function to be executed
|
|
87
|
+
* @param onFinish - function called when function executed
|
|
88
|
+
* @param preventThrowingError - prevent to throw error when execute
|
|
89
|
+
* function fails
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
function safeExecuteInTheMiddleMaybePromise(
|
|
93
|
+
execute,
|
|
94
|
+
onFinish,
|
|
95
|
+
preventThrowingError,
|
|
96
|
+
) {
|
|
97
|
+
let error;
|
|
98
|
+
let result = undefined;
|
|
99
|
+
try {
|
|
100
|
+
result = execute();
|
|
101
|
+
|
|
102
|
+
if (isPromise(result)) {
|
|
103
|
+
result.then(
|
|
104
|
+
res => onFinish(undefined, res),
|
|
105
|
+
err => onFinish(err),
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
} catch (e) {
|
|
109
|
+
error = e;
|
|
110
|
+
} finally {
|
|
111
|
+
if (!isPromise(result)) {
|
|
112
|
+
onFinish(error, result);
|
|
113
|
+
if (error && true) {
|
|
114
|
+
// eslint-disable-next-line no-unsafe-finally
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// eslint-disable-next-line no-unsafe-finally
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function isPromise(val) {
|
|
124
|
+
return (
|
|
125
|
+
(typeof val === 'object' && val && typeof Object.getOwnPropertyDescriptor(val, 'then')?.value === 'function') ||
|
|
126
|
+
false
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { endSpan, safeExecuteInTheMiddleMaybePromise, startSpan };
|
|
131
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/fastify/v3/utils.ts"],"sourcesContent":["// Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/407f61591ba69a39a6908264379d4d98a48dbec4/plugins/node/opentelemetry-instrumentation-fastify/src/utils.ts\n/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable @typescript-eslint/no-dynamic-delete */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type Attributes, type Span, type Tracer, SpanStatusCode } from '@opentelemetry/api';\nimport { spanRequestSymbol } from './constants';\nimport type { PluginFastifyReply } from './internal-types';\n\n/**\n * Starts Span\n * @param reply - reply function\n * @param tracer - tracer\n * @param spanName - span name\n * @param spanAttributes - span attributes\n */\nexport function startSpan(\n reply: PluginFastifyReply,\n tracer: Tracer,\n spanName: string,\n spanAttributes: Attributes = {},\n) {\n const span = tracer.startSpan(spanName, { attributes: spanAttributes });\n\n const spans: Span[] = reply[spanRequestSymbol] || [];\n spans.push(span);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Object.defineProperty(reply, spanRequestSymbol, {\n enumerable: false,\n configurable: true,\n value: spans,\n });\n\n return span;\n}\n\n/**\n * Ends span\n * @param reply - reply function\n * @param err - error\n */\nexport function endSpan(reply: PluginFastifyReply, err?: any) {\n const spans = reply[spanRequestSymbol] || [];\n // there is no active span, or it has already ended\n if (!spans.length) {\n return;\n }\n // biome-ignore lint/complexity/noForEach: <explanation>\n spans.forEach((span: Span) => {\n if (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n span.end();\n });\n delete reply[spanRequestSymbol];\n}\n\n// @TODO after approve add this to instrumentation package and replace usage\n// when it will be released\n\n/**\n * This function handles the missing case from instrumentation package when\n * execute can either return a promise or void. And using async is not an\n * option as it is producing unwanted side effects.\n * @param execute - function to be executed\n * @param onFinish - function called when function executed\n * @param preventThrowingError - prevent to throw error when execute\n * function fails\n */\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): Promise<T>;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): T;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T | Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean,\n): T | Promise<T> | undefined {\n let error: unknown;\n let result: T | Promise<T> | undefined = undefined;\n try {\n result = execute();\n\n if (isPromise(result)) {\n result.then(\n res => onFinish(undefined, res),\n err => onFinish(err),\n );\n }\n } catch (e) {\n error = e;\n } finally {\n if (!isPromise(result)) {\n onFinish(error, result);\n if (error && !preventThrowingError) {\n // eslint-disable-next-line no-unsafe-finally\n throw error;\n }\n }\n // eslint-disable-next-line no-unsafe-finally\n return result;\n }\n}\n\nfunction isPromise<T>(val: T | Promise<T>): val is Promise<T> {\n return (\n (typeof val === 'object' && val && typeof Object.getOwnPropertyDescriptor(val, 'then')?.value === 'function') ||\n false\n );\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS;AACzB,EAAE,KAAK;AACP,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,cAAc,GAAe,EAAE;AACjC,EAAE;AACF,EAAE,MAAM,IAAA,GAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,cAAA,EAAgB,CAAC;;AAEzE,EAAE,MAAM,KAAK,GAAW,KAAK,CAAC,iBAAiB,CAAA,IAAK,EAAE;AACtD,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;;AAElB;AACA,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE;AAClD,IAAI,UAAU,EAAE,KAAK;AACrB,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,KAAK,EAAE,KAAK;AAChB,GAAG,CAAC;;AAEJ,EAAE,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,KAAK,EAAsB,GAAG,EAAQ;AAC9D,EAAE,MAAM,QAAQ,KAAK,CAAC,iBAAiB,CAAA,IAAK,EAAE;AAC9C;AACA,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;AACrB,IAAI;AACJ;AACA;AACA,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAW;AAChC,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,IAAI,CAAC,SAAS,CAAC;AACrB,QAAQ,IAAI,EAAE,cAAc,CAAC,KAAK;AAClC,QAAQ,OAAO,EAAE,GAAG,CAAC,OAAO;AAC5B,OAAO,CAAC;AACR,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;AAC/B;AACA,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,OAAO,KAAK,CAAC,iBAAiB,CAAC;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,SAAS,kCAAkC;AAClD,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,oBAAoB;AACtB,EAA8B;AAC9B,EAAE,IAAI,KAAK;AACX,EAAE,IAAI,MAAM,GAA+B,SAAS;AACpD,EAAE,IAAI;AACN,IAAI,MAAO,GAAE,OAAO,EAAE;;AAEtB,IAAI,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;AAC3B,MAAM,MAAM,CAAC,IAAI;AACjB,QAAQ,OAAO,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC;AACvC,QAAQ,GAAI,IAAG,QAAQ,CAAC,GAAG,CAAC;AAC5B,OAAO;AACP;AACA,GAAI,CAAA,OAAO,CAAC,EAAE;AACd,IAAI,KAAA,GAAQ,CAAC;AACb,YAAY;AACZ,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;AAC5B,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;AAC7B,MAAM,IAAI,KAAA,IAAS,IAAqB,EAAE;AAC1C;AACA,QAAQ,MAAM,KAAK;AACnB;AACA;AACA;AACA,IAAI,OAAO,MAAM;AACjB;AACA;;AAEA,SAAS,SAAS,CAAI,GAAG,EAAqC;AAC9D,EAAE;AACF,IAAI,CAAC,OAAO,GAAI,KAAI,YAAY,GAAA,IAAO,OAAO,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,KAAA,KAAU,UAAU;AAChH,IAAI;AACJ;AACA;;;;"}
|
|
@@ -2,7 +2,7 @@ import { instrumentOtelHttp } from '../http/index.js';
|
|
|
2
2
|
import { instrumentAmqplib, amqplibIntegration } from './amqplib.js';
|
|
3
3
|
import { instrumentConnect, connectIntegration } from './connect.js';
|
|
4
4
|
import { instrumentExpress, instrumentExpressV5, expressIntegration } from './express.js';
|
|
5
|
-
import { instrumentFastify, fastifyIntegration } from './fastify.js';
|
|
5
|
+
import { instrumentFastify, instrumentFastifyV3, fastifyIntegration } from './fastify/index.js';
|
|
6
6
|
import { instrumentGenericPool, genericPoolIntegration } from './genericPool.js';
|
|
7
7
|
import { instrumentGraphql, graphqlIntegration } from './graphql.js';
|
|
8
8
|
import { instrumentHapi, hapiIntegration } from './hapi/index.js';
|
|
@@ -57,6 +57,7 @@ function getOpenTelemetryInstrumentationToPreload() {
|
|
|
57
57
|
instrumentExpressV5,
|
|
58
58
|
instrumentConnect,
|
|
59
59
|
instrumentFastify,
|
|
60
|
+
instrumentFastifyV3,
|
|
60
61
|
instrumentHapi,
|
|
61
62
|
instrumentKafka,
|
|
62
63
|
instrumentKoa,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentOtelHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress, instrumentExpressV5 } from './express';\nimport { fastifyIntegration, instrumentFastify } from './fastify';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { instrumentKafka, kafkaIntegration } from './kafka';\nimport { instrumentKoa, koaIntegration } from './koa';\nimport { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';\nimport { instrumentMongo, mongoIntegration } from './mongo';\nimport { instrumentMongoose, mongooseIntegration } from './mongoose';\nimport { instrumentMysql, mysqlIntegration } from './mysql';\nimport { instrumentMysql2, mysql2Integration } from './mysql2';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { prismaIntegration } from './prisma';\nimport { instrumentRedis, redisIntegration } from './redis';\nimport { instrumentTedious, tediousIntegration } from './tedious';\nimport { instrumentVercelAi, vercelAIIntegration } from './vercelai';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n hapiIntegration(),\n koaIntegration(),\n connectIntegration(),\n tediousIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n vercelAIIntegration(),\n ];\n}\n\n/**\n * Get a list of methods to instrument OTEL, when preload instrumentation.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {\n return [\n instrumentOtelHttp,\n instrumentExpress,\n instrumentExpressV5,\n instrumentConnect,\n instrumentFastify,\n instrumentHapi,\n instrumentKafka,\n instrumentKoa,\n instrumentLruMemoizer,\n instrumentMongo,\n instrumentMongoose,\n instrumentMysql,\n instrumentMysql2,\n instrumentPostgres,\n instrumentHapi,\n instrumentGraphql,\n instrumentRedis,\n instrumentTedious,\n instrumentGenericPool,\n instrumentAmqplib,\n instrumentVercelAi,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA;AACA;AACA;AACO,SAAS,8BAA8B,GAAkB;AAChE,EAAE,OAAO;AACT,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,gBAAgB,EAAE;AACtB,IAAI,mBAAmB,EAAE;AACzB,IAAI,gBAAgB,EAAE;AACtB,IAAI,iBAAiB,EAAE;AACvB,IAAI,gBAAgB,EAAE;AACtB,IAAI,mBAAmB,EAAE;AACzB,IAAI,iBAAiB,EAAE;AACvB,IAAI,eAAe,EAAE;AACrB,IAAI,cAAc,EAAE;AACpB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,gBAAgB,EAAE;AACtB,IAAI,kBAAkB,EAAE;AACxB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,mBAAmB,EAAE;AACzB,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACO,SAAS,wCAAwC,GAAmD;AAC3G,EAAE,OAAO;AACT,IAAI,kBAAkB;AACtB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,qBAAqB;AACzB,IAAI,eAAe;AACnB,IAAI,kBAAkB;AACtB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,cAAc;AAClB,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,IAAI,qBAAqB;AACzB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentOtelHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress, instrumentExpressV5 } from './express';\nimport { fastifyIntegration, instrumentFastify, instrumentFastifyV3 } from './fastify';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { instrumentKafka, kafkaIntegration } from './kafka';\nimport { instrumentKoa, koaIntegration } from './koa';\nimport { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';\nimport { instrumentMongo, mongoIntegration } from './mongo';\nimport { instrumentMongoose, mongooseIntegration } from './mongoose';\nimport { instrumentMysql, mysqlIntegration } from './mysql';\nimport { instrumentMysql2, mysql2Integration } from './mysql2';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { prismaIntegration } from './prisma';\nimport { instrumentRedis, redisIntegration } from './redis';\nimport { instrumentTedious, tediousIntegration } from './tedious';\nimport { instrumentVercelAi, vercelAIIntegration } from './vercelai';\n\n/**\n * With OTEL, all performance integrations will be added, as OTEL only initializes them when the patched package is actually required.\n */\nexport function getAutoPerformanceIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n hapiIntegration(),\n koaIntegration(),\n connectIntegration(),\n tediousIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n vercelAIIntegration(),\n ];\n}\n\n/**\n * Get a list of methods to instrument OTEL, when preload instrumentation.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => void) & { id: string })[] {\n return [\n instrumentOtelHttp,\n instrumentExpress,\n instrumentExpressV5,\n instrumentConnect,\n instrumentFastify,\n instrumentFastifyV3,\n instrumentHapi,\n instrumentKafka,\n instrumentKoa,\n instrumentLruMemoizer,\n instrumentMongo,\n instrumentMongoose,\n instrumentMysql,\n instrumentMysql2,\n instrumentPostgres,\n instrumentHapi,\n instrumentGraphql,\n instrumentRedis,\n instrumentTedious,\n instrumentGenericPool,\n instrumentAmqplib,\n instrumentVercelAi,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA;AACA;AACA;AACO,SAAS,8BAA8B,GAAkB;AAChE,EAAE,OAAO;AACT,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,gBAAgB,EAAE;AACtB,IAAI,mBAAmB,EAAE;AACzB,IAAI,gBAAgB,EAAE;AACtB,IAAI,iBAAiB,EAAE;AACvB,IAAI,gBAAgB,EAAE;AACtB,IAAI,mBAAmB,EAAE;AACzB,IAAI,iBAAiB,EAAE;AACvB,IAAI,eAAe,EAAE;AACrB,IAAI,cAAc,EAAE;AACpB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,gBAAgB,EAAE;AACtB,IAAI,kBAAkB,EAAE;AACxB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,mBAAmB,EAAE;AACzB,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACO,SAAS,wCAAwC,GAAmD;AAC3G,EAAE,OAAO;AACT,IAAI,kBAAkB;AACtB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,qBAAqB;AACzB,IAAI,eAAe;AACnB,IAAI,kBAAkB;AACtB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,cAAc;AAClB,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,IAAI,qBAAqB;AACzB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,GAAG;AACH;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"9.
|
|
1
|
+
{"type":"module","version":"9.17.0","sideEffects":false}
|
|
@@ -1,103 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* @param fastify The Fastify instance to which to add the error handler
|
|
85
|
-
* @param options Configuration options for the handler
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```javascript
|
|
89
|
-
* const Sentry = require('@sentry/node');
|
|
90
|
-
* const Fastify = require("fastify");
|
|
91
|
-
*
|
|
92
|
-
* const app = Fastify();
|
|
93
|
-
*
|
|
94
|
-
* Sentry.setupFastifyErrorHandler(app);
|
|
95
|
-
*
|
|
96
|
-
* // Add your routes, etc.
|
|
97
|
-
*
|
|
98
|
-
* app.listen({ port: 3000 });
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export declare function setupFastifyErrorHandler(fastify: Fastify, options?: Partial<FastifyHandlerOptions>): void;
|
|
102
|
-
export {};
|
|
103
|
-
//# sourceMappingURL=fastify.d.ts.map
|
|
1
|
+
import type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { FastifyInstance, FastifyReply, FastifyRequest } from './types';
|
|
3
|
+
import { FastifyInstrumentationV3 } from './v3/instrumentation';
|
|
4
|
+
interface FastifyHandlerOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Callback method deciding whether error should be captured and sent to Sentry
|
|
7
|
+
*
|
|
8
|
+
* @param error Captured Fastify error
|
|
9
|
+
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
10
|
+
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```javascript
|
|
15
|
+
* setupFastifyErrorHandler(app, {
|
|
16
|
+
* shouldHandleError(_error, _request, reply) {
|
|
17
|
+
* return reply.statusCode >= 400;
|
|
18
|
+
* },
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
26
|
+
*
|
|
27
|
+
* setupFastifyErrorHandler(app, {
|
|
28
|
+
* shouldHandleError(error, minimalRequest, minimalReply) {
|
|
29
|
+
* const request = minimalRequest as FastifyRequest;
|
|
30
|
+
* const reply = minimalReply as FastifyReply;
|
|
31
|
+
* return reply.statusCode >= 500;
|
|
32
|
+
* },
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const instrumentFastifyV3: ((options?: unknown) => FastifyInstrumentationV3) & {
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const instrumentFastify: ((options?: unknown) => Instrumentation<InstrumentationConfig>) & {
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).
|
|
46
|
+
*
|
|
47
|
+
* If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.
|
|
48
|
+
*
|
|
49
|
+
* For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```javascript
|
|
53
|
+
* const Sentry = require('@sentry/node');
|
|
54
|
+
*
|
|
55
|
+
* Sentry.init({
|
|
56
|
+
* integrations: [Sentry.fastifyIntegration()],
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare const fastifyIntegration: () => import("@sentry/core").Integration;
|
|
61
|
+
/**
|
|
62
|
+
* Add an Fastify error handler to capture errors to Sentry.
|
|
63
|
+
*
|
|
64
|
+
* @param fastify The Fastify instance to which to add the error handler
|
|
65
|
+
* @param options Configuration options for the handler
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```javascript
|
|
69
|
+
* const Sentry = require('@sentry/node');
|
|
70
|
+
* const Fastify = require("fastify");
|
|
71
|
+
*
|
|
72
|
+
* const app = Fastify();
|
|
73
|
+
*
|
|
74
|
+
* Sentry.setupFastifyErrorHandler(app);
|
|
75
|
+
*
|
|
76
|
+
* // Add your routes, etc.
|
|
77
|
+
*
|
|
78
|
+
* app.listen({ port: 3000 });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare function setupFastifyErrorHandler(fastify: FastifyInstance, options?: Partial<FastifyHandlerOptions>): void;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAc7F,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,UAAU,qBAAqB;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5F;AAKD,eAAO,MAAM,mBAAmB;;CAAoF,CAAC;AAErH,eAAO,MAAM,iBAAiB;;CAuB5B,CAAC;AAYH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,0CAAyC,CAAC;AAazE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAqBjH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type HandlerOriginal = ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => Promise<void>) | ((request: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => void);
|
|
2
|
+
export type FastifyError = any;
|
|
3
|
+
export type HookHandlerDoneFunction = <TError extends Error = FastifyError>(err?: TError) => void;
|
|
4
|
+
export type FastifyErrorCodes = any;
|
|
5
|
+
export type FastifyPlugin = (instance: FastifyInstance, opts: any, done: HookHandlerDoneFunction) => unknown | Promise<unknown>;
|
|
6
|
+
export interface FastifyInstance {
|
|
7
|
+
version: string;
|
|
8
|
+
register: (plugin: any) => FastifyInstance;
|
|
9
|
+
after: (listener?: (err: Error) => void) => FastifyInstance;
|
|
10
|
+
addHook(hook: string, handler: HandlerOriginal): FastifyInstance;
|
|
11
|
+
addHook(hook: 'onError', handler: (request: FastifyRequest, reply: FastifyReply, error: Error) => void): FastifyInstance;
|
|
12
|
+
addHook(hook: 'onRequest', handler: (request: FastifyRequest, reply: FastifyReply) => void): FastifyInstance;
|
|
13
|
+
}
|
|
14
|
+
export interface FastifyReply {
|
|
15
|
+
send: () => FastifyReply;
|
|
16
|
+
statusCode: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FastifyRequest {
|
|
19
|
+
method?: string;
|
|
20
|
+
routeOptions?: {
|
|
21
|
+
url?: string;
|
|
22
|
+
};
|
|
23
|
+
routerPath?: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/fastify/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAChG,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC,CAAC;AAE5F,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAE/B,MAAM,MAAM,uBAAuB,GAAG,CAAC,MAAM,SAAS,KAAK,GAAG,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAElG,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC,MAAM,MAAM,aAAa,GAAG,CAC1B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,uBAAuB,KAC1B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,eAAe,CAAC;IAC3C,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,KAAK,eAAe,CAAC;IAC5D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC;IACjE,OAAO,CACL,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,GAC5E,eAAe,CAAC;IACnB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,eAAe,CAAC;CAC9G;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,YAAY,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,YAAY,CAAC,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/fastify/v3/constants.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB,eAAsE,CAAC;AAMrG,eAAO,MAAM,gBAAgB,aAU3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum AttributeNames {
|
|
2
|
+
FASTIFY_NAME = "fastify.name",
|
|
3
|
+
FASTIFY_TYPE = "fastify.type",
|
|
4
|
+
HOOK_NAME = "hook.name",
|
|
5
|
+
PLUGIN_NAME = "plugin.name"
|
|
6
|
+
}
|
|
7
|
+
export declare enum FastifyTypes {
|
|
8
|
+
MIDDLEWARE = "middleware",
|
|
9
|
+
REQUEST_HANDLER = "request_handler"
|
|
10
|
+
}
|
|
11
|
+
export declare enum FastifyNames {
|
|
12
|
+
MIDDLEWARE = "middleware",
|
|
13
|
+
REQUEST_HANDLER = "request handler"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AttributeNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributeNames.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/tracing/fastify/v3/enums/AttributeNames.ts"],"names":[],"mappings":"AAkBA,oBAAY,cAAc;IACxB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,YAAY;IACtB,UAAU,eAAe;IACzB,eAAe,oBAAoB;CACpC;AAED,oBAAY,YAAY;IACtB,UAAU,eAAe;IACzB,eAAe,oBAAoB;CACpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { FastifyInstrumentationConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Fastify instrumentation for OpenTelemetry
|
|
5
|
+
*/
|
|
6
|
+
export declare class FastifyInstrumentationV3 extends InstrumentationBase<FastifyInstrumentationConfig> {
|
|
7
|
+
constructor(config?: FastifyInstrumentationConfig);
|
|
8
|
+
init(): InstrumentationNodeModuleDefinition[];
|
|
9
|
+
private _hookOnRequest;
|
|
10
|
+
private _wrapHandler;
|
|
11
|
+
private _wrapAddHook;
|
|
12
|
+
private _patchConstructor;
|
|
13
|
+
private _patchSend;
|
|
14
|
+
private _hookPreHandler;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/fastify/v3/instrumentation.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,mBAAmB,EACnB,mCAAmC,EAEpC,MAAM,gCAAgC,CAAC;AAoBxC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAyB5D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,mBAAmB,CAAC,4BAA4B,CAAC;gBAC1E,MAAM,GAAE,4BAAiC;IAIrD,IAAI,IAAI,mCAAmC,EAAE;IAQpD,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,YAAY;IAwDpB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,eAAe;CA+CxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { FastifyReply } from '../types';
|
|
3
|
+
import type { spanRequestSymbol } from './constants';
|
|
4
|
+
export type PluginFastifyReply = FastifyReply & {
|
|
5
|
+
[spanRequestSymbol]?: Span[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/fastify/v3/internal-types.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
export interface FastifyRequestInfo {
|
|
4
|
+
request: any;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Function that can be used to add custom attributes to the current span
|
|
8
|
+
* @param span - The Fastify handler span.
|
|
9
|
+
* @param info - The Fastify request info object.
|
|
10
|
+
*/
|
|
11
|
+
export interface FastifyCustomAttributeFunction {
|
|
12
|
+
(span: Span, info: FastifyRequestInfo): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options available for the Fastify Instrumentation
|
|
16
|
+
*/
|
|
17
|
+
export interface FastifyInstrumentationConfig extends InstrumentationConfig {
|
|
18
|
+
/** Function for adding custom attributes to each handler span */
|
|
19
|
+
requestHook?: FastifyCustomAttributeFunction;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/fastify/v3/types.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,GAAG,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,iEAAiE;IACjE,WAAW,CAAC,EAAE,8BAA8B,CAAC;CAC9C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Attributes, type Span, type Tracer } from '@opentelemetry/api';
|
|
2
|
+
import type { PluginFastifyReply } from './internal-types';
|
|
3
|
+
/**
|
|
4
|
+
* Starts Span
|
|
5
|
+
* @param reply - reply function
|
|
6
|
+
* @param tracer - tracer
|
|
7
|
+
* @param spanName - span name
|
|
8
|
+
* @param spanAttributes - span attributes
|
|
9
|
+
*/
|
|
10
|
+
export declare function startSpan(reply: PluginFastifyReply, tracer: Tracer, spanName: string, spanAttributes?: Attributes): Span;
|
|
11
|
+
/**
|
|
12
|
+
* Ends span
|
|
13
|
+
* @param reply - reply function
|
|
14
|
+
* @param err - error
|
|
15
|
+
*/
|
|
16
|
+
export declare function endSpan(reply: PluginFastifyReply, err?: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* This function handles the missing case from instrumentation package when
|
|
19
|
+
* execute can either return a promise or void. And using async is not an
|
|
20
|
+
* option as it is producing unwanted side effects.
|
|
21
|
+
* @param execute - function to be executed
|
|
22
|
+
* @param onFinish - function called when function executed
|
|
23
|
+
* @param preventThrowingError - prevent to throw error when execute
|
|
24
|
+
* function fails
|
|
25
|
+
*/
|
|
26
|
+
export declare function safeExecuteInTheMiddleMaybePromise<T>(execute: () => Promise<T>, onFinish: (e: unknown, result?: T) => void, preventThrowingError?: boolean): Promise<T>;
|
|
27
|
+
export declare function safeExecuteInTheMiddleMaybePromise<T>(execute: () => T, onFinish: (e: unknown, result?: T) => void, preventThrowingError?: boolean): T;
|
|
28
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/fastify/v3/utils.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAkB,MAAM,oBAAoB,CAAC;AAE7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,UAAe,QAehC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,CAAC,EAAE,GAAG,QAkB3D;AAKD;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAAC,CAAC,EAClD,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,EAC1C,oBAAoB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,CAAC,CAAC,CAAC;AACd,wBAAgB,kCAAkC,CAAC,CAAC,EAClD,OAAO,EAAE,MAAM,CAAC,EAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,EAC1C,oBAAoB,CAAC,EAAE,OAAO,GAC7B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAsBhD;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,WAAW,EAAE,CAsB9D;AAED;;GAEG;AAEH,wBAAgB,wCAAwC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAsBhD;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,WAAW,EAAE,CAsB9D;AAED;;GAEG;AAEH,wBAAgB,wCAAwC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAyBzG"}
|