@devopsplaybook.io/otel-utils-fastify 1.0.2 → 1.0.3

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.
@@ -10,7 +10,8 @@ const propagator = new core_1.W3CTraceContextPropagator();
10
10
  function StandardTracerFastifyRegisterHooks(fastify, standardTracer, standardLogger, options) {
11
11
  const logger = standardLogger.createModuleLogger("Fastify");
12
12
  fastify.addHook("onRequest", async (req) => {
13
- if (!req.url.startsWith((options === null || options === void 0 ? void 0 : options.rootApiPath) || "/api")) {
13
+ if (req.method === "OPTIONS" ||
14
+ !req.url.startsWith((options === null || options === void 0 ? void 0 : options.rootApiPath) || "/api")) {
14
15
  return;
15
16
  }
16
17
  const spanName = `${req.method}-${req.url.split("?")[0]}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/otel-utils-fastify",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Utility to simplify integration with Open Telemetry for Fastify API Server",
5
5
  "keywords": [
6
6
  "Open",
@@ -25,7 +25,10 @@ export function StandardTracerFastifyRegisterHooks(
25
25
  const logger = standardLogger.createModuleLogger("Fastify");
26
26
 
27
27
  fastify.addHook("onRequest", async (req: FastifyRequest) => {
28
- if (!req.url.startsWith(options?.rootApiPath || "/api")) {
28
+ if (
29
+ req.method === "OPTIONS" ||
30
+ !req.url.startsWith(options?.rootApiPath || "/api")
31
+ ) {
29
32
  return;
30
33
  }
31
34
  const spanName = `${req.method}-${req.url.split("?")[0]}`;