-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: clean up eventd and service check types
- Loading branch information
Showing
5 changed files
with
88 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,68 @@ | ||
//! Service Check type | ||
mod status; | ||
pub use self::status::*; | ||
//! Service checks. | ||
/// ServiceCheck | ||
// TODO: Switch usages of `String` to `MetaString` since we should generally be able to intern these strings as they | ||
// originate in in the DogStatsD codec, where interning is already taking place. | ||
|
||
/// Service status. | ||
#[derive(Clone, Copy, Debug)] | ||
pub enum CheckStatus { | ||
/// The service is operating normally. | ||
Ok, | ||
|
||
/// The service is in a warning state. | ||
Warn, | ||
|
||
/// The service is in a critical state. | ||
Critical, | ||
|
||
/// The service is in an unknown state. | ||
Unknown, | ||
} | ||
|
||
/// A service check. | ||
/// | ||
/// Service checks represent the status of a service at a particular point in time. Checks are simplistic, with a basic | ||
/// message, status enum (OK vs warning vs critical, etc), timestamp, and tags. | ||
#[derive(Clone, Debug)] | ||
pub struct ServiceCheck { | ||
name: String, | ||
status: ServiceCheckStatus, | ||
status: CheckStatus, | ||
timestamp: u64, | ||
host: String, | ||
message: String, | ||
tags: Vec<String>, | ||
} | ||
|
||
impl ServiceCheck { | ||
/// Gets a reference to the service check name | ||
pub fn name(&self) -> &String { | ||
/// Gets the name of the check. | ||
pub fn name(&self) -> &str { | ||
&self.name | ||
} | ||
|
||
/// Gets a reference to the status | ||
pub fn status(&self) -> &ServiceCheckStatus { | ||
&self.status | ||
/// Gets the status of the check. | ||
pub fn status(&self) -> CheckStatus { | ||
self.status | ||
} | ||
|
||
/// Gets a reference to the timestamp | ||
/// Gets the timestamp of the check. | ||
/// | ||
/// This is a Unix timestamp, or the number of seconds since the Unix epoch. | ||
pub fn timestamp(&self) -> u64 { | ||
self.timestamp | ||
} | ||
|
||
/// Gets a reference to the host name | ||
pub fn host(&self) -> &String { | ||
/// Gets the host where the check originated from. | ||
pub fn host(&self) -> &str { | ||
&self.host | ||
} | ||
|
||
/// Gets a reference to the message | ||
pub fn message(&self) -> &String { | ||
/// Gets the message associated with the check. | ||
pub fn message(&self) -> &str { | ||
&self.message | ||
} | ||
|
||
/// Gets a reference to the tags | ||
pub fn tags(&self) -> &Vec<String> { | ||
/// Gets the tags associated with the check. | ||
pub fn tags(&self) -> &[String] { | ||
&self.tags | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.