use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue};
#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelSet)]
pub struct Label {
name: String,
task: Task,
}
impl Label {
pub fn root() -> Self {
Self {
name: String::new(),
task: Task::Root,
}
}
pub fn future(name: String) -> Self {
Self {
name,
task: Task::Future,
}
}
pub fn blocking_shared(name: String) -> Self {
Self {
name,
task: Task::BlockingShared,
}
}
pub fn blocking_dedicated(name: String) -> Self {
Self {
name,
task: Task::BlockingDedicated,
}
}
pub fn name(&self) -> String {
self.name.clone()
}
}
#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelValue)]
pub enum Task {
Root,
Future,
BlockingShared,
BlockingDedicated,
}