Skip to content

Commit e7bfecc

Browse files
committed
feat: return more data from health endpoint
1 parent 65b0a16 commit e7bfecc

File tree

3 files changed

+89
-72
lines changed

3 files changed

+89
-72
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"pino-pretty": "^13.1.1"
2121
},
2222
"devDependencies": {
23-
"@aws-sdk/client-s3": "^3.858.0",
23+
"@aws-sdk/client-s3": "^3.859.0",
2424
"@biomejs/biome": "^2.1.3",
2525
"@commander-js/extra-typings": "^14.0.0",
2626
"@commitlint/cli": "^19.8.1",
@@ -29,9 +29,9 @@
2929
"@gearbox-protocol/cli-utils": "^5.40.1",
3030
"@gearbox-protocol/liquidator-contracts": "^1.36.0-experimental.41",
3131
"@gearbox-protocol/liquidator-v2-contracts": "^2.4.0",
32-
"@gearbox-protocol/sdk": "8.15.0",
32+
"@gearbox-protocol/sdk": "8.16.1",
3333
"@gearbox-protocol/types": "^1.14.8",
34-
"@types/node": "^24.1.0",
34+
"@types/node": "^24.2.0",
3535
"@uniswap/sdk-core": "^7.7.2",
3636
"@uniswap/v3-sdk": "^3.25.2",
3737
"@vlad-yakovlev/telegram-md": "^2.1.0",
@@ -42,7 +42,7 @@
4242
"di-at-home": "^0.0.7",
4343
"esbuild": "^0.25.8",
4444
"husky": "^9.1.7",
45-
"lint-staged": "^16.1.2",
45+
"lint-staged": "^16.1.4",
4646
"nanoid": "^5.1.5",
4747
"node-pty": "^1.0.0",
4848
"pino": "^9.7.0",

src/services/HealthCheckerService.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createServer } from "node:http";
2-
2+
import type { GearboxSDK, ICreditAccountsService } from "@gearbox-protocol/sdk";
33
import { customAlphabet } from "nanoid";
4-
54
import type { Config } from "../config/index.js";
65
import { DI } from "../di.js";
76
import type { ILogger } from "../log/index.js";
@@ -22,6 +21,9 @@ export default class HealthCheckerService {
2221
@DI.Inject(DI.Config)
2322
config!: Config;
2423

24+
@DI.Inject(DI.CreditAccountService)
25+
caService!: ICreditAccountsService;
26+
2527
#start = Math.round(Date.now() / 1000);
2628
#id = nanoid();
2729

@@ -39,9 +41,20 @@ export default class HealthCheckerService {
3941
res.writeHead(200, { "Content-Type": "application/json" });
4042
res.end(
4143
JSON.stringify({
42-
start_time: this.#start,
43-
block_number: this.scanner.lastUpdated,
44+
startTime: this.#start,
4445
version,
46+
network: this.config.network,
47+
family: "liquidators",
48+
liquidationMode: this.config.liquidationMode,
49+
50+
currentBlock: Number(this.sdk.currentBlock),
51+
timestamp: Number(this.sdk.timestamp),
52+
marketsConfigurators:
53+
this.sdk.marketRegister.marketConfigurators.map(mc => mc.address),
54+
pools: this.sdk.marketRegister.pools.map(p => p.pool.address),
55+
creditManagers: this.sdk.marketRegister.creditManagers.map(
56+
cm => cm.creditManager.address,
57+
),
4558
}),
4659
);
4760
} else if (req.url === "/metrics") {
@@ -101,4 +114,8 @@ block_number{${labels}} ${this.scanner.lastUpdated}
101114
102115
`;
103116
}
117+
118+
private get sdk(): GearboxSDK {
119+
return this.caService.sdk;
120+
}
104121
}

0 commit comments

Comments
 (0)