0.2.0 • Published 4 years ago

@splunkdlt/prometheus-scraper v0.2.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
4 years ago

@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);
}