Restructure into workspace with dashboard and agent
This commit is contained in:
9
shared/Cargo.toml
Normal file
9
shared/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
19
shared/src/envelope.rs
Normal file
19
shared/src/envelope.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AgentType {
|
||||
Smart,
|
||||
Service,
|
||||
Backup,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct MetricsEnvelope {
|
||||
pub hostname: String,
|
||||
pub agent_type: AgentType,
|
||||
pub timestamp: u64,
|
||||
#[serde(default)]
|
||||
pub metrics: Value,
|
||||
}
|
||||
1
shared/src/lib.rs
Normal file
1
shared/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod envelope;
|
||||
Reference in New Issue
Block a user