Skip to content

consider adding on_return and on_error transform functions to timer_decorator #120

@willkg

Description

@willkg

I often want to decorate functions with timer_decorator, but want to provide different tags depending on the returned result or error.

What if we added on_return and on_error transform functions with defaults:

def on_return(tags, value, ret):
    return tags, value, ret
def on_error(tags, value, exc):
    return tags, value, exc

These would get called here after the function has completed:

https://github.com/willkg/markus/blob/a3a5db6b9635fa04ceb66f4b2c11058b4e09ba17/src/markus/main.py#L515

Metadata

Metadata

Assignees

No one assigned

    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