Skip to content

Commit

Permalink
Merge pull request #760 from iRevive/core-trace/remove-histogram-doub…
Browse files Browse the repository at this point in the history
…le-backend

core-trace: remove `Histogram.DoubleBackend`
  • Loading branch information
iRevive authored Sep 7, 2024
2 parents f699969 + 89a54c5 commit 3c07667
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "0.9"
ThisBuild / tlBaseVersion := "0.10"

ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "Typelevel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ package org.typelevel.otel4s
package metrics

import cats.Applicative
import cats.Monad
import cats.effect.kernel.Clock
import cats.effect.kernel.Resource
import cats.syntax.flatMap._
import cats.syntax.functor._
import org.typelevel.otel4s.meta.InstrumentMeta

import scala.collection.immutable
Expand Down Expand Up @@ -135,28 +131,6 @@ object Histogram {
): Resource[F, Unit]
}

abstract class DoubleBackend[F[_]: Monad: Clock] extends Backend[F, Double] {

final val unit: F[Unit] = Monad[F].unit

final def recordDuration(
timeUnit: TimeUnit,
attributes: immutable.Iterable[Attribute[_]]
): Resource[F, Unit] =
Resource
.makeCase(Clock[F].monotonic) { case (start, ec) =>
for {
end <- Clock[F].monotonic
_ <- record(
(end - start).toUnit(timeUnit),
attributes ++ causeAttributes(ec)
)
} yield ()
}
.void

}

def noop[F[_], A](implicit F: Applicative[F]): Histogram[F, A] =
new Histogram[F, A] {
val backend: Backend[F, A] =
Expand Down

0 comments on commit 3c07667

Please sign in to comment.