Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
add percentile tracking option
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanda Steinwedel committed Oct 24, 2023
1 parent 8da0929 commit 1276748
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/scala/org/http4s/metrics/micrometer/Meters4s.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ object Meters4s {
private val TagReg = """([^:]*)\s*:\s*(.*)""".r

def apply[F[_]: Async](
reporter: Reporter[F]
reporter: Reporter[F],
percentiles: Set[Double] = Set.empty
): MetricsOps[F] =
new MetricsOps[F] {

Expand Down Expand Up @@ -75,7 +76,8 @@ object Meters4s {
reporter
.timer(
name(classifier, "response-headers-time"),
tags(classifier) ++ methodTags(method)
tags(classifier) ++ methodTags(method),
percentiles
)
.flatMap(_.record(elapsed.nanos))

Expand Down Expand Up @@ -127,7 +129,7 @@ object Meters4s {
elapsed: Long
): F[Unit] =
reporter
.timer(name(classifier, "response-time"), tags)
.timer(name(classifier, "response-time"), tags, percentiles)
.flatMap(_.record(elapsed.nanos))

private def methodTags(method: Method): Map[String, String] = Map(
Expand Down

0 comments on commit 1276748

Please sign in to comment.