open-telemetry/opentelemetry-erlang

Spans not being closed when parent process exits

kivra-mikgra opened this issue · 1 comments

I'm trying to solve some issues we have with spans not being exported. It happens specifically when spans are not being closed.
The specific scenario that we have is that we get a http request that requires an internal http request (that we perform with Finch). When the Finch request takes too long the http request from the outside times out. So the Finch request gets shut down without being able to close the span (since no end event is emitted).
So we can see traces for the incoming (Phoenix) http request, but the internal (Finch) one doesn't show up (since it was only started, never closed). This seems to be a general pattern when process exits without doing clean up, and not limited to Finch.

To see child spans of our Phoenix requests that times out is really important to us.

Thank you!

I think this issue speaks to a need for a function like opentelemetry:span_monitor(pid()).

Even if it is decided that instrumentation libraries should be registering their spans with the monitor it gives the user the ability to enforce it if the library doesn't yet.