@devopsplaybook.io/otel-utils-fastify 0.0.1-beta5 → 0.0.1-beta7
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/src/RequqestOTel.d.ts +4 -0
- package/dist/src/RequqestOTel.js +2 -0
- package/dist/src/StandardTracerFastify.js +3 -3
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/RequqestOTel.ts +5 -0
- package/src/StandardTracerFastify.ts +4 -9
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,12 +19,12 @@ async function StandardTracerFastifyRegisterHooks(fastify, standardTracer, stand
|
|
|
19
19
|
const span = standardTracer.startSpan(spanName);
|
|
20
20
|
span.setAttribute(semantic_conventions_1.ATTR_HTTP_REQUEST_METHOD, req.method);
|
|
21
21
|
span.setAttribute(semantic_conventions_1.ATTR_URL_PATH, urlName);
|
|
22
|
-
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
23
|
req.tracerSpanApi = span;
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
fastify.addHook("onResponse", async (req, reply) => {
|
|
27
|
-
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
const span = req.tracerSpanApi;
|
|
29
29
|
if (reply.statusCode > 299) {
|
|
30
30
|
span.status.code = api_1.SpanStatusCode.ERROR;
|
|
@@ -36,7 +36,7 @@ async function StandardTracerFastifyRegisterHooks(fastify, standardTracer, stand
|
|
|
36
36
|
span.end();
|
|
37
37
|
});
|
|
38
38
|
fastify.addHook("onError", async (req, reply, error) => {
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
40
|
const span = req.tracerSpanApi;
|
|
41
41
|
span.status.code = api_1.SpanStatusCode.ERROR;
|
|
42
42
|
span.recordException(error);
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigOTelInterface,
|
|
3
|
-
ModuleLogger,
|
|
4
|
-
StandardLogger,
|
|
5
|
-
StandardTracer,
|
|
6
|
-
} from "@devopsplaybook.io/otel-utils";
|
|
1
|
+
import { StandardLogger, StandardTracer } from "@devopsplaybook.io/otel-utils";
|
|
7
2
|
import {
|
|
8
3
|
defaultTextMapGetter,
|
|
9
4
|
ROOT_CONTEXT,
|
|
@@ -44,7 +39,7 @@ export async function StandardTracerFastifyRegisterHooks(
|
|
|
44
39
|
const span = standardTracer.startSpan(spanName);
|
|
45
40
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, req.method);
|
|
46
41
|
span.setAttribute(ATTR_URL_PATH, urlName);
|
|
47
|
-
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
43
|
(req as any).tracerSpanApi = span;
|
|
49
44
|
});
|
|
50
45
|
});
|
|
@@ -52,7 +47,7 @@ export async function StandardTracerFastifyRegisterHooks(
|
|
|
52
47
|
fastify.addHook(
|
|
53
48
|
"onResponse",
|
|
54
49
|
async (req: FastifyRequest, reply: FastifyReply) => {
|
|
55
|
-
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
51
|
const span = (req as any).tracerSpanApi as Span;
|
|
57
52
|
if (reply.statusCode > 299) {
|
|
58
53
|
span.status.code = SpanStatusCode.ERROR;
|
|
@@ -67,7 +62,7 @@ export async function StandardTracerFastifyRegisterHooks(
|
|
|
67
62
|
fastify.addHook(
|
|
68
63
|
"onError",
|
|
69
64
|
async (req: FastifyRequest, reply: FastifyReply, error) => {
|
|
70
|
-
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
66
|
const span = (req as any).tracerSpanApi as Span;
|
|
72
67
|
span.status.code = SpanStatusCode.ERROR;
|
|
73
68
|
span.recordException(error);
|