@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 CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./src/StandardTracerFastify";
2
+ export * from "./src/RequqestOTel";
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  __exportStar(require("./src/StandardTracerFastify"), exports);
20
+ __exportStar(require("./src/RequqestOTel"), exports);
@@ -0,0 +1,4 @@
1
+ import { Span } from "@opentelemetry/sdk-trace-base";
2
+ export interface RequqestOTel {
3
+ tracerSpanApi: Span;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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
@@ -2,3 +2,4 @@
2
2
  // Export all modules from src
3
3
 
4
4
  export * from "./src/StandardTracerFastify";
5
+ export * from "./src/RequqestOTel";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/otel-utils-fastify",
3
- "version": "0.0.1-beta5",
3
+ "version": "0.0.1-beta7",
4
4
  "description": "Utility to simplify integration with Open Telemetry for Fastify API Server",
5
5
  "keywords": [
6
6
  "Open",
@@ -0,0 +1,5 @@
1
+ import { Span } from "@opentelemetry/sdk-trace-base";
2
+
3
+ export interface RequqestOTel {
4
+ tracerSpanApi: Span;
5
+ }
@@ -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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
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);