Skip to content

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

Merged
cijothomas merged 4 commits into
open-telemetry:mainfrom
reyang:reyang/fix-timeout
Sep 20, 2021
Merged

Update ForceFlush behavior to meet with the latest spec requirements#2388
cijothomas merged 4 commits into
open-telemetry:mainfrom
reyang:reyang/fix-timeout

Conversation

@reyang

@reyang reyang commented Sep 20, 2021

Copy link
Copy Markdown
Member

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
if (timeoutMilliseconds == Timeout.Infinite)
{
_ = cur.Value.ForceFlush(Timeout.Infinite);
result = cur.Value.ForceFlush(Timeout.Infinite) && result;

Copy link
Copy Markdown
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
Copy Markdown
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).

Comment thread src/OpenTelemetry/Metrics/MeterProviderExtensions.cs Outdated

@CodeBlanch CodeBlanch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Sep 20, 2021

Copy link
Copy Markdown

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