Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
0oM4R committed Jan 22, 2024
1 parent 7b5f868 commit e5326a7
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions packages/monitoring/example/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { TFservicesLiveChecker } from "../src/index";
import { TFServices } from "../src/types";
import { checkServiceAliveness, GridProxyMonitor, monitorServiceAliveness } from "../src/";
import { RMBMonitor, TFChainMonitor } from "../src/serviceMonitor";
import { IServiceAliveness } from "../src/types";
async function HealthCheck() {
/* urls.rmbProxy = "https://gridproxy.dev.grid.tf";
urls.relay = "wss://relay.dev.grid.tf";
urls.substrate = "wss://tfchain.dev.grid.tf/ws";
urls.graphql = "https://graphql.dev.grid.tf/graphql";
*/
try {
const s: TFServices = {
graphQL: { LivenessURL: "https://graphql.dev.grid.tf/graphql" },
gridProxy: { LivenessURL: "https://gridproxy.dev.grid.tf" },
tfChain: { LivenessURL: "wss://tfchain.dev.grid.tf/ws" },
rmb: { LivenessURL: "wss://relay.dev.grid.tf" },
};
console.log(await TFservicesLiveChecker(s));
const services: IServiceAliveness[] = [];
services.push(new GridProxyMonitor("<FakeURL>"));
services.push(new TFChainMonitor("wss://tfchain.dev.grid.tf/ws"));
services.push(new RMBMonitor("wss://relay.dev.grid.tf", "wss://tfchain.dev.grid.tf/ws", "", "sr25519"));
// monitor some services once
await checkServiceAliveness(services);
// keep monitoring services with Interval
await monitorServiceAliveness(services, 5);

process.exit(0);
} catch (err) {
console.log(err);
Expand Down

0 comments on commit e5326a7

Please sign in to comment.