Skip to content

Commit 88352b5

Browse files
committed
Use instrumentation._logger instead
1 parent 24e03a1 commit 88352b5

File tree

1 file changed

+8
-7
lines changed
  • packages/node/src/integrations/tracing/fastify/fastify-otel

1 file changed

+8
-7
lines changed

packages/node/src/integrations/tracing/fastify/fastify-otel/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SOFTWARE.
3636
/* eslint-disable max-lines */
3737
/* eslint-disable no-param-reassign */
3838
import dc from 'node:diagnostics_channel';
39-
import { context, propagation, SpanStatusCode, trace } from '@opentelemetry/api';
39+
import { context, diag, propagation, SpanStatusCode, trace } from '@opentelemetry/api';
4040
import { getRPCMetadata, RPCType } from '@opentelemetry/core';
4141
import { InstrumentationBase } from '@opentelemetry/instrumentation';
4242
import {
@@ -89,6 +89,7 @@ export class FastifyOtelInstrumentation extends InstrumentationBase {
8989
super(PACKAGE_NAME, PACKAGE_VERSION, config);
9090
this.servername = config?.servername ?? process.env.OTEL_SERVICE_NAME ?? 'fastify';
9191
this[kIgnorePaths] = null;
92+
this._logger = diag.createComponentLogger({ namespace: PACKAGE_NAME });
9293

9394
if (config?.ignorePaths != null || process.env.OTEL_FASTIFY_IGNORE_PATHS != null) {
9495
const ignorePaths = config?.ignorePaths ?? process.env.OTEL_FASTIFY_IGNORE_PATHS;
@@ -177,9 +178,9 @@ export class FastifyOtelInstrumentation extends InstrumentationBase {
177178

178179
instance.addHook('onRoute', function (routeOptions) {
179180
if (instrumentation[kIgnorePaths]?.(routeOptions) === true) {
180-
// instrumentation.logger.debug(
181-
// `Ignoring route instrumentation ${routeOptions.method} ${routeOptions.url} because it matches the ignore path`,
182-
// );
181+
instrumentation._logger.debug(
182+
`Ignoring route instrumentation ${routeOptions.method} ${routeOptions.url} because it matches the ignore path`,
183+
);
183184
return;
184185
}
185186

@@ -254,9 +255,9 @@ export class FastifyOtelInstrumentation extends InstrumentationBase {
254255
method: request.method,
255256
}) === true
256257
) {
257-
// this[kInstrumentation].logger.debug(
258-
// `Ignoring request ${request.method} ${request.url} because it matches the ignore path`,
259-
// );
258+
this[kInstrumentation]._logger.debug(
259+
`Ignoring request ${request.method} ${request.url} because it matches the ignore path`,
260+
);
260261
return hookDone();
261262
}
262263

0 commit comments

Comments
 (0)