Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix error in latency query
The numerator needs to use the count metric instead of the bucket one,
as the bucket without label will count a datapoint multiple times.
  • Loading branch information
Gerry Agbobada committed Mar 27, 2023
commit b425e144497055ffd115115521c6bbb26c0513b8
6 changes: 3 additions & 3 deletions autometrics-cli/src/sloth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ slos:
}

fn generate_success_rate_slo(objective_percentile: &str) -> String {
let objective_percentile_no_decimal = objective_percentile.replace(".", "_");
let objective_percentile_no_decimal = objective_percentile.replace('.', "_");

format!(" - name: success-rate-{objective_percentile_no_decimal}
objective: {objective_percentile}
Expand All @@ -72,15 +72,15 @@ fn generate_success_rate_slo(objective_percentile: &str) -> String {
}

fn generate_latency_slo(objective_percentile: &str) -> String {
let objective_percentile_no_decimal = objective_percentile.replace(".", "_");
let objective_percentile_no_decimal = objective_percentile.replace('.', "_");

format!(" - name: latency-{objective_percentile_no_decimal}
objective: {objective_percentile}
description: Common SLO based on function latency
sli:
events:
error_query: >
sum by (objective_name, objective_percentile) (rate(function_calls_duration_bucket{{objective_percentile=\"{objective_percentile}\"}}[{{{{.window}}}}]))
sum by (objective_name, objective_percentile) (rate(function_calls_duration_count{{objective_percentile=\"{objective_percentile}\"}}[{{{{.window}}}}]))
-
(sum by (objective_name, objective_percentile) (
label_join(rate(function_calls_duration_bucket{{objective_percentile=\"{objective_percentile}\"}}[{{{{.window}}}}]), \"autometrics_check_label_equality\", \"\", \"objective_latency_threshold\")
Expand Down
Loading