@span annotation using macro-annotations #550
Replies: 6 comments 15 replies
-
I'm not a big fan of macro annotations, but this idea sounds interesting. @span
def doWork(@attribute("user.id") userId: String): F[Unit] = ???
@span(name = "customSpanName")
def internal: F[Unit] = ??? should be transformed into: def doWork(userId: String): F[Unit] =
Tracer[F].span("doWork", Attribute("user.id", userId)).use { _ => ??? }
def internal: F[Unit] =
Tracer[F].span("customSpanName").use { _ => ??? } The idea fits the 'experimental' category. I guess we can have Once we consider the functionality stable, we can move it to the |
Beta Was this translation helpful? Give feedback.
-
@NthPortal @mpilquist @rossabaker what's your opinion on this topic? |
Beta Was this translation helpful? Give feedback.
-
I'm not a big fan of macro annotations in general. In this case in particular I don't feel the (IMO very small) convience is worth the cost. At work we define an extension method on
Alternatively we can make |
Beta Was this translation helpful? Give feedback.
-
With Natchez, I've been using cats-tagless to transform untraced algebras to traced algebras using its AOP mechanism. There's quite a bit more context in the readme of the supporting library we published. I haven't looked into how it will port to otel4s yet, but I'm hoping to do so soon now that things are stabilizing. Something like that might be another alternative. |
Beta Was this translation helpful? Give feedback.
-
I made a draft implementation, please take a look: #675. |
Beta Was this translation helpful? Give feedback.
-
@swapdonkey the functionality is available here - https://github.com/typelevel/otel4s-experimental. build.sbt: libraryDependencies ++= Seq(
"org.typelevel" %%% "otel4s-experimental-trace" % "0.2.0"
) code: import org.typelevel.otel4s.experimental.{attribute, span}
@span
def findUser(
@attribute userId: Long,
@attribute("user.hash") hash: String
): F[User] = ??? |
Beta Was this translation helpful? Give feedback.
-
Hi,
Otel4s is looking very promising. A nice feature would be using a
@span
macro-annotation which would wrap functions in a span. Also a@attribute
for function parameters would also be beneficial. Do you think this would be possible with the current implementation?Beta Was this translation helpful? Give feedback.
All reactions