Skip to content

Commit

Permalink
Fix silly metrics cardinality and release 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Jul 2, 2024
1 parent 11378d2 commit 1a7964d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "restate-operator"
version = "1.0.0"
version = "1.0.1"
authors = ["restate.dev"]
edition = "2021"
rust-version = "1.75"
Expand Down
2 changes: 1 addition & 1 deletion charts/restate-operator-helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: restate-operator-helm
description: An operator for Restate clusters
type: application
version: "1.0.0"
version: "1.0.1"
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ pub enum Error {
pub type Result<T, E = Error> = std::result::Result<T, E>;

impl Error {
pub fn metric_label(&self) -> String {
format!("{self:?}").to_lowercase()
pub fn metric_label(&self) -> &'static str {
match self {
Error::SerializationError(_) => "SerializationError",
Error::KubeError(_) => "KubeError",
Error::FinalizerError(_) => "FinalizerError",
Error::NameConflict => "NameConflict",
Error::NotReady { .. } => "NotReady",
Error::InvalidSigningKeyError(_) => "InvalidSigningKeyError",
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Metrics {

pub fn reconcile_failure(&self, rc: &RestateCluster, e: &Error) {
self.failures
.with_label_values(&[rc.name_any().as_ref(), e.metric_label().as_ref()])
.with_label_values(&[rc.name_any().as_ref(), e.metric_label()])
.inc()
}

Expand Down

0 comments on commit 1a7964d

Please sign in to comment.