Skip to content

Commit

Permalink
adjust label order
Browse files Browse the repository at this point in the history
  • Loading branch information
koushiro committed Aug 29, 2024
1 parent 89dc5b8 commit 7f58c8c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/src/layers/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ struct OperationLabels<'a> {
namespace: &'a str,
root: &'a str,
op: Operation,
error: Option<ErrorKind>,
path: &'a str,
error: Option<ErrorKind>,
}

impl<'a> OperationLabels<'a> {
Expand All @@ -310,14 +310,14 @@ impl<'a> OperationLabels<'a> {
observe::LABEL_OPERATION,
]);

if error {
names.push(observe::LABEL_ERROR);
}

if path_label_level > 0 {
names.push(observe::LABEL_PATH);
}

if error {
names.push(observe::LABEL_ERROR);
}

names
}

Expand All @@ -326,7 +326,7 @@ impl<'a> OperationLabels<'a> {
/// 1. `["scheme", "namespace", "root", "operation"]`
/// 2. `["scheme", "namespace", "root", "operation", "path"]`
/// 3. `["scheme", "namespace", "root", "operation", "error"]`
/// 4. `["scheme", "namespace", "root", "operation", "error", "path"]`
/// 4. `["scheme", "namespace", "root", "operation", "path", "error"]`
fn into_values(self, path_label_level: usize) -> Vec<&'a str> {
let mut labels = Vec::with_capacity(6);

Expand All @@ -337,14 +337,14 @@ impl<'a> OperationLabels<'a> {
self.op.into_static(),
]);

if let Some(error) = self.error {
labels.push(error.into_static());
}

if path_label_level > 0 {
labels.push(get_path_label(self.path, path_label_level));
}

if let Some(error) = self.error {
labels.push(error.into_static());
}

labels
}
}
Expand Down

0 comments on commit 7f58c8c

Please sign in to comment.