The session began with a quick appraisal of the current design document with special emphasis on the competitors. In particular, Metrics Scala
, Kamon
and Monad Metrics
were discussed. It was agreed that a comprehensive
library should be one that has at least the intruments proposed originally by Coda Hale whose library acts as the basis for most metrics related libraries.
Next, John began modelling the main traits
for scalaz-metrics using definitions and experience from the attendees, he has already shared the result in a gist.
To understand all instruments be sure to watch the Metrics, Metrics, Everywhere talk if you haven't done so.
Metrics takes 3 type parameters:
C[_]
: A context for execution. For instance, onrequestTime(doRequest(x, y, z))
, the execution contextC
would be the function call fordoRequest
.F[__]
: Is an effect such asIO
L
: Is a label which needs not be a string. For instance, it could be someclass
or similar component such that when using a syntax extension (io.counter(label)
),L
defines the scope of the counter and any hierarchy can be derived from the class or component's own hierarchy.
A
in gauge
is bounded by Semigroup
so that no matter where its called from on an application, we have the ability to combine the values, if needed.
Similarly, A
on histogram
needs to be bounded, at the very least by Ord
since histogram values need to be ordered into quantiles.
Besides the current specified bounds, A
may need to be further constrained by what values JMX actually supports.
Histograms are traditionally built from an entire data set by first sorting the data and then taking the median value. This is not possible for high-throughput, low-latency services so sampling is used instead. This sampling is done via reservoir representative of the whole data stream. The technique is called reservoir sampling. We must support different Reservoir
implementations.
We need to be able to transform measured data into different pluggable output formats such as HTML, Json, etc.
- Find out what types work on JMX
- Based on the above, specify the appropriate context bounds fro
A
. - Implement the traits as a wrapper for some existing API such as Dropwizard or Kamon
- Raise tickets for the above actions
Execute sbt scalafmtCheck test:scalafmtCheck scalafmtSbtCheck test
to make sure the format is correct.