UNPKG

testing-amplication-opentelemetry-nestjs

Version:

Testing OpenTelemetry module for Nestjs with auto instrumentation and resource detection. Initially forked from https://github.com/overbit/opentelemetry-nestjs.git

13 lines (10 loc) 408 B
import { BeforeApplicationShutdown, Inject, Injectable } from '@nestjs/common'; import { Constants } from './Constants'; import { NodeSDK } from '@opentelemetry/sdk-node'; @Injectable() export class OpenTelemetryService implements BeforeApplicationShutdown { constructor(@Inject(Constants.SDK) private readonly sdk: NodeSDK) {} async beforeApplicationShutdown() { await this.sdk?.shutdown(); } }