For each ingressing request to ktor server, are they started in their own coroutine, with their own coroutine context? We are seeing some rather strange behavior in MDC logging where when we add a header value that is unique to every request or null - it is somehow being relogged for requests that do not match
๐คจ 2
Jacob Schwartz
05/06/2024, 11:58 PM
Some more hopefully helpful context:
I happened to be checking some logs while testing something else out and noticed that an old trace ID was somehow reused. On inspection, this seems to only be happening with requests that don't have a header value set (liveness probes) and the Otel library is setting the value appropriately (see the column to the right of the last highlighted request)
Jacob Schwartz
05/06/2024, 11:59 PM
The odd part about this, is there's a gap in the processing thread, but I don't have coroutine ids logged anywhere.
Could a coroutine or its context somehow be reused after the first request is terminated?
module, which (if I'm reading the source correctly) uses the coroutine aware MDC lib
Jacob Schwartz
05/08/2024, 6:43 PM
Any more thoughts? We've been using the correct library and still see the issue
Jacob Schwartz
05/08/2024, 6:49 PM
More importantly, can someone confirm that all requests coming into Ktor are processed as their own coroutines with their own contexts?
This is coming up because part of my work involves adding some more information into the context.