open_telemetry_decorator icon indicating copy to clipboard operation
open_telemetry_decorator copied to clipboard

Feature/pass opts to with span

Open jeffdeville opened this issue 7 months ago • 1 comments

This does 2 things:

  1. There's a race condition in the async tests where the test pid is being overwritten on each setup block. (OtelHelper.otel_pid_reporter is constantly reconfiguring telemetry). Turning async off, and stopping opentelemetry when the tests start resolved the issue
  2. We need to be able to set the span.kind attribute (producer/consumer/client/server/internal) in order to get service graphs to be configured in grafana. So we've added kind as an option, and validated the value.
  3. We also wanted the ability to set arbitrary span.attributes, so we allowed attributes to be passed in via opts. Note If the input parameters tried to set a span attribute that was also set via the attributes key, the explicitly set values in attributes take precedence.

jeffdeville avatar Nov 06 '23 22:11 jeffdeville

Hey @jeffdeville,

I'm just getting around to these PRs. Thanks for the work you've done here!

Could you give me an example of when you'd want arbitrary static attributes? I'm trying to weigh the added complexity of additional option against calling Span.set_attributes or Attributes.set in the body of the function.

marcdel avatar Jan 05 '24 22:01 marcdel