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

fix(sdk-metrics): collect metrics when periodic exporting metric reader flushes #3517

Merged
merged 5 commits into from
Jan 14, 2023

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Jan 3, 2023

Which problem is this PR solving?

Fixes #3278

Related spec issue: open-telemetry/opentelemetry-specification#2983

Short description of the changes

  • Collect immediately when the PeriodicExportingMetricReader flushes.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • PeriodicExportingMetricReader.forceFlush collects and exports metrics.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added

@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Merging #3517 (14fbc00) into main (49c75b8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3517   +/-   ##
=======================================
  Coverage   93.80%   93.80%           
=======================================
  Files         249      249           
  Lines        7637     7640    +3     
  Branches     1589     1589           
=======================================
+ Hits         7164     7167    +3     
  Misses        473      473           
Impacted Files Coverage Δ
...etrics/src/export/PeriodicExportingMetricReader.ts 98.00% <100.00%> (+0.12%) ⬆️

@legendecas legendecas marked this pull request as ready for review January 3, 2023 08:00
@legendecas legendecas requested a review from a team January 3, 2023 08:00
@legendecas legendecas added the sdk:metrics Issues and PRs related to the Metrics SDK label Jan 3, 2023
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for adding this. 🙂
I remember we agreed to remove it from the original PR about a year ago as it was not part of the spec, glad to see that it's back. 🙂

@aabmass
Copy link
Member

aabmass commented Jan 8, 2023

Does this also cause metrics to be collected on shutdown?

@legendecas
Copy link
Member Author

@aabmass No. This PR addresses the change in open-telemetry/opentelemetry-specification#3084.

To include effects of force flush in sdk shutdown, I've submitted open-telemetry/opentelemetry-specification#3085 and I can submit another PR to update it in JS SDK.

@aabmass
Copy link
Member

aabmass commented Jan 9, 2023

Sounds good to me, thanks for following up!

@legendecas legendecas merged commit c87a304 into open-telemetry:main Jan 14, 2023
@legendecas legendecas deleted the metrics/flush branch January 14, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk:metrics Issues and PRs related to the Metrics SDK
Projects
None yet
5 participants