Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions backend/graph-proxy/src/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ pub async fn graphql_handler(
} else {
"error"
};
if status == "error" {
state
.metrics_state
.total_errors
.add(1, &[KeyValue::new("status", "error")]);
};
state.metrics_state.request_duration_ms.record(
elapsed_ms,
&[
Expand Down
8 changes: 8 additions & 0 deletions backend/graph-proxy/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub struct Metrics {
pub total_requests: Counter<u64>,
/// Request duration in miliseconds on every request
pub request_duration_ms: Histogram<f64>,
/// Total errors on querys and mutations
pub total_errors: Counter<u64>,
}

impl Metrics {
Expand All @@ -31,9 +33,15 @@ impl Metrics {
.with_unit("ms")
.build();

let total_errors = meter
.u64_counter("graph_proxy_total_errors")
.with_description("The total errors on all querys and mutations.")
.build();

Metrics {
total_requests,
request_duration_ms,
total_errors,
}
}
}