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

IO(doStuff).trace("", Attributes(...)) syntax #536

Open
lhns opened this issue Mar 5, 2024 · 4 comments
Open

IO(doStuff).trace("", Attributes(...)) syntax #536

lhns opened this issue Mar 5, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@lhns
Copy link

lhns commented Mar 5, 2024

trace4cats has this nice extension syntax that allows to introduce tracing into a code base without adding much clutter:

IO(doStuff).trace("", Attributes(...))

I would love for something like this to be in otel4s but it would add another way to do things.

@iRevive iRevive added the enhancement New feature or request label Mar 6, 2024
@iRevive
Copy link
Contributor

iRevive commented Mar 6, 2024

That could be useful.

@NthPortal what do you think? Do you have similar use cases at work?

I guess we can make extension syntax available via imports:

import org.typelevel.otel4s.metrics.syntax._ // metrics only syntax
import org.typelevel.otel4s.trace.syntax._ // trace only syntax
import org.typelevel.otel4s.syntax._ // metrics and trace syntax

@NthPortal
Copy link
Contributor

originally I was going to say that I don't object particularly, but I realised that it would require another set of macros (or lose the optimisation), so I'm not sure if it's a great idea

@lhns
Copy link
Author

lhns commented Mar 14, 2024

Maybe a scala-3-only inline def?

@iRevive
Copy link
Contributor

iRevive commented Mar 15, 2024

We already have macro definitions for both Scala 2 and Scala 3. With some refactoring, we can make it work.

As I mentioned here, perhaps we can launch experimental modules with no guarantee of binary compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants