mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
26 lines
796 B
TypeScript
26 lines
796 B
TypeScript
|
|
import { Module, OnApplicationShutdown } from "@nestjs/common";
|
||
|
|
import { OpenTelemetryModule as UpstreamModule } from "nestjs-otel";
|
||
|
|
import { otelSDK } from "./sdk";
|
||
|
|
|
||
|
|
@Module({
|
||
|
|
imports: [
|
||
|
|
UpstreamModule.forRoot({
|
||
|
|
metrics: {
|
||
|
|
hostMetrics: true, // Includes Host Metrics
|
||
|
|
defaultMetrics: true, // Includes Default Metrics
|
||
|
|
apiMetrics: {
|
||
|
|
enable: true, // Includes api metrics
|
||
|
|
timeBuckets: [], // You can change the default time buckets
|
||
|
|
ignoreUndefinedRoutes: false, //Records metrics for all URLs, even undefined ones
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
exports: [UpstreamModule],
|
||
|
|
})
|
||
|
|
export class OpenTelemetryModule implements OnApplicationShutdown {
|
||
|
|
async onApplicationShutdown(): Promise<void> {
|
||
|
|
await otelSDK.shutdown();
|
||
|
|
}
|
||
|
|
}
|