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

Sentry sdk sending noisy logs #2982

Open
udk2195 opened this issue Apr 16, 2024 · 6 comments
Open

Sentry sdk sending noisy logs #2982

udk2195 opened this issue Apr 16, 2024 · 6 comments
Labels
Type: Bug Something isn't working

Comments

@udk2195
Copy link

udk2195 commented Apr 16, 2024

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.14.0

Steps to Reproduce

i am using splunk as my logging platform and sentry as our error reporting platform

while instantiation sentry-sdk emits a lot of noisy logs such as:-
File "/opt/service/.local/lib/python3.9/site-packages/sentry_sdk/integrations/logging.py", line 96, in sentry_patched_callhandlers

File "/opt/service/.local/lib/python3.9/site-packages/sentry_sdk/integrations/starlette.py", line 125, in _sentry_send

i want to disable sentry to send such logs, how can i disable it ?

Below are the things i have tried and failed with:-

  1. tried setting default_integrations=False
  2. used ignore_logger as mentioned in sentry documentation

Expected Result

there shouldnt be any non informatory sentry logs present

Actual Result

current logs being emitted:-

File "/opt/service/.local/lib/python3.9/site-packages/sentry_sdk/integrations/logging.py", line 96, in sentry_patched_callhandlers

File "/opt/service/.local/lib/python3.9/site-packages/sentry_sdk/integrations/starlette.py", line 125, in _sentry_send

@sentrivana
Copy link
Contributor

Hey @udk2195! 👋🏻 Thanks for writing in.

That looks like error logs, you shouldn't see any of those if the SDK is working ok, so it's likely the SDK is experiencing some issues which need fixing.

Can you please:

  • provide the whole stacktrace from the log output if available so that we can see what exception is thrown and from where
  • tell us more about your setup (what kind of app this is, your pip freeze would also be helpful)
  • ideally provide example code that triggers the logs

When do the logs appear? On every request? Only specific requests? Or is there a different trigger entirely?

@udk2195
Copy link
Author

udk2195 commented Apr 16, 2024

Screenshot 2024-04-16 at 1 40 23 PM - screenshot of the kind of logs i'm getting @sentrivana

this is how i'm initializing sentry

if config.micros_env != "local":
    sentry_sdk.init(
        dsn="https://8c16bb57851f56bcecd452b50cd1b8b5@o55978.ingest.sentry.io/4506850927837184",

        # Set traces_sample_rate to 1.0 to capture 100%
        # of transactions for performance monitoring.
        # We recommend adjusting this value in production.
        traces_sample_rate=1.0,
        environment=config.micros_env
    )

this is how my requirements.txt look like

fastapi==0.109.1
uvicorn[standard]==0.22.0
gunicorn==20.1.0
pydantic==1.10.13
colorlog==6.7.0
datadog==0.44.0
python-json-logger>=2.0.1
boto3>=1.14.12
aioresponses==0.7.6
orjson==3.9.*
starlette==0.35.0
pympler==1.0.1
scikit-learn==1.0.2
tensorflow>=2.13.*
tensorflow_hub==0.13.0
optimum[onnxruntime]==1.17.1
onnx==1.15.0
onnxruntime==1.17.1
numpy==1.23
sentence-transformers==2.4.0
sentry-sdk==1.14.0
torch==2.0.*
Werkzeug==3.0.1

@udk2195
Copy link
Author

udk2195 commented Apr 16, 2024

@sentrivana i also tried fixing it by upgrading to the latest sentry version 1.45.0 - still the issue persists

@sentrivana
Copy link
Contributor

Thanks @udk2195 -- that was my next question, whether upgrading solves the issue.

I don't have much to go by unless we can either get the full stack trace or there's a way for me to reproduce this. All I can tell from the two log lines you're getting is that there's an exception passing through either the logging integration or the Starlette/FastAPI integration (or both). It could also be an exception in your app and you're seeing some part of the stacktrace that includes SDK code.

Is there any way you can get the full stack trace rather than the truncated one? Are you seeing any errors in Sentry? When do you see these logs being emitted (on startup / while the app is running/etc.)?

@udk2195
Copy link
Author

udk2195 commented Apr 16, 2024

@sentrivana unfortunately, that's all the information i see on splunk - i dont have any other stack trace to share with you - is it possible to completely disable logs being emitted from sentry sdk but at the same time we do report errors to sentry server ?

@sentrivana
Copy link
Contributor

Gotcha @udk2195, the problem is though that if you're seeing those logs, chances are things are not working as expected so there might be a blind spot in what gets reported by Sentry. The best course of action would be to fix the underlying issue. The error causing this might already be in your Sentry -- anything there that looks like it could be related? It'd probably have more info attached to it that might help us get to the root of the issue.

If you really want to silence the logs altogether, there is probably no nice solution for this. It looks like regular stderr exception tracebacks, so you'd need to somehow tell Python to not log exceptions to stderr, or set sys.stderr to None, or something similar. But I don't know if there's a way to do that only for the SDK so that it doesn't affect the rest of your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants