Skip to content

Commit

Permalink
Fixing MetricEventSource tests (#55385)
Browse files Browse the repository at this point in the history
* Fixing MetricEventSource tests

I've seen two recent non-deterministic failures:
1. After starting the EventListener there is a delay of one collection
interval (previously 0.3 seconds) where we expect calls to counter.Add
and Histogram.Record() to update stats. On a fast machine this code
would run in under a millisecond but in some test runs it still wasn't
happening fast enough.
2. We were seeing error events from a previous test get observed in a
later test because session id was being ignored for error events.

Fixes:
1. Added an initial collection interval where no counter APIs will be
invoked and the test will delay up to 60 seconds waiting for this.
Hopefully this delay makes it more likely that the Add/Record APIs
are ready to execute promptly once the 2nd interval begins. I
also increased the intervals to 1 second. If that still isn't sufficient
we can either further increase the collection intervals or disable the
tests. I also moved these tests to outerloop because
they are slow and noisy on the console, but it may have a side
benefit lessening the impact if there are future timing related failures.
2. Tightened up the session id matching so only error events with
empty id or the expected id are allowed.
  • Loading branch information
noahfalk authored Jul 11, 2021
1 parent 8fdc829 commit 21c2516
Showing 1 changed file with 103 additions and 83 deletions.
Loading

0 comments on commit 21c2516

Please sign in to comment.