Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZIO 2.0 instrumentation #4848

Merged
merged 1 commit into from
Mar 31, 2023
Merged

Conversation

dmytr
Copy link
Contributor

@dmytr dmytr commented Mar 4, 2023

What Does This Do

Adds instrumentation for ZIO 2.0.

Motivation

ZIO is a popular Scala library for asynchronous and concurrent programming. Its runtime uses green threads (fibers) which breaks instrumentation because scope state is stored in ThreadLocal variable. This PR takes care of synchronizing scope state between fibers and JVM threads on which they are executed.

Implementation was tested on a non-trivial distributed application.

Details

This instrumentation is experimental and it's disabled by default. Use -Ddd.integration.zio.experimental.enabled=true to enable it.

@dmytr dmytr requested a review from a team as a code owner March 4, 2023 19:11
@dmytr dmytr force-pushed the zio-instrumentation branch from 619af03 to 64ffa27 Compare March 5, 2023 20:46
@devinsba devinsba added inst: others All other instrumentations tag: community Community contribution inst: scala Scala instrumentation labels Mar 6, 2023
@devinsba
Copy link
Contributor

devinsba commented Mar 6, 2023

With the work that @PerfectSlayer is doing on #4795 I think they need to be the one to review this.

@dmytr dmytr force-pushed the zio-instrumentation branch from 2186802 to 1de9440 Compare March 11, 2023 13:17
@dmytr
Copy link
Contributor Author

dmytr commented Mar 22, 2023

Hi @devinsba, it doesn't look like APIs used in this PR are affected by the referenced PR (#4795). Maybe we could make this one move forward somehow?

@bantonsson
Copy link
Contributor

Hi @dmytr, thank you for the contribution. I'm sorry that this seems to have fallen between the cracks. I'll try to review this today.

@bantonsson
Copy link
Contributor

Hey @dmytr, just wanted to let you know that I've been looking at this today, but I need to dig a bit deeper into it. Will continue on Monday.

@dmytr
Copy link
Contributor Author

dmytr commented Mar 24, 2023

Thank you, @bantonsson! Looking forward to your feedback.

In case if it could be useful - I've done something similar for OTEL JVM agent as well (link).

Copy link
Contributor

@bantonsson bantonsson left a comment

Choose a reason for hiding this comment

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

Thanks once again @dmytr. Mostly some minor comments based on my limited understanding of the internals of ZIO. Please correct me if I've misunderstood anything.

Copy link
Contributor Author

@dmytr dmytr left a comment

Choose a reason for hiding this comment

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

Thanks for your review, @bantonsson. I've made requested changes and answered on your comments.

@bantonsson
Copy link
Contributor

Hey @dmytr would you mind squashing your commits before we merge this PR?

@dmytr dmytr force-pushed the zio-instrumentation branch from 1c26bf8 to 4e609c1 Compare March 30, 2023 17:00
@dmytr
Copy link
Contributor Author

dmytr commented Mar 30, 2023

Hi @bantonsson, I've squashed commits in this PR. And just in case re-tested it using my toy distributed app. Everything looks good! Thanks a lot for your help with this PR 🙇‍♂️

@bantonsson
Copy link
Contributor

Thanks for the contribution @dmytr. I'll merge this as soon as I've nursed it through some CI flakiness.

@bantonsson bantonsson merged commit 703c714 into DataDog:master Mar 31, 2023
@bantonsson bantonsson added this to the 1.12.0 milestone Mar 31, 2023
@jivanic-demystdata
Copy link

Does anyone know if it's still working? It doesn't add any traces in my Scala 3.4.2 / ZIO 2.0.22 project 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: others All other instrumentations inst: scala Scala instrumentation tag: community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants