Skip to content

Conversation

@dispalt
Copy link
Contributor

@dispalt dispalt commented Jan 10, 2024

I copied the CE3 tests, but made them work in ZIO style.

Comment on lines 49 to 57
override def onSuspend[E, A_](fiber: Fiber.Runtime[E, A_])(implicit unsafe: Unsafe): Unit = {
val pctx = Kamon.currentContext()
fiber.asInstanceOf[HasContext].setContext(pctx)
}

override def onResume[E, A_](fiber: Fiber.Runtime[E, A_])(implicit unsafe: Unsafe): Unit = {
val ctx = fiber.asInstanceOf[HasContext].context
Kamon.storeContext(ctx)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these the right way around? That looks opposite from what I'd expect but IDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on suspend you're setting the context of the fiber that you had back to the fiber itself where you were executing it.

onResume your taking the fiber from the pool that you are resuming and applying context to the current session. I am probably saying that wrong.

@dispalt
Copy link
Contributor Author

dispalt commented Jan 16, 2024

@ivantopo would love for you to take a look

@hughsimpson
Copy link
Contributor

lgtm

@hughsimpson hughsimpson merged commit d362be3 into kamon-io:master Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants