@@ -156,7 +156,8 @@ where
156156 }
157157
158158 /// Iterate through all attribute sets and populate `DataPoints` in readonly mode.
159- /// This is used in Cumulative temporality mode, where [`ValueMap`] is not cleared.
159+ /// This is used for synchronous instruments (Counter, Histogram, etc.) in Cumulative temporality mode,
160+ /// where attribute sets persist across collection cycles and [`ValueMap`] is not cleared.
160161 pub ( crate ) fn collect_readonly < Res , MapFn > ( & self , dest : & mut Vec < Res > , mut map_fn : MapFn )
161162 where
162163 MapFn : FnMut ( Vec < KeyValue > , & A ) -> Res ,
@@ -179,7 +180,12 @@ where
179180 }
180181
181182 /// Iterate through all attribute sets, populate `DataPoints` and reset.
182- /// This is used in Delta temporality mode, where [`ValueMap`] is reset after collection.
183+ /// This is used for:
184+ /// - Synchronous instruments in Delta temporality mode
185+ /// - Asynchronous instruments (Observable) in both Delta and Cumulative temporality modes
186+ ///
187+ /// For asynchronous instruments, this removes stale attribute sets that were not observed
188+ /// in the current callback, ensuring only currently active attributes are reported.
183189 pub ( crate ) fn collect_and_reset < Res , MapFn > ( & self , dest : & mut Vec < Res > , mut map_fn : MapFn )
184190 where
185191 MapFn : FnMut ( Vec < KeyValue > , A ) -> Res ,
0 commit comments