-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathmonitoring.module.ts
More file actions
51 lines (49 loc) · 1.85 KB
/
monitoring.module.ts
File metadata and controls
51 lines (49 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* @fileoverview Module for application monitoring tasks, like indexer health.
* @issue #208
*/
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { makeGaugeProvider, makeCounterProvider } from '@willsoto/nestjs-prometheus';
import { IndexerMonitorService } from './indexer-monitor.service';
import { IndexerMonitorController } from './src/monitoring/indexer-monitor.controller';
import { PrismaModule } from '../src/database/prisma/prisma.module';
import { BlockchainModule } from '../src/blockchain/blockchain.module';
@Module({
imports: [ScheduleModule.forRoot(), PrismaModule, BlockchainModule],
controllers: [IndexerMonitorController],
providers: [
IndexerMonitorService,
makeGaugeProvider({
name: 'propchain_indexer_current_height',
help: 'The latest block height processed by the indexer.',
}),
makeGaugeProvider({
name: 'propchain_indexer_target_height',
help: 'The current latest block height on the blockchain.',
}),
makeGaugeProvider({
name: 'propchain_indexer_height_drift',
help: 'The difference between target and current indexer height.',
}),
makeCounterProvider({
name: 'propchain_indexer_alerts_total',
help: 'Total number of indexer alerts generated.',
labelNames: ['type', 'severity'],
}),
makeGaugeProvider({
name: 'propchain_indexer_health_status',
help: 'Health status of the indexer (1 = healthy, 0 = unhealthy).',
}),
makeGaugeProvider({
name: 'propchain_indexer_consecutive_failures',
help: 'Number of consecutive failures in indexer monitoring.',
}),
makeGaugeProvider({
name: 'propchain_indexer_last_check_timestamp',
help: 'Timestamp of the last indexer health check.',
}),
],
exports: [IndexerMonitorService],
})
export class MonitoringModule { }