@sentry/node 10.13.0 → 10.15.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 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js +1 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/constants.js +15 -0
- package/build/cjs/integrations/tracing/hono/constants.js.map +1 -0
- package/build/cjs/integrations/tracing/hono/index.js +137 -0
- package/build/cjs/integrations/tracing/hono/index.js.map +1 -0
- package/build/cjs/integrations/tracing/hono/instrumentation.js +236 -0
- package/build/cjs/integrations/tracing/hono/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/index.js +15 -12
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/utils/redisCache.js +2 -2
- package/build/cjs/utils/redisCache.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js +1 -1
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js +1 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/hono/constants.js +12 -0
- package/build/esm/integrations/tracing/hono/constants.js.map +1 -0
- package/build/esm/integrations/tracing/hono/index.js +133 -0
- package/build/esm/integrations/tracing/hono/index.js.map +1 -0
- package/build/esm/integrations/tracing/hono/instrumentation.js +234 -0
- package/build/esm/integrations/tracing/hono/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/index.js +3 -0
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/redisCache.js +2 -2
- package/build/esm/utils/redisCache.js.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
- package/build/types/integrations/tracing/hono/constants.d.ts +11 -0
- package/build/types/integrations/tracing/hono/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing/hono/index.d.ts +30 -0
- package/build/types/integrations/tracing/hono/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/hono/instrumentation.d.ts +29 -2
- package/build/types/integrations/tracing/hono/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/hono/types.d.ts +4 -1
- package/build/types/integrations/tracing/hono/types.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/hono/constants.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing/hono/index.d.ts +30 -0
- package/build/types-ts3.8/integrations/tracing/hono/instrumentation.d.ts +29 -2
- package/build/types-ts3.8/integrations/tracing/hono/types.d.ts +4 -1
- package/package.json +4 -4
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { context, trace, SpanStatusCode } from '@opentelemetry/api';
|
|
2
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
3
|
+
import { isThenable } from '@sentry/core';
|
|
4
|
+
import { AttributeNames, HonoTypes } from './constants.js';
|
|
5
|
+
|
|
6
|
+
const PACKAGE_NAME = '@sentry/instrumentation-hono';
|
|
7
|
+
const PACKAGE_VERSION = '0.0.1';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hono instrumentation for OpenTelemetry
|
|
11
|
+
*/
|
|
12
|
+
class HonoInstrumentation extends InstrumentationBase {
|
|
13
|
+
constructor(config = {}) {
|
|
14
|
+
super(PACKAGE_NAME, PACKAGE_VERSION, config);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the instrumentation.
|
|
19
|
+
*/
|
|
20
|
+
init() {
|
|
21
|
+
return [
|
|
22
|
+
new InstrumentationNodeModuleDefinition('hono', ['>=4.0.0 <5'], moduleExports => this._patch(moduleExports)),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Patches the module exports to instrument Hono.
|
|
28
|
+
*/
|
|
29
|
+
_patch(moduleExports) {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
31
|
+
const instrumentation = this;
|
|
32
|
+
|
|
33
|
+
class WrappedHono extends moduleExports.Hono {
|
|
34
|
+
constructor(...args) {
|
|
35
|
+
super(...args);
|
|
36
|
+
|
|
37
|
+
instrumentation._wrap(this, 'get', instrumentation._patchHandler());
|
|
38
|
+
instrumentation._wrap(this, 'post', instrumentation._patchHandler());
|
|
39
|
+
instrumentation._wrap(this, 'put', instrumentation._patchHandler());
|
|
40
|
+
instrumentation._wrap(this, 'delete', instrumentation._patchHandler());
|
|
41
|
+
instrumentation._wrap(this, 'options', instrumentation._patchHandler());
|
|
42
|
+
instrumentation._wrap(this, 'patch', instrumentation._patchHandler());
|
|
43
|
+
instrumentation._wrap(this, 'all', instrumentation._patchHandler());
|
|
44
|
+
instrumentation._wrap(this, 'on', instrumentation._patchOnHandler());
|
|
45
|
+
instrumentation._wrap(this, 'use', instrumentation._patchMiddlewareHandler());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
moduleExports.Hono = WrappedHono;
|
|
51
|
+
} catch {
|
|
52
|
+
// This is a workaround for environments where direct assignment is not allowed.
|
|
53
|
+
return { ...moduleExports, Hono: WrappedHono };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return moduleExports;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Patches the route handler to instrument it.
|
|
61
|
+
*/
|
|
62
|
+
_patchHandler() {
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
64
|
+
const instrumentation = this;
|
|
65
|
+
|
|
66
|
+
return function (original) {
|
|
67
|
+
return function wrappedHandler( ...args) {
|
|
68
|
+
if (typeof args[0] === 'string') {
|
|
69
|
+
const path = args[0];
|
|
70
|
+
if (args.length === 1) {
|
|
71
|
+
return original.apply(this, [path]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const handlers = args.slice(1);
|
|
75
|
+
return original.apply(this, [
|
|
76
|
+
path,
|
|
77
|
+
...handlers.map(handler => instrumentation._wrapHandler(handler )),
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return original.apply(
|
|
82
|
+
this,
|
|
83
|
+
args.map(handler => instrumentation._wrapHandler(handler )),
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Patches the 'on' handler to instrument it.
|
|
91
|
+
*/
|
|
92
|
+
_patchOnHandler() {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
94
|
+
const instrumentation = this;
|
|
95
|
+
|
|
96
|
+
return function (original) {
|
|
97
|
+
return function wrappedHandler( ...args) {
|
|
98
|
+
const handlers = args.slice(2);
|
|
99
|
+
return original.apply(this, [
|
|
100
|
+
...args.slice(0, 2),
|
|
101
|
+
...handlers.map(handler => instrumentation._wrapHandler(handler )),
|
|
102
|
+
]);
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Patches the middleware handler to instrument it.
|
|
109
|
+
*/
|
|
110
|
+
_patchMiddlewareHandler() {
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
112
|
+
const instrumentation = this;
|
|
113
|
+
|
|
114
|
+
return function (original) {
|
|
115
|
+
return function wrappedHandler( ...args) {
|
|
116
|
+
if (typeof args[0] === 'string') {
|
|
117
|
+
const path = args[0];
|
|
118
|
+
if (args.length === 1) {
|
|
119
|
+
return original.apply(this, [path]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const handlers = args.slice(1);
|
|
123
|
+
return original.apply(this, [
|
|
124
|
+
path,
|
|
125
|
+
...handlers.map(handler => instrumentation._wrapHandler(handler )),
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return original.apply(
|
|
130
|
+
this,
|
|
131
|
+
args.map(handler => instrumentation._wrapHandler(handler )),
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Wraps a handler or middleware handler to apply instrumentation.
|
|
139
|
+
*/
|
|
140
|
+
_wrapHandler(handler) {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
142
|
+
const instrumentation = this;
|
|
143
|
+
|
|
144
|
+
return function ( c, next) {
|
|
145
|
+
if (!instrumentation.isEnabled()) {
|
|
146
|
+
return handler.apply(this, [c, next]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const path = c.req.path;
|
|
150
|
+
const span = instrumentation.tracer.startSpan(path);
|
|
151
|
+
|
|
152
|
+
return context.with(trace.setSpan(context.active(), span), () => {
|
|
153
|
+
return instrumentation._safeExecute(
|
|
154
|
+
() => {
|
|
155
|
+
const result = handler.apply(this, [c, next]);
|
|
156
|
+
if (isThenable(result)) {
|
|
157
|
+
return result.then(result => {
|
|
158
|
+
const type = instrumentation._determineHandlerType(result);
|
|
159
|
+
span.setAttributes({
|
|
160
|
+
[AttributeNames.HONO_TYPE]: type,
|
|
161
|
+
[AttributeNames.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path : handler.name || 'anonymous',
|
|
162
|
+
});
|
|
163
|
+
instrumentation.getConfig().responseHook?.(span);
|
|
164
|
+
return result;
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
const type = instrumentation._determineHandlerType(result);
|
|
168
|
+
span.setAttributes({
|
|
169
|
+
[AttributeNames.HONO_TYPE]: type,
|
|
170
|
+
[AttributeNames.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path : handler.name || 'anonymous',
|
|
171
|
+
});
|
|
172
|
+
instrumentation.getConfig().responseHook?.(span);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
() => span.end(),
|
|
177
|
+
error => {
|
|
178
|
+
instrumentation._handleError(span, error);
|
|
179
|
+
span.end();
|
|
180
|
+
},
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Safely executes a function and handles errors.
|
|
188
|
+
*/
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
|
+
_safeExecute(execute, onSuccess, onFailure) {
|
|
191
|
+
try {
|
|
192
|
+
const result = execute();
|
|
193
|
+
|
|
194
|
+
if (isThenable(result)) {
|
|
195
|
+
result.then(
|
|
196
|
+
() => onSuccess(),
|
|
197
|
+
(error) => onFailure(error),
|
|
198
|
+
);
|
|
199
|
+
} else {
|
|
200
|
+
onSuccess();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return result;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
onFailure(error);
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Determines the handler type based on the result.
|
|
212
|
+
* @param result
|
|
213
|
+
* @private
|
|
214
|
+
*/
|
|
215
|
+
_determineHandlerType(result) {
|
|
216
|
+
return result === undefined ? HonoTypes.MIDDLEWARE : HonoTypes.REQUEST_HANDLER;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Handles errors by setting the span status and recording the exception.
|
|
221
|
+
*/
|
|
222
|
+
_handleError(span, error) {
|
|
223
|
+
if (error instanceof Error) {
|
|
224
|
+
span.setStatus({
|
|
225
|
+
code: SpanStatusCode.ERROR,
|
|
226
|
+
message: error.message,
|
|
227
|
+
});
|
|
228
|
+
span.recordException(error);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export { HonoInstrumentation };
|
|
234
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/hono/instrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { context, SpanStatusCode, trace } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { isThenable } from '@sentry/core';\nimport { AttributeNames, HonoTypes } from './constants';\nimport type {\n Context,\n Handler,\n HandlerInterface,\n Hono,\n HonoInstance,\n MiddlewareHandler,\n MiddlewareHandlerInterface,\n Next,\n OnHandlerInterface,\n} from './types';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-hono';\nconst PACKAGE_VERSION = '0.0.1';\n\nexport interface HonoResponseHookFunction {\n (span: Span): void;\n}\n\nexport interface HonoInstrumentationConfig extends InstrumentationConfig {\n /** Function for adding custom span attributes from the response */\n responseHook?: HonoResponseHookFunction;\n}\n\n/**\n * Hono instrumentation for OpenTelemetry\n */\nexport class HonoInstrumentation extends InstrumentationBase<HonoInstrumentationConfig> {\n public constructor(config: HonoInstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n }\n\n /**\n * Initialize the instrumentation.\n */\n public init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition('hono', ['>=4.0.0 <5'], moduleExports => this._patch(moduleExports)),\n ];\n }\n\n /**\n * Patches the module exports to instrument Hono.\n */\n private _patch(moduleExports: { Hono: Hono }): { Hono: Hono } {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instrumentation = this;\n\n class WrappedHono extends moduleExports.Hono {\n public constructor(...args: unknown[]) {\n super(...args);\n\n instrumentation._wrap(this, 'get', instrumentation._patchHandler());\n instrumentation._wrap(this, 'post', instrumentation._patchHandler());\n instrumentation._wrap(this, 'put', instrumentation._patchHandler());\n instrumentation._wrap(this, 'delete', instrumentation._patchHandler());\n instrumentation._wrap(this, 'options', instrumentation._patchHandler());\n instrumentation._wrap(this, 'patch', instrumentation._patchHandler());\n instrumentation._wrap(this, 'all', instrumentation._patchHandler());\n instrumentation._wrap(this, 'on', instrumentation._patchOnHandler());\n instrumentation._wrap(this, 'use', instrumentation._patchMiddlewareHandler());\n }\n }\n\n try {\n moduleExports.Hono = WrappedHono;\n } catch {\n // This is a workaround for environments where direct assignment is not allowed.\n return { ...moduleExports, Hono: WrappedHono };\n }\n\n return moduleExports;\n }\n\n /**\n * Patches the route handler to instrument it.\n */\n private _patchHandler(): (original: HandlerInterface) => HandlerInterface {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instrumentation = this;\n\n return function (original: HandlerInterface) {\n return function wrappedHandler(this: HonoInstance, ...args: unknown[]) {\n if (typeof args[0] === 'string') {\n const path = args[0];\n if (args.length === 1) {\n return original.apply(this, [path]);\n }\n\n const handlers = args.slice(1);\n return original.apply(this, [\n path,\n ...handlers.map(handler => instrumentation._wrapHandler(handler as Handler | MiddlewareHandler)),\n ]);\n }\n\n return original.apply(\n this,\n args.map(handler => instrumentation._wrapHandler(handler as Handler | MiddlewareHandler)),\n );\n };\n };\n }\n\n /**\n * Patches the 'on' handler to instrument it.\n */\n private _patchOnHandler(): (original: OnHandlerInterface) => OnHandlerInterface {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instrumentation = this;\n\n return function (original: OnHandlerInterface) {\n return function wrappedHandler(this: HonoInstance, ...args: unknown[]) {\n const handlers = args.slice(2);\n return original.apply(this, [\n ...args.slice(0, 2),\n ...handlers.map(handler => instrumentation._wrapHandler(handler as Handler | MiddlewareHandler)),\n ]);\n };\n };\n }\n\n /**\n * Patches the middleware handler to instrument it.\n */\n private _patchMiddlewareHandler(): (original: MiddlewareHandlerInterface) => MiddlewareHandlerInterface {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instrumentation = this;\n\n return function (original: MiddlewareHandlerInterface) {\n return function wrappedHandler(this: HonoInstance, ...args: unknown[]) {\n if (typeof args[0] === 'string') {\n const path = args[0];\n if (args.length === 1) {\n return original.apply(this, [path]);\n }\n\n const handlers = args.slice(1);\n return original.apply(this, [\n path,\n ...handlers.map(handler => instrumentation._wrapHandler(handler as MiddlewareHandler)),\n ]);\n }\n\n return original.apply(\n this,\n args.map(handler => instrumentation._wrapHandler(handler as MiddlewareHandler)),\n );\n };\n };\n }\n\n /**\n * Wraps a handler or middleware handler to apply instrumentation.\n */\n private _wrapHandler(handler: Handler | MiddlewareHandler): Handler | MiddlewareHandler {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instrumentation = this;\n\n return function (this: unknown, c: Context, next: Next) {\n if (!instrumentation.isEnabled()) {\n return handler.apply(this, [c, next]);\n }\n\n const path = c.req.path;\n const span = instrumentation.tracer.startSpan(path);\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return instrumentation._safeExecute(\n () => {\n const result = handler.apply(this, [c, next]);\n if (isThenable(result)) {\n return result.then(result => {\n const type = instrumentation._determineHandlerType(result);\n span.setAttributes({\n [AttributeNames.HONO_TYPE]: type,\n [AttributeNames.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path : handler.name || 'anonymous',\n });\n instrumentation.getConfig().responseHook?.(span);\n return result;\n });\n } else {\n const type = instrumentation._determineHandlerType(result);\n span.setAttributes({\n [AttributeNames.HONO_TYPE]: type,\n [AttributeNames.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path : handler.name || 'anonymous',\n });\n instrumentation.getConfig().responseHook?.(span);\n return result;\n }\n },\n () => span.end(),\n error => {\n instrumentation._handleError(span, error);\n span.end();\n },\n );\n });\n };\n }\n\n /**\n * Safely executes a function and handles errors.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _safeExecute(execute: () => any, onSuccess: () => void, onFailure: (error: unknown) => void): () => any {\n try {\n const result = execute();\n\n if (isThenable(result)) {\n result.then(\n () => onSuccess(),\n (error: unknown) => onFailure(error),\n );\n } else {\n onSuccess();\n }\n\n return result;\n } catch (error: unknown) {\n onFailure(error);\n throw error;\n }\n }\n\n /**\n * Determines the handler type based on the result.\n * @param result\n * @private\n */\n private _determineHandlerType(result: unknown): HonoTypes {\n return result === undefined ? HonoTypes.MIDDLEWARE : HonoTypes.REQUEST_HANDLER;\n }\n\n /**\n * Handles errors by setting the span status and recording the exception.\n */\n private _handleError(span: Span, error: unknown): void {\n if (error instanceof Error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n span.recordException(error);\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,YAAA,GAAe,8BAA8B;AACnD,MAAM,eAAA,GAAkB,OAAO;;AAW/B;AACA;AACA;AACO,MAAM,mBAAA,SAA4B,mBAAmB,CAA4B;AACxF,GAAS,WAAW,CAAC,MAAM,GAA8B,EAAE,EAAE;AAC7D,IAAI,KAAK,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC;AAChD;;AAEA;AACA;AACA;AACA,GAAS,IAAI,GAA0C;AACvD,IAAI,OAAO;AACX,MAAM,IAAI,mCAAmC,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,aAAA,IAAiB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAClH,KAAK;AACL;;AAEA;AACA;AACA;AACA,GAAU,MAAM,CAAC,aAAa,EAAkC;AAChE;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;AACrB,QAAQ,IAAI,EAAE,cAAc,CAAC,KAAK;AAClC,QAAQ,OAAO,EAAE,KAAK,CAAC,OAAO;AAC9B,OAAO,CAAC;AACR,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;AACjC;AACA;AACA;;;;"}
|
|
@@ -9,6 +9,7 @@ import { instrumentGenericPool, genericPoolIntegration } from './genericPool.js'
|
|
|
9
9
|
import { instrumentGoogleGenAI, googleGenAIIntegration } from './google-genai/index.js';
|
|
10
10
|
import { instrumentGraphql, graphqlIntegration } from './graphql.js';
|
|
11
11
|
import { instrumentHapi, hapiIntegration } from './hapi/index.js';
|
|
12
|
+
import { instrumentHono, honoIntegration } from './hono/index.js';
|
|
12
13
|
import { instrumentKafka, kafkaIntegration } from './kafka.js';
|
|
13
14
|
import { instrumentKoa, koaIntegration } from './koa.js';
|
|
14
15
|
import { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer.js';
|
|
@@ -32,6 +33,7 @@ function getAutoPerformanceIntegrations() {
|
|
|
32
33
|
expressIntegration(),
|
|
33
34
|
fastifyIntegration(),
|
|
34
35
|
graphqlIntegration(),
|
|
36
|
+
honoIntegration(),
|
|
35
37
|
mongoIntegration(),
|
|
36
38
|
mongooseIntegration(),
|
|
37
39
|
mysqlIntegration(),
|
|
@@ -69,6 +71,7 @@ function getOpenTelemetryInstrumentationToPreload() {
|
|
|
69
71
|
instrumentFastify,
|
|
70
72
|
instrumentFastifyV3,
|
|
71
73
|
instrumentHapi,
|
|
74
|
+
instrumentHono,
|
|
72
75
|
instrumentKafka,
|
|
73
76
|
instrumentKoa,
|
|
74
77
|
instrumentLruMemoizer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentOtelHttp, instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration, instrumentFastify, instrumentFastifyV3 } from './fastify';\nimport { firebaseIntegration, instrumentFirebase } from './firebase';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { googleGenAIIntegration, instrumentGoogleGenAI } from './google-genai';\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 { instrumentOpenAi, openAIIntegration } from './openai';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { instrumentPostgresJs, postgresJsIntegration } from './postgresjs';\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 openAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\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 instrumentSentryHttp,\n instrumentOtelHttp,\n instrumentExpress,\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 instrumentOpenAi,\n instrumentPostgresJs,\n instrumentFirebase,\n instrumentAnthropicAi,\n instrumentGoogleGenAI,\n ];\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/tracing/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { instrumentOtelHttp, instrumentSentryHttp } from '../http';\nimport { amqplibIntegration, instrumentAmqplib } from './amqplib';\nimport { anthropicAIIntegration, instrumentAnthropicAi } from './anthropic-ai';\nimport { connectIntegration, instrumentConnect } from './connect';\nimport { expressIntegration, instrumentExpress } from './express';\nimport { fastifyIntegration, instrumentFastify, instrumentFastifyV3 } from './fastify';\nimport { firebaseIntegration, instrumentFirebase } from './firebase';\nimport { genericPoolIntegration, instrumentGenericPool } from './genericPool';\nimport { googleGenAIIntegration, instrumentGoogleGenAI } from './google-genai';\nimport { graphqlIntegration, instrumentGraphql } from './graphql';\nimport { hapiIntegration, instrumentHapi } from './hapi';\nimport { honoIntegration, instrumentHono } from './hono';\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 { instrumentOpenAi, openAIIntegration } from './openai';\nimport { instrumentPostgres, postgresIntegration } from './postgres';\nimport { instrumentPostgresJs, postgresJsIntegration } from './postgresjs';\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 honoIntegration(),\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 openAIIntegration(),\n postgresJsIntegration(),\n firebaseIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\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 instrumentSentryHttp,\n instrumentOtelHttp,\n instrumentExpress,\n instrumentConnect,\n instrumentFastify,\n instrumentFastifyV3,\n instrumentHapi,\n instrumentHono,\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 instrumentOpenAi,\n instrumentPostgresJs,\n instrumentFirebase,\n instrumentAnthropicAi,\n instrumentGoogleGenAI,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA;AACA;AACA;AACO,SAAS,8BAA8B,GAAkB;AAChE,EAAE,OAAO;AACT,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,kBAAkB,EAAE;AACxB,IAAI,eAAe,EAAE;AACrB,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,IAAI,iBAAiB,EAAE;AACvB,IAAI,qBAAqB,EAAE;AAC3B,IAAI,mBAAmB,EAAE;AACzB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,sBAAsB,EAAE;AAC5B,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACO,SAAS,wCAAwC,GAAmD;AAC3G,EAAE,OAAO;AACT,IAAI,oBAAoB;AACxB,IAAI,kBAAkB;AACtB,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,mBAAmB;AACvB,IAAI,cAAc;AAClB,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,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,kBAAkB;AACtB,IAAI,qBAAqB;AACzB,IAAI,qBAAqB;AACzB,GAAG;AACH;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"10.
|
|
1
|
+
{"type":"module","version":"10.15.0","sideEffects":false}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redisCache.js","sources":["../../../src/utils/redisCache.ts"],"sourcesContent":["import type { CommandArgs as IORedisCommandArgs } from '@opentelemetry/instrumentation-ioredis';\n\nconst SINGLE_ARG_COMMANDS = ['get', 'set', 'setex'];\n\nexport const GET_COMMANDS = ['get', 'mget'];\nexport const SET_COMMANDS = ['set', 'setex'];\n// todo: del, expire\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(\n command: string,\n): 'cache.get' | 'cache.put' | 'cache.remove' | 'cache.flush' | undefined {\n if (isInCommands(GET_COMMANDS, command)) {\n return 'cache.get';\n } else if (isInCommands(SET_COMMANDS, command)) {\n return 'cache.put';\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
|
|
1
|
+
{"version":3,"file":"redisCache.js","sources":["../../../src/utils/redisCache.ts"],"sourcesContent":["import type { CommandArgs as IORedisCommandArgs } from '@opentelemetry/instrumentation-ioredis';\n\nconst SINGLE_ARG_COMMANDS = ['get', 'set', 'setex'];\n\nexport const GET_COMMANDS = ['get', 'mget'];\nexport const SET_COMMANDS = ['set', 'setex'];\n// todo: del, expire\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(\n command: string,\n): 'cache.get' | 'cache.put' | 'cache.remove' | 'cache.flush' | undefined {\n if (isInCommands(GET_COMMANDS, command)) {\n return 'cache.get';\n } else if (isInCommands(SET_COMMANDS, command)) {\n return 'cache.put';\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":[],"mappings":"AAEA,MAAM,mBAAA,GAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC;;MAEtC,YAAA,GAAe,CAAC,KAAK,EAAE,MAAM;MAC7B,YAAA,GAAe,CAAC,KAAK,EAAE,OAAO;AAC3C;;AAEA;AACA;AACO,SAAS,YAAY,CAAC,aAAa,EAAY,OAAO,EAAmB;AAChF,EAAE,OAAO,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;AACtD;;AAEA;AACO,SAAS,iBAAiB;AACjC,EAAE,OAAO;AACT,EAA0E;AAC1E,EAAE,IAAI,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;AAC3C,IAAI,OAAO,WAAW;AACtB,GAAE,MAAO,IAAI,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;AAClD,IAAI,OAAO,WAAW;AACtB,SAAS;AACT,IAAI,OAAO,SAAS;AACpB;AACA;;AAEA,SAAS,YAAY,CAAC,GAAG,EAAU,QAAQ,EAAqB;AAChE,EAAE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AAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAyB;AAC9C,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;AAC7B,QAAQ,aAAa,CAAC,EAAE,CAAC;AACzB,aAAa;AACb,QAAQ,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACvB;AACA,KAAK,CAAC;AACN,GAAG;;AAEH,EAAE,aAAa,CAAC,KAAK,CAAC;AACtB,EAAE,OAAO,MAAM;AACf;;;;"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { postgresIntegration } from './integrations/tracing/postgres';
|
|
|
15
15
|
export { postgresJsIntegration } from './integrations/tracing/postgresjs';
|
|
16
16
|
export { prismaIntegration } from './integrations/tracing/prisma';
|
|
17
17
|
export { hapiIntegration, setupHapiErrorHandler } from './integrations/tracing/hapi';
|
|
18
|
+
export { honoIntegration, setupHonoErrorHandler } from './integrations/tracing/hono';
|
|
18
19
|
export { koaIntegration, setupKoaErrorHandler } from './integrations/tracing/koa';
|
|
19
20
|
export { connectIntegration, setupConnectErrorHandler } from './integrations/tracing/connect';
|
|
20
21
|
export { knexIntegration } from './integrations/tracing/knex';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM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b,cAAc,EACd,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,QAAQ,EACR,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,MAAM,EACN,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,8BAA8B,EAC9B,+BAA+B,EAE/B,cAAc,EAEd,8BAA8B,EAC9B,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,kBAAk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EACzB,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,QAAQ,EACR,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,MAAM,EACN,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,8BAA8B,EAC9B,+BAA+B,EAE/B,cAAc,EAEd,8BAA8B,EAC9B,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/firebase/firebase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/firebase/firebase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsC,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAYrF,eAAO,MAAM,kBAAkB;;CAAsF,CAAC;AAWtH,eAAO,MAAM,mBAAmB,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const AttributeNames: {
|
|
2
|
+
readonly HONO_TYPE: "hono.type";
|
|
3
|
+
readonly HONO_NAME: "hono.name";
|
|
4
|
+
};
|
|
5
|
+
export type AttributeNames = (typeof AttributeNames)[keyof typeof AttributeNames];
|
|
6
|
+
export declare const HonoTypes: {
|
|
7
|
+
readonly MIDDLEWARE: "middleware";
|
|
8
|
+
readonly REQUEST_HANDLER: "request_handler";
|
|
9
|
+
};
|
|
10
|
+
export type HonoTypes = (typeof HonoTypes)[keyof typeof HonoTypes];
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAElF,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HonoInstrumentation } from './instrumentation';
|
|
2
|
+
import type { Context, MiddlewareHandlerInterface } from './types';
|
|
2
3
|
export declare const instrumentHono: ((options?: unknown) => HonoInstrumentation) & {
|
|
3
4
|
id: string;
|
|
4
5
|
};
|
|
@@ -19,4 +20,33 @@ export declare const instrumentHono: ((options?: unknown) => HonoInstrumentation
|
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
22
|
export declare const honoIntegration: () => import("@sentry/core").Integration;
|
|
23
|
+
interface HonoHandlerOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Callback method deciding whether error should be captured and sent to Sentry
|
|
26
|
+
* @param error Captured Hono error
|
|
27
|
+
*/
|
|
28
|
+
shouldHandleError: (context: Context) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Add a Hono error handler to capture errors to Sentry.
|
|
32
|
+
*
|
|
33
|
+
* @param app The Hono instances
|
|
34
|
+
* @param options Configuration options for the handler
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const Sentry = require('@sentry/node');
|
|
39
|
+
* const { Hono } = require("hono");
|
|
40
|
+
*
|
|
41
|
+
* const app = new Hono();
|
|
42
|
+
*
|
|
43
|
+
* Sentry.setupHonoErrorHandler(app);
|
|
44
|
+
*
|
|
45
|
+
* // Add your routes, etc.
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function setupHonoErrorHandler(app: {
|
|
49
|
+
use: MiddlewareHandlerInterface;
|
|
50
|
+
}, options?: Partial<HonoHandlerOptions>): void;
|
|
51
|
+
export {};
|
|
22
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAqB,0BAA0B,EAAQ,MAAM,SAAS,CAAC;AAiC5F,eAAO,MAAM,cAAc;;CAQ1B,CAAC;AAWF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,0CAAsC,CAAC;AAEnE,UAAU,kBAAkB;IAC1B;;;OAGG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;CAClD;AA+BD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE;IAAE,GAAG,EAAE,0BAA0B,CAAA;CAAE,EACxC,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACpC,IAAI,CAIN"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
1
3
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
4
|
+
export interface HonoResponseHookFunction {
|
|
5
|
+
(span: Span): void;
|
|
6
|
+
}
|
|
7
|
+
export interface HonoInstrumentationConfig extends InstrumentationConfig {
|
|
8
|
+
/** Function for adding custom span attributes from the response */
|
|
9
|
+
responseHook?: HonoResponseHookFunction;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Hono instrumentation for OpenTelemetry
|
|
4
13
|
*/
|
|
5
|
-
export declare class HonoInstrumentation extends InstrumentationBase {
|
|
6
|
-
constructor();
|
|
14
|
+
export declare class HonoInstrumentation extends InstrumentationBase<HonoInstrumentationConfig> {
|
|
15
|
+
constructor(config?: HonoInstrumentationConfig);
|
|
7
16
|
/**
|
|
8
17
|
* Initialize the instrumentation.
|
|
9
18
|
*/
|
|
@@ -24,5 +33,23 @@ export declare class HonoInstrumentation extends InstrumentationBase {
|
|
|
24
33
|
* Patches the middleware handler to instrument it.
|
|
25
34
|
*/
|
|
26
35
|
private _patchMiddlewareHandler;
|
|
36
|
+
/**
|
|
37
|
+
* Wraps a handler or middleware handler to apply instrumentation.
|
|
38
|
+
*/
|
|
39
|
+
private _wrapHandler;
|
|
40
|
+
/**
|
|
41
|
+
* Safely executes a function and handles errors.
|
|
42
|
+
*/
|
|
43
|
+
private _safeExecute;
|
|
44
|
+
/**
|
|
45
|
+
* Determines the handler type based on the result.
|
|
46
|
+
* @param result
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
private _determineHandlerType;
|
|
50
|
+
/**
|
|
51
|
+
* Handles errors by setting the span status and recording the exception.
|
|
52
|
+
*/
|
|
53
|
+
private _handleError;
|
|
27
54
|
}
|
|
28
55
|
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAkB1G,MAAM,WAAW,wBAAwB;IACvC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,mEAAmE;IACnE,YAAY,CAAC,EAAE,wBAAwB,CAAC;CACzC;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB,CAAC,yBAAyB,CAAC;gBAClE,MAAM,GAAE,yBAA8B;IAIzD;;OAEG;IACI,IAAI,IAAI,mCAAmC,EAAE;IAMpD;;OAEG;IACH,OAAO,CAAC,MAAM;IA8Bd;;OAEG;IACH,OAAO,CAAC,aAAa;IA2BrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAevB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA2B/B;;OAEG;IACH,OAAO,CAAC,YAAY;IA8CpB;;OAEG;IAEH,OAAO,CAAC,YAAY;IAoBpB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;OAEG;IACH,OAAO,CAAC,YAAY;CASrB"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export type HonoRequest = {
|
|
2
2
|
path: string;
|
|
3
|
+
method: string;
|
|
3
4
|
};
|
|
4
5
|
export type Context = {
|
|
5
6
|
req: HonoRequest;
|
|
7
|
+
res: Response;
|
|
8
|
+
error: Error | undefined;
|
|
6
9
|
};
|
|
7
10
|
export type Next = () => Promise<void>;
|
|
8
11
|
export type Handler = (c: Context, next: Next) => Promise<Response> | Response;
|
|
9
|
-
export type MiddlewareHandler = (c: Context, next: Next) => Promise<Response | void
|
|
12
|
+
export type MiddlewareHandler = (c: Context, next: Next) => Promise<Response | void>;
|
|
10
13
|
export type HandlerInterface = {
|
|
11
14
|
(...handlers: (Handler | MiddlewareHandler)[]): HonoInstance;
|
|
12
15
|
(path: string, ...handlers: (Handler | MiddlewareHandler)[]): HonoInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/hono/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,WAAW,CAAC;IACjB,GAAG,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAGvC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,OAA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AAG,IAAI,EAAE,OAAO,EAAE,KAAK,YAAY,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;
|
|
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;AA4BhD;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,WAAW,EAAE,CA4B9D;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,CA+BzG"}
|
|
@@ -15,6 +15,7 @@ export { postgresIntegration } from './integrations/tracing/postgres';
|
|
|
15
15
|
export { postgresJsIntegration } from './integrations/tracing/postgresjs';
|
|
16
16
|
export { prismaIntegration } from './integrations/tracing/prisma';
|
|
17
17
|
export { hapiIntegration, setupHapiErrorHandler } from './integrations/tracing/hapi';
|
|
18
|
+
export { honoIntegration, setupHonoErrorHandler } from './integrations/tracing/hono';
|
|
18
19
|
export { koaIntegration, setupKoaErrorHandler } from './integrations/tracing/koa';
|
|
19
20
|
export { connectIntegration, setupConnectErrorHandler } from './integrations/tracing/connect';
|
|
20
21
|
export { knexIntegration } from './integrations/tracing/knex';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const AttributeNames: {
|
|
2
|
+
readonly HONO_TYPE: "hono.type";
|
|
3
|
+
readonly HONO_NAME: "hono.name";
|
|
4
|
+
};
|
|
5
|
+
export type AttributeNames = (typeof AttributeNames)[keyof typeof AttributeNames];
|
|
6
|
+
export declare const HonoTypes: {
|
|
7
|
+
readonly MIDDLEWARE: "middleware";
|
|
8
|
+
readonly REQUEST_HANDLER: "request_handler";
|
|
9
|
+
};
|
|
10
|
+
export type HonoTypes = (typeof HonoTypes)[keyof typeof HonoTypes];
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HonoInstrumentation } from './instrumentation';
|
|
2
|
+
import { Context, MiddlewareHandlerInterface } from './types';
|
|
2
3
|
export declare const instrumentHono: ((options?: unknown) => HonoInstrumentation) & {
|
|
3
4
|
id: string;
|
|
4
5
|
};
|
|
@@ -19,4 +20,33 @@ export declare const instrumentHono: ((options?: unknown) => HonoInstrumentation
|
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
22
|
export declare const honoIntegration: () => import("@sentry/core").Integration;
|
|
23
|
+
interface HonoHandlerOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Callback method deciding whether error should be captured and sent to Sentry
|
|
26
|
+
* @param error Captured Hono error
|
|
27
|
+
*/
|
|
28
|
+
shouldHandleError: (context: Context) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Add a Hono error handler to capture errors to Sentry.
|
|
32
|
+
*
|
|
33
|
+
* @param app The Hono instances
|
|
34
|
+
* @param options Configuration options for the handler
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const Sentry = require('@sentry/node');
|
|
39
|
+
* const { Hono } = require("hono");
|
|
40
|
+
*
|
|
41
|
+
* const app = new Hono();
|
|
42
|
+
*
|
|
43
|
+
* Sentry.setupHonoErrorHandler(app);
|
|
44
|
+
*
|
|
45
|
+
* // Add your routes, etc.
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function setupHonoErrorHandler(app: {
|
|
49
|
+
use: MiddlewareHandlerInterface;
|
|
50
|
+
}, options?: Partial<HonoHandlerOptions>): void;
|
|
51
|
+
export {};
|
|
22
52
|
//# sourceMappingURL=index.d.ts.map
|