Skip to content

Add support for djongo #2438

Closed
Closed

Description

@InterstellarStella

Problem Statement

It looks like when we add Sentry to a Django application with MongoDB, Djongo seems to be monkeypatching the connection object that we rely on, causing the django integration to break. The error thrown is:

File "/Users/user/opt/anaconda3/envs/ZETA/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "/Users/user/opt/anaconda3/envs/ZETA/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/Users/user/opt/anaconda3/envs/ZETA/lib/python3.8/site-packages/sentry_sdk/integrations/django/__init__.py", line 615, in execute
_set_db_data(span, self)
File "/Users/user/opt/anaconda3/envs/ZETA/lib/python3.8/site-packages/sentry_sdk/integrations/django/__init__.py", line 657, in _set_db_data
cursor_or_db.connection.get_dsn_parameters()
File "/Users/user/opt/anaconda3/envs/ZETA/lib/python3.8/site-packages/pymongo/collection.py", line 3491, in __call__
raise TypeError("'Collection' object is not callable. If you meant to "
TypeError: 'Collection' object is not callable. If you meant to call the 'get_dsn_parameters' method on a 'Collection' object it is failing because no such method exists.

Solution Brainstorm

We should add support for Djongo so that adding Sentry's Django SDK works without any issues.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Oct 11, 2023
  2. sentrivana commented on Oct 11, 2023

    @sentrivana
    Collaborator

    @InterstellarStella Looking at the stacktrace it seems like they're on a slightly older Python SDK version. Upgrading to 1.32.0 might help because we're now a bit more careful about accessing the params: https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/django/__init__.py#L668-L673

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Oct 11, 2023
  4. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Oct 11, 2023
  5. sentrivana commented on Oct 11, 2023

    @sentrivana
    Collaborator

    Hey @omarsagheer, thanks for the follow up! Just to clarify, you're on SDK version 1.32.0 and it still required the patch you mentioned?

  6. 1 remaining item

  7. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Oct 11, 2023
  8. sentrivana commented on Oct 11, 2023

    @sentrivana
    Collaborator

    Thanks! We'll look into fixing that in the next release.

  9. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Oct 11, 2023
  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Oct 11, 2023
  11. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Oct 12, 2023
  12. self-assigned this
    on Oct 12, 2023
  13. ghost added on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions