1
+ const Sentry = require ( '@sentry/node' ) ;
1
2
const ipfs = require ( '../../backup/logic/ipfsLogic' ) ;
2
3
const cache = require ( '../../cache/utils/cache' ) ;
3
4
const models = require ( '../../../models' ) ;
4
5
const aeternity = require ( '../../aeternity/logic/aeternity' ) ;
6
+ const logger = require ( '../../../utils/logger' ) ( module ) ;
5
7
6
8
const HealthLogic = {
7
9
/**
@@ -17,6 +19,8 @@ const HealthLogic = {
17
19
. map ( async key => models [ key ] . findOne ( { raw : true } ) ) ) ;
18
20
return true ;
19
21
} catch ( e ) {
22
+ logger . error ( `DB health failed with: ${ e . message } ` ) ;
23
+ Sentry . captureException ( e ) ;
20
24
return false ;
21
25
}
22
26
} ,
@@ -26,6 +30,8 @@ const HealthLogic = {
26
30
await ipfs . getCoreVitals ( ) ;
27
31
return true ;
28
32
} catch ( e ) {
33
+ logger . error ( `IPFS health failed with: ${ e . message } ` ) ;
34
+ Sentry . captureException ( e ) ;
29
35
return false ;
30
36
}
31
37
} ,
@@ -35,6 +41,8 @@ const HealthLogic = {
35
41
await cache . getOrSet ( [ 'redisTest' ] , async ( ) => 'done' ) ;
36
42
return true ;
37
43
} catch ( e ) {
44
+ logger . error ( `Redis health failed with: ${ e . message } ` ) ;
45
+ Sentry . captureException ( e ) ;
38
46
return false ;
39
47
}
40
48
} ,
@@ -44,6 +52,8 @@ const HealthLogic = {
44
52
const balance = await aeternity . getBalance ( ) ;
45
53
return parseInt ( balance , 10 ) > 0 ;
46
54
} catch ( e ) {
55
+ logger . error ( `AE health failed with: ${ e . message } ` ) ;
56
+ Sentry . captureException ( e ) ;
47
57
return false ;
48
58
}
49
59
} ,
0 commit comments