Skip to content

Conversation

@aabmass
Copy link
Member

@aabmass aabmass commented Oct 30, 2023

Quick concept of BatchSpanProcessor implemented with asyncio #3274. Not nearly as fleshed out as #3485 but could be offered in addition to that

This would work as a drop in for the current implementation and is thread safe. We could expose async functions on TracerProvider and an async SpanExporter which would could work entirely in one thread. Benefits of using asyncio:

  • Queueing and exporting are all happening in a single thread, so handling concurrency is simplified
  • Every BSP instance uses the same thread which may be less resource intensive. I think this is debatable without testing. Note SpanExporter.export() is run in a shared ThreadPoolExecutor, although we could introduce AsyncSpanExporter to avoid this (Support for async exporters #3273)
  • Couroutines can be cancelled/timed out as opposed to threads, which is a big issue with the current BSP blocking shutdown. Again won't work great with existing blocking SpanExporter.export()

@mastizada
Copy link

Hello, is there a way that I can help with this? It will be really nice to have async exporter.

@cpvandehey
Copy link

This is absolutely critical. Id love to help push this forward. Can we get someone from the OTEL python community to review this with us?

From my perspective, OTEL export will never run in production on an event loop until this solution is established

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants