xref: /aosp_15_r20/external/crosvm/vendor/generic/metrics/src/client.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
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 base::RawDescriptor;
6 use base::SendTube;
7 use metrics_events::MetricEventType;
8 use metrics_events::RecordDetails;
9 
10 use crate::MetricsClientDestructor;
11 
12 /// This interface exists to be used and re-implemented by downstream forks. Updates shouldn't be
13 /// done without ensuring they won't cause breakages in dependent codebases.
initialize(_: SendTube)14 pub fn initialize(_: SendTube) {}
15 #[cfg(test)]
force_initialize(_: SendTube)16 pub fn force_initialize(_: SendTube) {}
17 
push_descriptors(_: &mut Vec<RawDescriptor>)18 pub fn push_descriptors(_: &mut Vec<RawDescriptor>) {}
19 
get_destructor() -> MetricsClientDestructor20 pub fn get_destructor() -> MetricsClientDestructor {
21     MetricsClientDestructor::new(|| {})
22 }
is_initialized() -> bool23 pub fn is_initialized() -> bool {
24     false
25 }
set_auth_token(_: &str)26 pub fn set_auth_token(_: &str) {}
set_graphics_api(_: &str)27 pub fn set_graphics_api(_: &str) {}
set_package_name(_: &str)28 pub fn set_package_name(_: &str) {}
merge_session_invariants(_: &[u8])29 pub fn merge_session_invariants(_: &[u8]) {}
30 
31 /// Logs a counter with the given descriptor as aux. data. A descriptor is
32 /// generally an enum value or error code.
log_descriptor(_event_type: MetricEventType, _descriptor: i64)33 pub fn log_descriptor(_event_type: MetricEventType, _descriptor: i64) {}
34 
35 /// Logs a counter with no aux. data.
log_event(_event_type: MetricEventType)36 pub fn log_event(_event_type: MetricEventType) {}
37 
38 /// Logs a real valued metric (e.g. a data transfer rate, a latency value, etc)
39 /// with the supplied value.
log_metric(_event_type: MetricEventType, _value: i64)40 pub fn log_metric(_event_type: MetricEventType, _value: i64) {}
41 
42 /// Logs a histogram metric with the supplied value. Note: step is a value to
43 /// be added to the distribution.
log_histogram_metric(_event_type: MetricEventType, _step: i64)44 pub fn log_histogram_metric(_event_type: MetricEventType, _step: i64) {}
45 
46 /// Logs a high frequency counter with the supplied aux. data and value.
log_high_frequency_descriptor_event(_: MetricEventType, _descriptor: i64, _step: i64)47 pub fn log_high_frequency_descriptor_event(_: MetricEventType, _descriptor: i64, _step: i64) {}
48 
49 /// Logs a counter with additional data.
log_event_with_details(_event_type: MetricEventType, _details: &RecordDetails)50 pub fn log_event_with_details(_event_type: MetricEventType, _details: &RecordDetails) {}
51