Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Latest commit

 

History

History

prometheus-scraper

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@splunkdlt/prometheus-metrics

Utility to help scrape metrics from apps exposing prometheus-style metrics endpoints.

Example Usage

while (running) {
    const scrapeResult = await scrapePrometheusMetrics({
        url: 'http://localhost:8080/debug/metrics/prometheus',
    });

    const convertedMetrics = convertToHecMultiMetrics(scrapeResult.metrics, {
        captureTimestamp: Date.now(),
        namePrefix: 'geth',
        metadata: {
            host: os.hostname(),
            source: 'geth:metrics:prometheus',
        },
    });

    for (const hecMetrics of convertedMetrics) {
        hec.pushMetrics(hecMetrics);
    }

    await sleep(5_000);
}