Skip to content

allow Histograms and Summaries to time Callables (2)#378

Merged
brian-brazil merged 1 commit intoprometheus:masterfrom
yarosla:time-callables-squashed
Apr 23, 2018
Merged

allow Histograms and Summaries to time Callables (2)#378
brian-brazil merged 1 commit intoprometheus:masterfrom
yarosla:time-callables-squashed

Conversation

@yarosla
Copy link
Copy Markdown
Contributor

@yarosla yarosla commented Apr 21, 2018

@brian-brazil Recreated #368 from squashed branch + signed-off

Another usability enhancement allowing instead of:

String v;
try (Summary.Timer timer = summary.startTimer()) {
  v = someMethod();
}

to write:

String v = summary.time(this::someMethod);

This is especially useful when programming (reactive) streams.

Trying to make metric code as unobtrusive as possible.

BTW Micrometer already does that.

allow Gauges to time Callables + small fix in javadocs

Signed-off-by: Yaroslav Stavnichiy <[email protected]>
@brian-brazil brian-brazil merged commit 40d179d into prometheus:master Apr 23, 2018
@brian-brazil
Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants