mikejihbe / metrics

A metrics library for Node.js
574 stars 56 forks source link

Where are gauges? #36

Closed onemenny closed 5 years ago

onemenny commented 8 years ago

Why are gauges missing from the library?

tolbertam commented 7 years ago

It looks like they are missing, the way I mimic them is using counters, i.e. whenever I go to update the metric:

    connectionCounter.clear();
    connectionCounter.inc(connectionCount);

Although the benefit of gauges is that you can configure when the values are updated, i.e. either on request or cached. I think it'd be a good idea to add support.

mikejihbe commented 7 years ago

You're right, they're missing. Would definitely accept a PR.

tolbertam commented 7 years ago

I'd be happy to give this a shot as I have a few metrics that are counters that should probably be gauges. I'll follow the dropwizard metrics library and provide implementations to match those (docs), except JMX gauges of course 😉

rafalsiwiec commented 6 years ago

Hey @tolbertam, is this going to happen in the nearest future? :) If not, then I'm keen to prepare the PR.

tolbertam commented 6 years ago

Hi @rafalsiwiec , this kind of slid off my radar and i won't have time to do this in the near future,so I would definitely appreciate a PR, thanks!

rafalsiwiec commented 6 years ago

@tolbertam with this PR #59, I would like to start a discussion: what else gauges do we want to have?

Also, I think that some utility for projecting results of async operations would be useful... What do you think?

tolbertam commented 6 years ago

Thanks for getting a start on this @rafalsiwiec! I think I agree with your sentiment. CachedGauges are very useful and I have used them quite a bit with dropwizard metrics. I've used the other two rarely, they have their use but I don't think they are needed right away. I'd be happy with default and CachedGauges to get started and we can always add the other implementations later.

I'll take a look at your PR tonight, thanks!

tolbertam commented 5 years ago

Fixed by #59, thanks @rafalsiwiec!