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 //! Structs used to transport log requests between client processes and the logging controller 6 7 use serde::Deserialize; 8 use serde::Serialize; 9 10 use crate::MetricEventType; 11 12 #[derive(Serialize, Deserialize, Debug)] 13 pub struct LogMetric { 14 pub event_code: MetricEventType, 15 pub value: i64, 16 } 17 18 #[derive(Serialize, Deserialize, Debug)] 19 pub struct LogDescriptor { 20 pub event_code: MetricEventType, 21 pub descriptor: i64, 22 } 23 24 #[derive(Serialize, Deserialize, Debug)] 25 pub struct LogHighFrequencyDescriptorMetric { 26 pub event_code: MetricEventType, 27 pub descriptor: i64, 28 pub step: i64, 29 } 30 31 #[derive(Serialize, Deserialize, Debug)] 32 pub struct EventWithSerializedDetails { 33 pub event_code: MetricEventType, 34 pub serialized_details: Box<[u8]>, 35 } 36 37 #[derive(Serialize, Deserialize, Debug)] 38 pub enum MetricsRequest { 39 LogDescriptor(LogDescriptor), 40 LogEvent(MetricEventType), 41 LogMetric(LogMetric), 42 LogHistogram(LogMetric), 43 SetAuthToken(String), 44 SetGraphicsApi(String), 45 SetPackageName(String), 46 MergeSessionInvariants(Vec<u8>), 47 LogHighFrequencyDescriptorMetric(LogHighFrequencyDescriptorMetric), 48 LogEventWithSerializedDetails(EventWithSerializedDetails), 49 } 50