typelevel / otel4s

An OpenTelemetry library for Scala based on Cats-Effect
https://typelevel.org/otel4s
Apache License 2.0
162 stars 30 forks source link

oteljava: correctly capture exemplars. sdk, oteljava: use shared `BaseMeterSuite` #660

Closed iRevive closed 2 months ago

iRevive commented 2 months ago

This PR accomplishes two things: 1) fixes oteljava backend to capture exemplars correctly

OpenTelemetry Java uses JContext.current() to attach trace_id/span_id to an exemplar. The context cannot be propagated seamlessly between CE IOLocal and oteljava ThreadLocal. There are more details: https://github.com/typelevel/otel4s/issues/202 and a possible fix https://github.com/typelevel/otel4s/pull/214 (waiting for CE, though).

To make it work, we can propagate the context manually.

2) tests both implementations (sdk and oteljava) using a shared BaseMeterSuite

That way we can guarantee that the behavior is identical

NthPortal commented 2 months ago

@iRevive I'm assuming you didn't mean to close #214?

iRevive commented 2 months ago

@NthPortal oh, no I didn't! I guess I linked the wrong task/PR, and it closed automatically. Thanks for pointing out.