Skip to content

Ability to define 'ok' versus 'error' results #45

@brettimus

Description

@brettimus

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions