@devopsplaybook.io/otel-utils-fastify 1.0.1-beta2 → 1.0.2-beta1

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.
@@ -13,13 +13,12 @@ function StandardTracerFastifyRegisterHooks(fastify, standardTracer, standardLog
13
13
  if (!req.url.startsWith((options === null || options === void 0 ? void 0 : options.rootApiPath) || "/api")) {
14
14
  return;
15
15
  }
16
- const spanName = `${req.method}-${req.url}`;
17
- const urlName = req.url;
16
+ const spanName = `${req.method}-${req.url.split("?")[0]}`;
18
17
  const callerContext = propagator.extract(api_1.ROOT_CONTEXT, req.headers, api_1.defaultTextMapGetter);
19
18
  sdk_node_1.api.context.with(callerContext, () => {
20
19
  const span = standardTracer.startSpan(spanName);
21
20
  span.setAttribute(semantic_conventions_1.ATTR_HTTP_REQUEST_METHOD, req.method);
22
- span.setAttribute(semantic_conventions_1.ATTR_URL_PATH, urlName);
21
+ span.setAttribute(semantic_conventions_1.ATTR_URL_PATH, req.url);
23
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
23
  req.tracerSpanApi = span;
25
24
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/otel-utils-fastify",
3
- "version": "1.0.1-beta2",
3
+ "version": "1.0.2-beta1",
4
4
  "description": "Utility to simplify integration with Open Telemetry for Fastify API Server",
5
5
  "keywords": [
6
6
  "Open",
@@ -28,9 +28,7 @@ export function StandardTracerFastifyRegisterHooks(
28
28
  if (!req.url.startsWith(options?.rootApiPath || "/api")) {
29
29
  return;
30
30
  }
31
-
32
- const spanName = `${req.method}-${req.url}`;
33
- const urlName = req.url;
31
+ const spanName = `${req.method}-${req.url.split("?")[0]}`;
34
32
  const callerContext = propagator.extract(
35
33
  ROOT_CONTEXT,
36
34
  req.headers,
@@ -39,7 +37,7 @@ export function StandardTracerFastifyRegisterHooks(
39
37
  api.context.with(callerContext, () => {
40
38
  const span = standardTracer.startSpan(spanName);
41
39
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, req.method);
42
- span.setAttribute(ATTR_URL_PATH, urlName);
40
+ span.setAttribute(ATTR_URL_PATH, req.url);
43
41
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
42
  (req as any).tracerSpanApi = span;
45
43
  });