elastic / elastic/apm-agent-python

Logging integration to capture all logged exceptions

Open
#1,040 5 comments 1 reaction 0 assignees View on GitHub
agent-python
Dominant language
Python
Stars
431
Forks
239
Avg merge
5d 10h
Merged PRs (30d)
7

Description

**Is your feature request related to a problem? Please describe.**
Instrumenting an existing application can be cumbersome: All places with exception handling need to be extend in order to also forward the errors to APM using `client.capture_exception()`. However, most of the time such code paths are already well covered with `logger.exception(...)` or similar.

**Describe the solution you'd like**
The APM library should offer an opt-in feature to automatically forward all logged exceptions to APM. This could be an automatic feature similar to how HTTP libraries get instrumented.

**Describe alternatives you've considered**
The APM `logging.LoggingHandler` class offers such functionality. However the capturing is hereby bound to a specific output format. It cannot easily be used together with `structlog`

This feature request is inspired by the integration offered by Sentry https://docs.sentry.io/platforms/python/guides/logging/.

**Additional context**
n/a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.