grafana e prometeus
This commit is contained in:
@@ -5,14 +5,40 @@ import { HealthController } from './health.controller';
|
||||
import { TypeOrmHealthIndicator } from './indicators/typeorm.health';
|
||||
import { DbPoolStatsIndicator } from './indicators/db-pool-stats.health';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
|
||||
import { metricProviders } from './metrics/metrics.config';
|
||||
import { CustomMetricsService } from './metrics/custom.metrics';
|
||||
import { MetricsInterceptor } from './metrics/metrics.interceptor';
|
||||
import { HealthAlertService } from './alert/health-alert.service';
|
||||
import { APP_INTERCEPTOR } from '@nestjs/core';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TerminusModule,
|
||||
HttpModule,
|
||||
ConfigModule,
|
||||
PrometheusModule.register({
|
||||
path: '/metrics',
|
||||
defaultMetrics: {
|
||||
enabled: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
controllers: [HealthController],
|
||||
providers: [TypeOrmHealthIndicator, DbPoolStatsIndicator],
|
||||
providers: [
|
||||
TypeOrmHealthIndicator,
|
||||
DbPoolStatsIndicator,
|
||||
CustomMetricsService,
|
||||
HealthAlertService,
|
||||
{
|
||||
provide: APP_INTERCEPTOR,
|
||||
useClass: MetricsInterceptor,
|
||||
},
|
||||
...metricProviders,
|
||||
],
|
||||
exports: [
|
||||
CustomMetricsService,
|
||||
HealthAlertService,
|
||||
],
|
||||
})
|
||||
export class HealthModule {}
|
||||
Reference in New Issue
Block a user