How do I flush traces from `otel_batch_processor` at the end of a test run?

I have an application using opentelemetry

It is configured to use otel_batch_processor. We have Jaeger running locally and would like to see traces from a test when after run. We could see them sometimes and sometimes we couldn’t. We diagnosed the issue to the fact that otel_batch_processor does its jobs and batches traces. Sometimes it is able to send them, but if the tests finish to quickly, they get lost.

We’ve found there is a function force_flush function , but it takes config that I am not sure how to get.

Did anybody had a similar issue? How can I force_flush OTEL traces at the end of tests?

1 Like

If you have a small project with all dependencies included that demonstrates the problem, I’ll gladly try to help.