Closed brettimus closed 1 year ago
If an error response from an HTTP handler is, e.g., a 400, we might not want to count that as an "error" in our metrics.
We should support an additional param to the decorator that accepts a predicate function that returns true if an error result should be an error.
true
error
Example
def treat_401_as_ok(exception: Exception): if exception instanceof(HTTPError): return exception.response.status_code != 401 @autometrics(error_handler=treat_401_as_ok) def my_tracked_function(): ...
Rust: https://github.com/autometrics-dev/autometrics-rs/pull/61
If an error response from an HTTP handler is, e.g., a 400, we might not want to count that as an "error" in our metrics.
We should support an additional param to the decorator that accepts a predicate function that returns
true
if an error result should be anerror
.Example
Rust: https://github.com/autometrics-dev/autometrics-rs/pull/61