roylines / node-epimetheus

node middleware to automatically instrument node applications for consumption by prometheus
MIT License
85 stars 45 forks source link

Expose prom-client #38

Closed zerok closed 7 years ago

zerok commented 7 years ago

This will allow users to register custom metrics and expose them through the same registry.

bricef commented 7 years ago

Hey @zerok, I think that this is quite unnecessary. You can already expose custom metrics by talking to the prom-client module directly:

const epimetheus = require('epimetheus');
const client = require('prom-client');

//... 

epimetheus.instrument(app)

const counter = new client.Counter({name: "My counter", help:"Some help text"})

//...

app.get("/some/endpoint/", (req, res)=>{
    //...    
    counter.inc(10)
    //...
});

And it will be merged with the Epimetheus default metrics.

zerok commented 7 years ago

@bricef Weird, for some reason pretty much the same example didn't work for me before. All the better :) Thanks!