From ec6edc4164fa06a561d55af43bd277c35439cc23 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 24 Jan 2023 17:48:09 +0000 Subject: [PATCH] Bare minimum to fix compile --- modules/mock/src/main/scala/MockEntryPoint.scala | 12 ++++++------ modules/mock/src/main/scala/MockSpan.scala | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/mock/src/main/scala/MockEntryPoint.scala b/modules/mock/src/main/scala/MockEntryPoint.scala index 03cdb0b0..5fe61ff4 100644 --- a/modules/mock/src/main/scala/MockEntryPoint.scala +++ b/modules/mock/src/main/scala/MockEntryPoint.scala @@ -5,8 +5,6 @@ package natchez package mock -import scala.jdk.CollectionConverters._ - import cats.effect.{Resource, Sync} import io.opentracing.mock.MockTracer import io.opentracing.propagation.{Format, TextMapAdapter} @@ -15,21 +13,22 @@ final case class MockEntrypoint[F[_]: Sync]() extends EntryPoint[F] { val mockTracer = new MockTracer() - override def root(name: String): Resource[F, Span[F]] = + override def root(name: String, options: Span.Options): Resource[F, Span[F]] = Resource .make(Sync[F].delay(mockTracer.buildSpan(name).start()))(span => Sync[F].delay(span.finish())) .map(MockSpan(mockTracer, _)) override def continue( name: String, - kernel: Kernel + kernel: Kernel, + options: Span.Options ): Resource[F, Span[F]] = Resource .make( Sync[F].delay { val spanCtxt = mockTracer.extract( Format.Builtin.HTTP_HEADERS, - new TextMapAdapter(kernel.toHeaders.asJava) + new TextMapAdapter(kernel.toJava) ) mockTracer.buildSpan(name).asChildOf(spanCtxt).start() } @@ -38,7 +37,8 @@ final case class MockEntrypoint[F[_]: Sync]() extends EntryPoint[F] { override def continueOrElseRoot( name: String, - kernel: Kernel + kernel: Kernel, + options: Span.Options ): Resource[F, Span[F]] = continue(name, kernel).flatMap { case null => diff --git a/modules/mock/src/main/scala/MockSpan.scala b/modules/mock/src/main/scala/MockSpan.scala index 5302feae..ec10591e 100644 --- a/modules/mock/src/main/scala/MockSpan.scala +++ b/modules/mock/src/main/scala/MockSpan.scala @@ -27,7 +27,7 @@ final case class MockSpan[F[_]: Sync](tracer: ot.mock.MockTracer, span: ot.mock. Format.Builtin.HTTP_HEADERS, new TextMapAdapter(m) ) - Kernel(m.asScala.toMap) + Kernel.fromJava(m) } def put(fields: (String, TraceValue)*): F[Unit] = @@ -37,7 +37,7 @@ final case class MockSpan[F[_]: Sync](tracer: ot.mock.MockTracer, span: ot.mock. case (k, BooleanValue(v)) => Sync[F].delay(span.setTag(k, v)) } - def attachError(err: Throwable): F[Unit] = + def attachError(err: Throwable, fields: (String, TraceValue)*): F[Unit] = put( Tags.ERROR.getKey -> true ) >> @@ -61,7 +61,7 @@ final case class MockSpan[F[_]: Sync](tracer: ot.mock.MockTracer, span: ot.mock. override def log(event: String): F[Unit] = Sync[F].delay(span.log(event)).void - def span(name: String): Resource[F, Span[F]] = + def span(name: String, options: Span.Options): Resource[F, Span[F]] = Resource .make { Sync[F].delay(tracer.buildSpan(name).asChildOf(span).start) @@ -72,7 +72,7 @@ final case class MockSpan[F[_]: Sync](tracer: ot.mock.MockTracer, span: ot.mock. def span(name: String, kernel: Kernel): Resource[F, Span[F]] = { val parent = - tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(kernel.toHeaders.asJava)) + tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(kernel.toJava)) Resource .make(Sync[F].delay(tracer.buildSpan(name).asChildOf(span).asChildOf(parent).start)) { s => Sync[F].delay(s.finish())