@@ -33,6 +33,11 @@ pub(crate) const ROUTER_PARSE_ERRORS: &str = "ajj.router.parse_errors";
33
33
pub ( crate ) const ROUTER_PARSE_ERRORS_HELP : & str =
34
34
"Number of parse errors encountered by ajj router methods. This implies no response was sent." ;
35
35
36
+ /// Metric for counting method not found errors.
37
+ pub ( crate ) const ROUTER_METHOD_NOT_FOUND : & str = "ajj.router.method_not_found" ;
38
+ pub ( crate ) const ROUTER_METHOD_NOT_FOUND_HELP : & str =
39
+ "Number of times ajj router methods encountered a method not found error. This implies a response was sent." ;
40
+
36
41
static DESCRIBE : LazyLock < ( ) > = LazyLock :: new ( || {
37
42
metrics:: describe_counter!( ROUTER_CALLS , metrics:: Unit :: Count , ROUTER_CALLS_HELP ) ;
38
43
metrics:: describe_counter!( ROUTER_ERRORS , metrics:: Unit :: Count , ROUTER_ERRORS_HELP ) ;
@@ -56,6 +61,11 @@ static DESCRIBE: LazyLock<()> = LazyLock::new(|| {
56
61
metrics:: Unit :: Count ,
57
62
ROUTER_PARSE_ERRORS_HELP
58
63
) ;
64
+ metrics:: describe_counter!(
65
+ ROUTER_METHOD_NOT_FOUND ,
66
+ metrics:: Unit :: Count ,
67
+ ROUTER_METHOD_NOT_FOUND_HELP
68
+ ) ;
59
69
} ) ;
60
70
61
71
/// Get or register a counter for calls to a specific service and method.
@@ -168,3 +178,20 @@ pub(crate) fn record_parse_error(service_name: &'static str) {
168
178
let counter = parse_errors ( service_name) ;
169
179
counter. increment ( 1 ) ;
170
180
}
181
+
182
+ /// Get or register a counter for method not found errors.
183
+ pub ( crate ) fn method_not_found_errors ( service_name : & ' static str , method : & str ) -> Counter {
184
+ let _ = & DESCRIBE ;
185
+ metrics:: counter!( ROUTER_METHOD_NOT_FOUND , "service" => service_name. to_string( ) , "method" => method. to_string( ) )
186
+ }
187
+
188
+ /// Record a method not found error.
189
+ pub ( crate ) fn record_method_not_found (
190
+ response_sent : bool ,
191
+ service_name : & ' static str ,
192
+ method : & str ,
193
+ ) {
194
+ let counter = method_not_found_errors ( service_name, method) ;
195
+ counter. increment ( 1 ) ;
196
+ record_output ( response_sent, service_name, method) ;
197
+ }
0 commit comments