1 // Copyright 2022 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 use std::result::Result; 6 use std::time::Duration; 7 8 use metrics_events::MetricEventType; 9 10 /// A logging struct meant for use in tracking and periodically 11 /// logging a single metric. The metric is aggregated over the 12 /// designated time period. Intended for use with high-frequency metrics. 13 pub struct PeriodicLogger; 14 15 impl PeriodicLogger { new(_event: MetricEventType, _period: Duration) -> Result<PeriodicLogger, String>16 pub fn new(_event: MetricEventType, _period: Duration) -> Result<PeriodicLogger, String> { 17 Ok(PeriodicLogger) 18 } 19 20 /// Indicate the event has occurred with the given 21 /// value to be aggregated over the given time period. log(&self, _value: i64)22 pub fn log(&self, _value: i64) {} 23 } 24