Module (sync) register method.
import { Module } from "@nestjs/common";
import { MetricsModule } from "@mists/nestjs-metrics";
@Module({
imports: [MetricsModule.register({
prometheus: {
// ...
},
statsd: {
// ...
}
})],
})
export class AppModule {}
Module async register method.
import { Module } from "@nestjs/common";
import { MetricsModule } from "@mists/nestjs-metrics";
@Injectable()
export class StatsOptionsService implements StatsOptionsFactory {
createStatsOptions(): StatsOptions {
return new Promise(resolve => ({
// see the MetricsModule::register() options
}));
}
}
@Module({
imports: [MetricsModule.registerAsync({
useClass: StatsOptionsService,
inject: [StatsOptionsService],
})],
})
export class AppModule {}
Generated using TypeDoc
Metrics module class. This class will be used to initialize the metrics module within NestJs.
import { Module } from "@nestjs/common"; import { MetricsModule } from "@mists/nestjs-metrics"; @Module({ imports: [MetricsModule.register({ prometheus: { // ... }, statsd: { // ... } })], }) export class AppModule {}