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

Update ForceFlush behavior to meet with the latest spec requirements #2388

Merged
merged 4 commits into from
Sep 20, 2021

Conversation

reyang
Copy link
Member

@reyang reyang commented Sep 20, 2021

Fixes #2386.
Related to #2385.

Changes

  • Updated the comments across the entire repo to clarify that timeout should be non-negative or Infinite (`-1).
  • Updated the CompositeProcessor.OnForceFlush logic to meet with the latest spec requirement (also aligns with metrics SDK spec).
  • Removed the unnecessary argument validation in On... callbacks (because they will not be called by end users).

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes

@reyang reyang requested a review from a team September 20, 2021 19:58
@reyang reyang requested a review from pellared September 20, 2021 20:04
var sw = Stopwatch.StartNew();

while (cur != null)
{
if (timeoutMilliseconds == Timeout.Infinite)
{
_ = cur.Value.ForceFlush(Timeout.Infinite);
result = cur.Value.ForceFlush(Timeout.Infinite) && result;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can use &= operator

Copy link
Member Author

Choose a reason for hiding this comment

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

I think no, &= has different semantic (short-circuit ForceFlush when result is true) than what we need (ForceFlush would always be called).

src/OpenTelemetry/Metrics/MeterProviderExtensions.cs Outdated Show resolved Hide resolved
Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #2388 (a5a19d7) into main (1d63b31) will increase coverage by 0.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2388      +/-   ##
==========================================
+ Coverage   79.91%   79.93%   +0.01%     
==========================================
  Files         231      231              
  Lines        7445     7440       -5     
==========================================
- Hits         5950     5947       -3     
+ Misses       1495     1493       -2     
Impacted Files Coverage Δ
src/OpenTelemetry/BaseExporter.cs 66.66% <0.00%> (ø)
src/OpenTelemetry/Metrics/CompositeMetricReader.cs 0.00% <ø> (ø)
...c/OpenTelemetry/Metrics/MeterProviderExtensions.cs 0.00% <0.00%> (ø)
src/OpenTelemetry/Metrics/MeterProviderSdk.cs 88.63% <ø> (ø)
src/OpenTelemetry/Metrics/MetricReader.cs 62.50% <0.00%> (ø)
src/OpenTelemetry/Trace/TracerProviderSdk.cs 95.47% <ø> (ø)
...rc/OpenTelemetry/Trace/TracerProviderExtensions.cs 32.25% <33.33%> (ø)
src/OpenTelemetry/BaseProcessor.cs 62.96% <50.00%> (ø)
src/OpenTelemetry/CompositeProcessor.cs 94.11% <100.00%> (+1.15%) ⬆️
...Zipkin/Implementation/ZipkinExporterEventSource.cs 63.63% <0.00%> (-9.10%) ⬇️
... and 2 more

@cijothomas cijothomas merged commit 47e1c5e into open-telemetry:main Sep 20, 2021
@reyang reyang deleted the reyang/fix-timeout branch September 20, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ForceFlush logic to meet with the latest spec requirement
5 participants