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
.
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: autometrics-dev/autometrics-rs#61