diff --git a/proto/telemetry.proto b/proto/telemetry.proto index 017a55d3ccfc0..2da24cc823085 100644 --- a/proto/telemetry.proto +++ b/proto/telemetry.proto @@ -3,18 +3,18 @@ syntax = "proto3"; package telemetry; enum MetaBackend { - MetaBackendUnspecified = 0; - MetaBackendMemory = 1; - MetaBackendEtcd = 2; - MetaBackendRdb = 3; + META_BACKEND_UNSPECIFIED = 0; + META_BACKEND_MEMORY = 1; + META_BACKEND_ETCD = 2; + META_BACKEND_RDB = 3; } enum TelemetryNodeType { - TelemetryNodeTypeUnspecified = 0; - TelemetryNodeTypeMeta = 1; - TelemetryNodeTypeCompute = 2; - TelemetryNodeTypeFrontend = 3; - TelemetryNodeTypeCompactor = 4; + TELEMETRY_NODE_TYPE_UNSPECIFIED = 0; + TELEMETRY_NODE_TYPE_META = 1; + TELEMETRY_NODE_TYPE_COMPUTE = 2; + TELEMETRY_NODE_TYPE_FRONTEND = 3; + TELEMETRY_NODE_TYPE_COMPACTOR = 4; } message SystemMemory { diff --git a/src/common/src/telemetry/mod.rs b/src/common/src/telemetry/mod.rs index dfb4ce385f9a8..382e50d8eb927 100644 --- a/src/common/src/telemetry/mod.rs +++ b/src/common/src/telemetry/mod.rs @@ -70,15 +70,15 @@ pub struct TelemetryReportBase { pub node_type: TelemetryNodeType, } -impl Into for TelemetryReportBase { - fn into(self) -> PbTelemetryReportBase { +impl From for PbTelemetryReportBase { + fn from(val: TelemetryReportBase) -> Self { PbTelemetryReportBase { - tracking_id: self.tracking_id, - session_id: self.session_id, - system_data: Some(self.system_data.into()), - up_time: self.up_time, - report_time: self.time_stamp, - node_type: from_telemetry_node_type(self.node_type) as i32, + tracking_id: val.tracking_id, + session_id: val.session_id, + system_data: Some(val.system_data.into()), + up_time: val.up_time, + report_time: val.time_stamp, + node_type: from_telemetry_node_type(val.node_type) as i32, } } } @@ -182,9 +182,9 @@ fn from_telemetry_node_type(t: TelemetryNodeType) -> PbTelemetryNodeType { } } -impl Into for TelemetryNodeType { - fn into(self) -> PbTelemetryNodeType { - match self { +impl From for PbTelemetryNodeType { + fn from(val: TelemetryNodeType) -> Self { + match val { TelemetryNodeType::Meta => PbTelemetryNodeType::Meta, TelemetryNodeType::Compute => PbTelemetryNodeType::Compute, TelemetryNodeType::Frontend => PbTelemetryNodeType::Frontend, @@ -193,39 +193,39 @@ impl Into for TelemetryNodeType { } } -impl Into for Cpu { - fn into(self) -> PbSystemCpu { +impl From for PbSystemCpu { + fn from(val: Cpu) -> Self { PbSystemCpu { - available: self.available, + available: val.available, } } } -impl Into for Memory { - fn into(self) -> PbSystemMemory { +impl From for PbSystemMemory { + fn from(val: Memory) -> Self { PbSystemMemory { - used: self.used as u64, - total: self.total as u64, + used: val.used as u64, + total: val.total as u64, } } } -impl Into for Os { - fn into(self) -> PbSystemOs { +impl From for PbSystemOs { + fn from(val: Os) -> Self { PbSystemOs { - name: self.name, - kernel_version: self.kernel_version, - version: self.version, + name: val.name, + kernel_version: val.kernel_version, + version: val.version, } } } -impl Into for SystemData { - fn into(self) -> PbSystemData { +impl From for PbSystemData { + fn from(val: SystemData) -> Self { PbSystemData { - memory: Some(self.memory.into()), - os: Some(self.os.into()), - cpu: Some(self.cpu.into()), + memory: Some(val.memory.into()), + os: Some(val.os.into()), + cpu: Some(val.cpu.into()), } } }