Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report exceptions from logger.exception() #134

Open
unflxw opened this issue Sep 12, 2023 · 1 comment
Open

Report exceptions from logger.exception() #134

unflxw opened this issue Sep 12, 2023 · 1 comment

Comments

@unflxw
Copy link
Contributor

unflxw commented Sep 12, 2023

Investigate whether we should and can do this.

Python logger context

Python's built-in logging package allows for log messages to include exception information.

If the logging method is called from an exception handler (an except block) with the exc_info=True parameter, then it will report information about the currently handled exception. (A specific exception instance can also be passed as the value for exc_info)

There is also a logger.exception() method, which already sets exc_info=True, and which is meant to be used from within exception handlers.

Possible implementations

We could implement a logging handler which, if an exception is present, reports it to AppSignal (doing the equivalent of send_error() for it)

Would this be useful? Perhaps this would also report exceptions that are not relevant to the user. Users might prefer to have finer control over it by calling appsignal.send_error() manually.

We could patch the logging module (OpenTelemetry contrib does it, to implement some other functionality) to add this to all loggers, or we could provide a handler that allows users to add it to their logger.

@unflxw unflxw self-assigned this Sep 12, 2023
@tombruijn
Copy link
Member

Related issue: appsignal/appsignal-ruby#1095
We discussed this in connection to that releated issue. If we implement this on our existing data model we would only report the error as a log message and not as a error for our error reporting feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants