prometheus 0.1.2

Prometheus collectors and metrics


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Prometheus for D

This library helps you expose your metrics in a Prometheus compatible format. The core library has no external dependencies which makes it easy to integrate with other solutions.

Example

This is an example using Vibe.d to export the number of page hits.

import prometheus.counter;
import prometheus.registry;
import prometheus.vibe;

import vibe.d;

void main()
{
    auto settings = new HTTPServerSettings;
    settings.port = 10000;

    //create counter and register with global registry
    Counter c = new Counter("hit_count", "Shows the number of site hits", null);
    c.register;

    //start routes for Vibe.d
    auto router = new URLRouter;
    router.any("*", (HTTPServerRequest req, HTTPServerResponse res) {
        c.inc;
    });
    router.get("/", (HTTPServerRequest req, HTTPServerResponse res) {
        res.writeBody(cast(ubyte[])"hello, world!");
    });
    router.get("/metrics", handleMetrics(Registry.global));

    listenHTTP(settings, router);
    runApplication;
}

TODO

  • [x] Counter
  • [x] Gauge
  • [x] Histogram
  • [ ] Summary
  • [ ] Default Dlang metrics (GC, etc...)
  • [x] Vibe.d integration
  • [hunt] integration
Authors:
  • Andrew Benton
Sub packages:
prometheus:vibe
Dependencies:
none
Versions:
0.2.1 2020-Aug-21
0.2.0 2019-Mar-22
0.1.3 2018-Nov-04
0.1.2 2018-May-29
0.1.1 2018-May-20
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 37 downloads this week

  • 107 downloads this month

  • 8018 downloads total

Score:
2.0
Short URL:
prometheus.dub.pm