metrics_generic/
periodic_logger.rs

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
5use std::result::Result;
6use std::time::Duration;
7
8use 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.
13pub struct PeriodicLogger;
14
15impl PeriodicLogger {
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.
22    pub fn log(&self, _value: i64) {}
23}