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

Sepatate Aggregate measure and collect functions #2492

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

fraillt
Copy link
Contributor

@fraillt fraillt commented Jan 1, 2025

Changes

Minor improvements in how aggregate functions for measure and collect is created.

  • Makes it more convenient to create aggregate functions
-    pub(crate) fn last_value(&self) -> (impl Measure<T>, impl ComputeAggregation) {
-        let lv = Arc::new(LastValue::new(self.temporality, self.filter.clone()));
-        (lv.clone(), lv)
+    pub(crate) fn last_value(&self) -> AggregateFns<T> {
+        LastValue::new(self.temporality, self.filter.clone()).into()

This will be important for #2328, when we'll want to construct separate instances for different temporality

  • Now there's only single Arc instance for measure and collect. Previously there was helper function that wrapped single Arc into another Arc for measure, and into Box for collect.
-    fn box_val<T>(
-        (m, ca): (impl internal::Measure<T>, impl internal::ComputeAggregation),
-    ) -> (
-        Arc<dyn internal::Measure<T>>,
-        Box<dyn internal::ComputeAggregation>,
-    ) {
-        (Arc::new(m), Box::new(ca))
-    }
-

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@fraillt fraillt requested a review from a team as a code owner January 1, 2025 21:45
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 96.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 77.9%. Comparing base (42b4f2f) to head (4813ad3).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-sdk/src/metrics/pipeline.rs 78.5% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2492     +/-   ##
=======================================
- Coverage   77.9%   77.9%   -0.1%     
=======================================
  Files        123     123             
  Lines      22925   22888     -37     
=======================================
- Hits       17870   17839     -31     
+ Misses      5055    5049      -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@utpilla utpilla left a comment

Choose a reason for hiding this comment

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

This is a good simplification.

@utpilla utpilla merged commit 82ed8e0 into open-telemetry:main Jan 5, 2025
21 checks passed
@fraillt fraillt deleted the aggregate-fns branch January 6, 2025 18:06
adriangb pushed a commit to adriangb/opentelemetry-rust that referenced this pull request Feb 4, 2025
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.

2 participants