@splunkdlt/prometheus-scraper
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @splunkdlt/prometheus-scraper

Weekly Downloads

2

Version

0.2.0

License

Apache-2.0

Unpacked Size

261 kB

Total Files

41

Last publish

Collaborators

  • spuchbauer-splunk
  • tmio