opentelemetry-http: stabilize lifecycle cancellation test#3570
opentelemetry-http: stabilize lifecycle cancellation test#3570arnabnandy7 wants to merge 1 commit into
Conversation
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
|
I imagine this fixes the flaky test, but I'm a bit concerned about why it's flaky in the first place. Eg, are we papering over a real problem? |
|
@bryce-anderson Thanks for raising this. I traced the cancellation path to make sure the change is not hiding a production issue.
This is consistent with the requester filter documentation, which notes that callbacks executing after the tracing filter closes its scope will not be able to modify the span. The change still verifies that:
It only removes the assumption that |
Motivation
OpenTelemetryHttpRequesterFilterTest.transportObserverwas flaky when cancelling an HTTP/2 request. The test assumed thatonExchangeFinally()always runs before the OpenTelemetry span is exported. During cancellation, request termination may complete asynchronously, allowing the span to end before the final lifecycle callback adds its test attribute.Fixes #3561.
Modifications
TestHttpLifecycleObserverto observeonExchangeFinally()deterministically.Result
The cancellation test no longer depends on timing or span mutability after export. All
transportObserverHTTP/1.1 and HTTP/2 combinations pass.There are no production behavior, API, or compatibility changes; only test code is affected.