Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 5x 5x 5x | import { Pushgateway } from "prom-client";
import { loadConfig } from "my-nconf";
interface PromClientOptions {
push_url: string;
push_timeout: number;
}
export class PromClient {
private _pushgateway: Pushgateway;
private _client: Object;
private _opts: PromClientOptions;
private static _instance;
static get Instance() {
if (!this._instance) {
this._instance = new PromClient(
loadConfig().get("metrics_reporter.prometheus")
);
}
return this._instance;
}
constructor(
options: PromClientOptions = {
push_url: "localhost:9091",
push_timeout: 5000
}
) {
this._opts = options;
this._client = require("prom-client");
this._pushgateway = new Pushgateway(this._opts.push_url, {
timeout: this._opts.push_timeout
});
}
get client(): any {
return this._client;
}
set pushgateway(instance: Pushgateway) {
this._pushgateway = instance;
}
get pushgateway(): Pushgateway {
return this._pushgateway;
}
}
|