Otel4s
The otel4s provides an integration with the otel4s library.
libraryDependencies += "com.commercetools" %% "fs2-queues-otel4s" % "0.7.0"
It allows you to wrap an existing QueueClient into a MeasuringQueueClient, which adds tracing and metrics on every call to the underlying queue system.
You can opt-in for either one of them or both.
import cats.effect.IO
import com.commercetools.queue.QueueClient
import com.commercetools.queue.otel4s._
import org.typelevel.otel4s.metrics.Meter
import org.typelevel.otel4s.trace.Tracer
val rawClient: QueueClient[IO] = ???
implicit val meter: Meter[IO] = ???
implicit val tracer: Tracer[IO] = ???
val withMetrics = rawClient.withMetrics()
val withTracing = rawClient.withTraces
val withBoth = rawClient.withMetricsAndTraces()
The extension methods adding metrics take an optional parameter indicating the name of the counter that counts the calls to the queue system. The default is defined in MeasuringQueueClient.defaultRequestMetricsName.
import com.commercetools.queue.otel4s.MeasuringQueueClient
MeasuringQueueClient.defaultRequestMetricsName
// res1: String = "queue.service.call"