File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,12 @@ pub async fn graphql_handler(
165165 } else {
166166 "error"
167167 } ;
168+ if status == "error" {
169+ state
170+ . metrics_state
171+ . total_errors
172+ . add ( 1 , & [ KeyValue :: new ( "status" , "error" ) ] ) ;
173+ } ;
168174 state. metrics_state . request_duration_ms . record (
169175 elapsed_ms,
170176 & [
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ pub struct Metrics {
1313 pub total_requests : Counter < u64 > ,
1414 /// Request duration in miliseconds on every request
1515 pub request_duration_ms : Histogram < f64 > ,
16+ /// Total errors on querys and mutations
17+ pub total_errors : Counter < u64 > ,
1618}
1719
1820impl Metrics {
@@ -31,9 +33,15 @@ impl Metrics {
3133 . with_unit ( "ms" )
3234 . build ( ) ;
3335
36+ let total_errors = meter
37+ . u64_counter ( "graph_proxy_total_errors" )
38+ . with_description ( "The total errors on all querys and mutations." )
39+ . build ( ) ;
40+
3441 Metrics {
3542 total_requests,
3643 request_duration_ms,
44+ total_errors,
3745 }
3846 }
3947}
You can’t perform that action at this time.
0 commit comments