Skip to content

Commit

Permalink
Add Secondary Reporters (#88)
Browse files Browse the repository at this point in the history
Add Secondary Reporters
  • Loading branch information
ChristopherDavenport authored Dec 4, 2019
2 parents 014d4a2 + a63c30a commit 0001e33
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object EpimetheusOps {
): F[MetricsOps[F]] =
register(cr, Name("org_http4s_server"), buckets, reportMethod, reportStatus)

def client[F[_]: Sync](
def client[F[_]: Sync](
cr: CollectorRegistry[F],
buckets: List[Double] = Histogram.defaults,
reportMethod: Method => String = EpimetheusOps.defaultReportMethod,
Expand Down Expand Up @@ -123,7 +123,6 @@ object EpimetheusOps {
.observe(nanosToSeconds(elapsed))
}


// Elapsed is in Nanos, but buckets are in Seconds
private def nanosToSeconds(l: Long): Double =
l / nanoseconds_per_second
Expand Down Expand Up @@ -198,6 +197,7 @@ object EpimetheusOps {
case _ => "5xx"
}

def secondaryReportStatus(status: Status): String = status.code.show

def defaultReportMethod(m: Method): String = m match {
case Method.GET => "get"
Expand All @@ -212,6 +212,8 @@ object EpimetheusOps {
case _ => "other"
}

def secondaryReportMethod(m: Method): String = m.name.toLowerCase()

private def reportTermination(t: TerminationType): String = t match {
case Abnormal => "abnormal"
case Error => "error"
Expand Down

0 comments on commit 0001e33

Please sign in to comment.