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

Remove meters from storage list when removed and handle NoRecordedValue flag when removing meters #5997

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

stonkie
Copy link

@stonkie stonkie commented Nov 22, 2024

Fixes #5950
Design discussion issue #

Changes

This allows clean Dispose of Meter objects which will send NoRecordedValue data points to close the series (e.g. send a staleness marker to prometheus). It also fixes the internal storage leak which would prevent frequent rotation of the metrics.

NOTE : A significant refactoring of the protobuf serialization merged right after I created this PR, so I had to redo a significant part of the change on Dec 4th.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Copy link

linux-foundation-easycla bot commented Nov 22, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package pkg:OpenTelemetry.Extensions.Hosting Issues related to OpenTelemetry.Extensions.Hosting NuGet package labels Nov 22, 2024
@Kielek
Copy link
Contributor

Kielek commented Nov 22, 2024

Hi @stonkie, thanks for the contribution.
Signing EasyCLA is hard requirement before we can accept contribution.

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 37.50000% with 30 lines in your changes missing coverage. Please review.

Project coverage is 83.95%. Comparing base (e3665c9) to head (c9d5475).

Files with missing lines Patch % Lines
...tryProtocol/Implementation/MetricItemExtensions.cs 16.66% 30 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5997      +/-   ##
==========================================
- Coverage   84.14%   83.95%   -0.20%     
==========================================
  Files         275      275              
  Lines       12560    12603      +43     
==========================================
+ Hits        10569    10581      +12     
- Misses       1991     2022      +31     
Flag Coverage Δ
unittests-Project-Experimental 83.82% <37.50%> (-0.28%) ⬇️
unittests-Project-Stable 83.94% <37.50%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/OpenTelemetry/Metrics/Metric.cs 97.26% <100.00%> (+0.01%) ⬆️
...rc/OpenTelemetry/Metrics/Reader/MetricReaderExt.cs 92.24% <100.00%> (+0.42%) ⬆️
...tryProtocol/Implementation/MetricItemExtensions.cs 82.66% <16.66%> (-11.21%) ⬇️

... and 4 files with indirect coverage changes

---- 🚨 Try these New Features:

@stonkie
Copy link
Author

stonkie commented Nov 22, 2024

@Kielek : I'm going through the motions to get this done at my company and there are more hoops than I expected. EasyCLA will probably wait until Monday.

@stonkie
Copy link
Author

stonkie commented Nov 26, 2024

Discussions during SIG meeting led to asking to feature flag the NoRecordedValue DataPoint to avoid changing working behavior. I'll add that and adjust the tests asap.

@stonkie stonkie marked this pull request as ready for review November 29, 2024 18:59
@stonkie stonkie requested a review from a team as a code owner November 29, 2024 18:59
@stonkie
Copy link
Author

stonkie commented Nov 29, 2024

I'm not exactly sure how to format the changelog entry. Should I create an entry without version number or release date?

@Kielek
Copy link
Contributor

Kielek commented Nov 29, 2024

I'm not exactly sure how to format the changelog entry. Should I create an entry without version number or release date?

Please put it under unreleased section.

## Unreleased

* Your description goes here.
  And here if it is long enough.
  ([#5997](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5997))

```

@stonkie
Copy link
Author

stonkie commented Nov 29, 2024

@Kielek Thanks, it's done.

@stonkie stonkie changed the title WIP - Remove meters from storage list when removed and handle NoRecordedValue flag when removing meters Remove meters from storage list when removed and handle NoRecordedValue flag when removing meters Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry.Extensions.Hosting Issues related to OpenTelemetry.Extensions.Hosting NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] Add option to remove metric series that are no longer present in observable measurements
3 participants