Effect CommunityEC
Effect Community2mo ago
5 replies
leighman

Sharing `otelTracer` with `ManagedRuntime` and `TaskEither`

We have an existing tracing setup via TaskEither with a function like
      trace: (operation, spanName, attributes) =>
        TE.bracket(
          TE.right(otelTrace.getTracer(serviceName).startSpan(spanName)),
          (span) => {
            span.setAttributes(attributes)
            return () =>
              context.with(otelTrace.setSpan(context.active(), span), operation)
          },
          (span) => {
            span.end()
            return TE.right(undefined)
          },
        ),

We finally have a ManagedRuntime in place so I'm thinking we can now share the tracer stuff and use withSpan etc in effect areas but will need both for a while. Is there a way to just share the otelTracer or do I need some kind of Tracer.make similar to the above (or something else?)
Was this page helpful?