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
text/typescript
import { BeforeApplicationShutdown, Inject, Injectable } from '@nestjs/common';
import { Constants } from './Constants';
import { NodeSDK } from '@opentelemetry/sdk-node';
()
export class OpenTelemetryService implements BeforeApplicationShutdown {
constructor((Constants.SDK) private readonly sdk: NodeSDK) {}
async beforeApplicationShutdown() {
await this.sdk?.shutdown();
}
}