You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix flakiness in the TraceAnnotation tests (#7554)
## Summary of changes
Fixes flakiness in the `TraceAnnotation` tests
## Reason for change
#7287 incidentally
introduced flakiness in the test when the profiler is not available
(i.e. only on Windows). We temporarily disabled the test in #7551 and
#7552. This reinstates the test, and removes the flake.
## Implementation details
The important thing is that we do a "real" instrumentation in the app,
to insure that we send instrumentation telemetry. Without this, there's
a race condition between us instrumenting our "own" `HttpClient` usages
and the app ending.
In more detail, we see this flake because:
- The integration telemetry is only sent when something is instrumented
(or subsequently errors)
- The delay in profiling introduced in #7287 causes a delay in sending
the calltarget definitions
- We will address that delay in a separate PR
- The telemetry thread runs in the background, and is already started
before we P/Invoke into the profiler
- The delay causes us to not instrument the HttpClient calls that the
background telemetry thread makes initially - if we skip the P/Invoke,
then they are instrumented at this point
- The app shuts down, which causes another telemetry flush
- At this point the `HttpClient` calls are instrumented, and the
instrumentation details are collected, but now we're shutting down, so
this data is never sent.
By forcing an instrumentation in the app, we bypass the race condition
entirely.
## Test coverage
Excluded the span from the tests so it's effectively the same. We don't
care about the contents of that span (or whether the request passes or
fails) - we just want to make sure we have instrumentation.
## Other details
0 commit comments