Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tabVersion committed Feb 2, 2024
1 parent db43b0a commit a3e9cc2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions proto/telemetry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
56 changes: 28 additions & 28 deletions src/common/src/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ pub struct TelemetryReportBase {
pub node_type: TelemetryNodeType,
}

impl Into<PbTelemetryReportBase> for TelemetryReportBase {
fn into(self) -> PbTelemetryReportBase {
impl From<TelemetryReportBase> 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,
}
}
}
Expand Down Expand Up @@ -182,9 +182,9 @@ fn from_telemetry_node_type(t: TelemetryNodeType) -> PbTelemetryNodeType {
}
}

impl Into<PbTelemetryNodeType> for TelemetryNodeType {
fn into(self) -> PbTelemetryNodeType {
match self {
impl From<TelemetryNodeType> for PbTelemetryNodeType {
fn from(val: TelemetryNodeType) -> Self {
match val {
TelemetryNodeType::Meta => PbTelemetryNodeType::Meta,
TelemetryNodeType::Compute => PbTelemetryNodeType::Compute,
TelemetryNodeType::Frontend => PbTelemetryNodeType::Frontend,
Expand All @@ -193,39 +193,39 @@ impl Into<PbTelemetryNodeType> for TelemetryNodeType {
}
}

impl Into<PbSystemCpu> for Cpu {
fn into(self) -> PbSystemCpu {
impl From<Cpu> for PbSystemCpu {
fn from(val: Cpu) -> Self {
PbSystemCpu {
available: self.available,
available: val.available,
}
}
}

impl Into<PbSystemMemory> for Memory {
fn into(self) -> PbSystemMemory {
impl From<Memory> 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<PbSystemOs> for Os {
fn into(self) -> PbSystemOs {
impl From<Os> 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<PbSystemData> for SystemData {
fn into(self) -> PbSystemData {
impl From<SystemData> 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()),
}
}
}
Expand Down

0 comments on commit a3e9cc2

Please sign in to comment.