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

[BUG]: (Eventually) handled exceptions get logged as an issue in APM Error Tracker #12343

Open
gsmethells opened this issue Feb 13, 2025 · 0 comments
Labels

Comments

@gsmethells
Copy link

gsmethells commented Feb 13, 2025

Tracer Version(s)

2.8.5

Python Version(s)

Python 3.11

Pip Version(s)

pip 25.0.1

Bug Report

Exceptions that our code does handle (eventually) in the caller of the method that is decorated with @tracer.wrap() are treated as errors by APM. This leads to excessive numbers of APM issue events logged by our monitors and showing up in Datadog APM error tracker. Instead, we desire only uncaught exceptions to be treated as APM errors.

For example, in our Flask web app this code can catch an AuthenticationRequiredError:

    try:
      process()

      httpCode = 200
    except BadRequestError:
      httpCode = 400
    except AuthenticationRequiredError:
      httpCode = 401
    except UnsupportedMediaType:
      httpCode = 415
    except Exception: # XXX: Return properly to the caller even under duress
      httpCode = 500

but where it is raised is logged as an error:

Image

In addition, for celery tasks that raise a retry, every such raise is treated as an error by @tracer.wrap()

Image

Reproduction Code

No response

Error Logs

No response

Libraries in Use

celery

Operating System

Rocky Linux latest

@gsmethells gsmethells added the bug label Feb 13, 2025
@gsmethells gsmethells changed the title [BUG]: Handled exceptions get logged as an issue in APM Error Tracker [BUG]: (Eventually) handled exceptions get logged as an issue in APM Error Tracker Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant