Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,25 @@ class NewSupervisor extends Supervisor[Any] {
parent: Option[Fiber.Runtime[Any, Any]],
fiber: Fiber.Runtime[E, A_]
)(implicit unsafe: Unsafe): Unit = {
fiber.asInstanceOf[HasContext].setContext(Kamon.currentContext())
val fi = fiber.asInstanceOf[HasContext with HasStorage]
fi.setContext(Kamon.currentContext())
}

override def onSuspend[E, A_](fiber: Fiber.Runtime[E, A_])(implicit unsafe: Unsafe): Unit = {
fiber.asInstanceOf[HasContext].setContext(Kamon.currentContext())
val fi = fiber.asInstanceOf[HasContext with HasStorage]
fi.setContext(Kamon.currentContext())
fi.kamonScope.close()
}

override def onResume[E, A_](fiber: Fiber.Runtime[E, A_])(implicit unsafe: Unsafe): Unit = {
val fiberInstance = fiber.asInstanceOf[HasContext with HasStorage]
val ctx = fiberInstance.context
fiberInstance.setKamonScope(Kamon.storeContext(ctx))
val fi = fiber.asInstanceOf[HasContext with HasStorage]
val ctx = fi.context
fi.setKamonScope(Kamon.storeContext(ctx))
}

override def onEnd[R, E, A_](value: Exit[E, A_], fiber: Fiber.Runtime[E, A_])(implicit unsafe: Unsafe): Unit = {
val fiberInstance = fiber.asInstanceOf[HasContext with HasStorage]
fiberInstance.kamonScope.close()
val fi = fiber.asInstanceOf[HasContext with HasStorage]
fi.kamonScope.close()
()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ class ZIO2InstrumentationSpec extends AnyWordSpec with Matchers with ScalaFuture
}
}

override protected def afterEach(): Unit = {
super.afterEach()

kamon.context.Storage.Debug.printNonEmptyThreads()
}

private def getKey: UIO[String] = {
ZIO.succeed(Kamon.currentContext().getTag(plain("key")))
}
Expand Down