Closed gudmundur closed 8 years ago
Good stuff! Two thoughts:
Pliny::Metrics
rather than mixing them into the top level namespace? It's a little more typing, but I don't think the explicitness is a bad thing.@brandur I've moved the methods into Pliny::Metrics
. As for abstracting away how the metrics are emitted, I'd prefer to punt on that until that use case actually comes up. Is that alright with you?
@brandur I've moved the methods into Pliny::Metrics. As for abstracting away how the metrics are emitted, I'd prefer to punt on that until that use case actually comes up. Is that alright with you?
@gudmundur Yep, absolutely! It seems like the interface should be generic enough that it won't back us into a corner.
LGTM! Sorry about the review delay. Feel free to bump these more often if I'm not answering because it might mean that I declared inbox zero on GitHub issues :)
Adds
Pliny::Metrics.count(*names, value: 1)
andPliny::Metrics.measure(*names, &block)
methods. By invoking the methods, they will emit logfmt entries.Examples
Pliny::Metrics.count(:hello)
will emitcount#my_pliny_app.hello=1
.Pliny::Metrics.measure(:hello) { sleep(1) }
will emitmeasure#my_pliny_app.hello=1.000
.