-
Notifications
You must be signed in to change notification settings - Fork 130
Begin capturing metrics to better understand Pantheon's behaviour #326
Conversation
…ination of modified metric name and labels. Add tests for PrometheusMetricsSystem.
…ually understandable.
The format of the output is not guaranteed as the particularly metrics we track will change but an example of the current output is:
|
|
||
public interface MetricsSystem { | ||
|
||
default Counter createCounter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a default method? Doesn't the var-args already handle the zero arg case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns a raw Counter
the one with varargs returns LabelledMetric<Counter>
so you have to supply label values before you can call inc()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, however createLabeledCounter for the varargs would look better in calling code where return value isn't always obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, changed.
public void shouldCreateObservationsFromTimer() { | ||
final OperationTimer timer = metricsSystem.createTimer(RPC, "request", "Some help"); | ||
|
||
final TimingContext context = timer.startTimer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make one of these timer tests a try with resources? That would validate the Closable interface on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
PR description
Introduces a set of simple interfaces to define metrics capturing devices like counter and timer. Two initial implementations are provided, one using Prometheus Client and one No-Op implementation which is currently only used in tests.
Metrics are exposed via the
debug_metrics
JSON-RPC method.Metrics being captured initially: