1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use std::result::Result;
use std::time::Duration;

use metrics_events::MetricEventType;

/// A logging struct meant for use in tracking and periodically
/// logging a single metric. The metric is aggregated over the
/// designated time period. Intended for use with high-frequency metrics.
pub struct PeriodicLogger;

impl PeriodicLogger {
    pub fn new(_event: MetricEventType, _period: Duration) -> Result<PeriodicLogger, String> {
        Ok(PeriodicLogger)
    }

    /// Indicate the event has occurred with the given
    /// value to be aggregated over the given time period.
    pub fn log(&self, _value: i64) {}
}