Skip to content

Implement sensitive data sanitization for psycopg2 instrumentation #1734

@BuffaloWill

Description

@BuffaloWill

Although psycopg2 uses dbapi, it does not instrument capture_parameters=True. It's therefore missing the ability for a user to enable/disable raw db.statement's.

For example, I would expect to apply the parameter similar to enable_commenter and see the raw db.statement:

Psycopg2Instrumentor().instrument(capture_parameters=True)

In my testing, I am seeing db.statements sanitized by default.

I think this is the relevant code:

dbapi.wrap_connect(
__name__,
psycopg2,
"connect",
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
db_api_integration_factory=DatabaseApiIntegration,
enable_commenter=enable_sqlcommenter,
commenter_options=commenter_options,
)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions