pinax-network / substreams-sink

Substreams Sink library
MIT License
4 stars 1 forks source link

handle pushing manifest Prometheus metrics #5

Closed DenisCarriere closed 1 year ago

DenisCarriere commented 1 year ago
export function handleManifest(substreams: BlockEmitter, manifest: string, hash: string) {
    logger.info("manifest", { manifest, hash });
    const labelNames = ["hash", "manifest", "outputModule", "host", "auth", "startBlockNum", "productionMode"];
    registerGauge("manifest", "Substreams manifest and sha256 hash of map module", labelNames);
    const gauge = register.getSingleMetric("manifest") as Gauge;
    gauge.labels({
        hash,
        manifest,
        outputModule: substreams.outputModule,
        host: substreams.host,
        auth: substreams.auth,
        startBlockNum: substreams.startBlockNum,
        productionMode: String(substreams.productionMode)
    }).set(1)
}
DenisCarriere commented 1 year ago

implemented