@@ -18,8 +18,8 @@ pub struct Sample<T> {
1818
1919impl < T > Sample < T > {
2020 #[ must_use]
21- pub fn new ( value : T , update_at : DurationSinceUnixEpoch , label_set : LabelSet ) -> Self {
22- let data = Measurement { value, update_at } ;
21+ pub fn new ( value : T , recorded_at : DurationSinceUnixEpoch , label_set : LabelSet ) -> Self {
22+ let data = Measurement { value, recorded_at } ;
2323
2424 Self {
2525 measurement : data,
@@ -38,8 +38,8 @@ impl<T> Sample<T> {
3838 }
3939
4040 #[ must_use]
41- pub fn update_at ( & self ) -> DurationSinceUnixEpoch {
42- self . measurement . update_at
41+ pub fn recorded_at ( & self ) -> DurationSinceUnixEpoch {
42+ self . measurement . recorded_at
4343 }
4444
4545 #[ must_use]
@@ -73,13 +73,13 @@ pub struct Measurement<T> {
7373
7474 /// The time when the sample was last updated.
7575 #[ serde( serialize_with = "serialize_duration" , deserialize_with = "deserialize_duration" ) ]
76- update_at : DurationSinceUnixEpoch ,
76+ recorded_at : DurationSinceUnixEpoch ,
7777}
7878
7979impl < T > Measurement < T > {
8080 #[ must_use]
81- pub fn new ( value : T , update_at : DurationSinceUnixEpoch ) -> Self {
82- Self { value, update_at }
81+ pub fn new ( value : T , recorded_at : DurationSinceUnixEpoch ) -> Self {
82+ Self { value, recorded_at }
8383 }
8484
8585 #[ must_use]
@@ -88,12 +88,12 @@ impl<T> Measurement<T> {
8888 }
8989
9090 #[ must_use]
91- pub fn update_at ( & self ) -> DurationSinceUnixEpoch {
92- self . update_at
91+ pub fn recorded_at ( & self ) -> DurationSinceUnixEpoch {
92+ self . recorded_at
9393 }
9494
95- fn set_update_at ( & mut self , time : DurationSinceUnixEpoch ) {
96- self . update_at = time;
95+ fn set_recorded_at ( & mut self , time : DurationSinceUnixEpoch ) {
96+ self . recorded_at = time;
9797 }
9898}
9999
@@ -112,18 +112,18 @@ impl<T: PrometheusSerializable> PrometheusSerializable for Measurement<T> {
112112impl Measurement < Counter > {
113113 pub fn increment ( & mut self , time : DurationSinceUnixEpoch ) {
114114 self . value . increment ( 1 ) ;
115- self . set_update_at ( time) ;
115+ self . set_recorded_at ( time) ;
116116 }
117117}
118118
119119impl Measurement < Gauge > {
120120 pub fn set ( & mut self , value : f64 , time : DurationSinceUnixEpoch ) {
121121 self . value . set ( value) ;
122- self . set_update_at ( time) ;
122+ self . set_recorded_at ( time) ;
123123 }
124124}
125125
126- /// Serializes the `update_at ` field as a string in ISO 8601 format (RFC 3339).
126+ /// Serializes the `recorded_at ` field as a string in ISO 8601 format (RFC 3339).
127127///
128128/// # Errors
129129///
@@ -189,7 +189,7 @@ mod tests {
189189 LabelSet :: from ( vec ! [ ( "test" , "label" ) ] ) ,
190190 ) ;
191191
192- assert_eq ! ( sample. update_at ( ) , updated_at_time( ) ) ;
192+ assert_eq ! ( sample. recorded_at ( ) , updated_at_time( ) ) ;
193193 }
194194
195195 #[ test]
@@ -239,7 +239,7 @@ mod tests {
239239
240240 sample. increment ( time) ;
241241
242- assert_eq ! ( sample. update_at ( ) , time) ;
242+ assert_eq ! ( sample. recorded_at ( ) , time) ;
243243 }
244244
245245 #[ test]
@@ -289,7 +289,7 @@ mod tests {
289289
290290 sample. set ( 1.0 , time) ;
291291
292- assert_eq ! ( sample. update_at ( ) , time) ;
292+ assert_eq ! ( sample. recorded_at ( ) , time) ;
293293 }
294294
295295 #[ test]
@@ -321,7 +321,7 @@ mod tests {
321321 let deserialized: Sample < i32 > = serde_json:: from_str ( & json) . unwrap ( ) ;
322322
323323 assert_eq ! ( original. measurement. value, deserialized. measurement. value) ;
324- assert_eq ! ( original. measurement. update_at , deserialized. measurement. update_at ) ;
324+ assert_eq ! ( original. measurement. recorded_at , deserialized. measurement. recorded_at ) ;
325325 assert_eq ! ( original. label_set, deserialized. label_set) ;
326326 }
327327
@@ -338,7 +338,7 @@ mod tests {
338338 let expected_json = r#"
339339 {
340340 "value": 42,
341- "update_at ": "2025-04-02T00:00:00.000000100+00:00",
341+ "recorded_at ": "2025-04-02T00:00:00.000000100+00:00",
342342 "labels": [
343343 {
344344 "name": "label_name",
@@ -372,7 +372,7 @@ mod tests {
372372 r#"
373373 {
374374 "value": 42,
375- "update_at ": "1-1-2023T25:00:00Z",
375+ "recorded_at ": "1-1-2023T25:00:00Z",
376376 "labels": [
377377 {
378378 "name": "label_name",
0 commit comments