thin-edge.io
thin-edge.io copied to clipboard
Refactor tedge_api::health module
Is your feature improvement request related to a problem? Please describe.
The tedge_api::health module must be refactored for better parsing of health status
.
And the same HealthStatus
struct can be used across all the consumers to be in sync.
Describe the solution you'd like
Create the HealthStatus struct into the tedge_api::health module as follows:
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct HealthStatus {
status: String,
pid: u32,
#[serde(with = "time::serde::rfc3339")]
pub time: OffsetDateTime,
}
with on-the-fly transformation of the time field.
Then this same struct can be consistently used across all the consumer crates like converter, watchdog etc.
Make health_status_up_message() API accept an additional Option<OffsetDateTime> parameter so that the timestamp can be controlled from outside(mainly from tests).
Describe alternatives you've considered
Additional context