sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Implement new POTel span processor

Open sl0thentr0py opened this issue 7 months ago • 3 comments

  • only acts on on_end instead of both on_start/on_end as before
  • store children spans in a dict mapping span_id -> children
  • new dict only stores otel span objects and no sentry transaction/span objects so we save a bit of useless memory allocation
  • I'm not using our current Transaction/Span classes at all to build the event because when we add our APIs later, we'll need to rip these out and we also avoid having to deal with the instrumenter problem
  • if we get a root span (without parent), we recursively walk the dict and find the children and package up the transaction event and send it
    • I didn't do it like JS because I think this way is better
    • they group an array of finished_spans every time a root span ends and I think this uses more cpu than what I did
    • and the dict like I used it doesn't take more space than the array either
  • if we get a span with a parent we just update the dict to find the span later
  • moved the common is_sentry_span logic to utils

sl0thentr0py avatar Jun 28 '24 11:06 sl0thentr0py