Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Http Instrumentation #48

Closed
FlorianBayle opened this issue Oct 13, 2022 · 1 comment
Closed

Disable Http Instrumentation #48

FlorianBayle opened this issue Oct 13, 2022 · 1 comment

Comments

@FlorianBayle
Copy link

FlorianBayle commented Oct 13, 2022

Hi,

I search since few days how to disable http instrumentation but without success.

Do you have an idea to do this ?

I've try to :

  • add an empty instrumentations array in module configuration
  • add a new HttpInstrumentation({ enabled: false }) in the instrumentations array

This is my current module configuration

...
return {
      module: TelemetryModule,
      exports: [TelemetryService],
      imports: [
        OpenTelemetryModule.forRoot({
          applicationName: options.applicationName,
          spanProcessor: new BatchSpanProcessor(
            getSpanExporter(options.transport),
          ) as any,
          resource: new Resource({
            [SemanticResourceAttributes.SERVICE_NAME]: options.serviceName,
          }) as any,
          traceAutoInjectors: [
            ControllerInjector,
            GuardInjector,
            EventEmitterInjector,
            ScheduleInjector,
            PipeInjector,
            ResolverInjector,
            TelemetryInjector,
          ],
          metricAutoObservers: [
            GqlIncomingRequestCounterMetric,
            HttpIncomingRequestMetric,
          ],
        }),
      ],
      providers: [
        {
          provide: TelemetryConstants.TELEMETRY_CONFIGURATION,
          useValue: options,
        },
        {
          provide: TelemetryService,
          useClass: TelemetryOpenTelemetryService,
        },
        {
          provide: APP_INTERCEPTOR,
          useClass: HttpFastifyAdapterInterceptor,
        },
        {
          provide: APP_INTERCEPTOR,
          useClass: GraphqlInterceptor,
        },
        {
          provide: APP_INTERCEPTOR,
          useClass: HttpInterceptor,
        },
      ],
    };

Thx !

@MetinSeylan
Copy link
Owner

I suggest upgrade nestjs and library version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants