Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EventCounters] SpinWait for tests #862

Merged
merged 8 commits into from
Jan 30, 2023
Merged

[EventCounters] SpinWait for tests #862

merged 8 commits into from
Jan 30, 2023

Conversation

mic-max
Copy link
Contributor

@mic-max mic-max commented Dec 30, 2022

Fixes #763 and #910

Changes

Use SpinWait instead of Task.Delay for a metric item to be exported.
The key was to spin until the metric item with the expected name was in the collection since the collection is being populated by all other instruments so simply checking for a count being greater than 1 would not work. Especially in the Theory test case.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2023

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 7, 2023
@utpilla utpilla added the comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters label Jan 11, 2023
@github-actions github-actions bot removed the Stale label Jan 12, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 19, 2023
@github-actions github-actions bot removed the Stale label Jan 25, 2023
@mic-max mic-max marked this pull request as ready for review January 26, 2023 21:46
@mic-max mic-max requested a review from a team January 26, 2023 21:46
@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Merging #862 (fca85c7) into main (8047023) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #862      +/-   ##
==========================================
+ Coverage   68.33%   68.38%   +0.04%     
==========================================
  Files         183      183              
  Lines        7024     7025       +1     
==========================================
+ Hits         4800     4804       +4     
+ Misses       2224     2221       -3     
Impacted Files Coverage Δ
...rumentation.Wcf/TracerProviderBuilderExtensions.cs 87.50% <100.00%> (+1.78%) ⬆️
...trumentation.EventCounters/EventCountersMetrics.cs 79.51% <0.00%> (+3.61%) ⬆️

@@ -64,11 +45,9 @@ public void EventCounter()

// Act
counter.WriteMetric(1997.0202);
Task.Delay(Delay).Wait();
meterProvider.ForceFlush();
var metric = AwaitExport(meterProvider, metricItems, expectedInstrumentName: "ec.a.c");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why no flush first before await?

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving to make progress. some follow ups expected to fully stabilize this.
Thanks for the efforts so far!

@cijothomas cijothomas merged commit 5c836ae into open-telemetry:main Jan 30, 2023
@mic-max mic-max deleted the ec-enable-tests branch January 30, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky Test EventCountersMetricsTests.IncrementingEventCounter
6 participants