Skip to content

Conversation

StefanoOvus
Copy link

@StefanoOvus StefanoOvus commented Aug 5, 2025

Description

Added missing parameter capture_parameters for psycopg instrumentation:

PsycopgInstrumentor().instrument(capture_parameters=True)

populates the db.statement.parameters attribute in spans.

Fixes #3569

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Added tests for sync and async connection:

  • instrumentation/opentelemetry-instrumentation-psycopg/tests/test_psycopg_integration.py::TestPostgresqlIntegration::test_span_params_attribute
  • instrumentation/opentelemetry-instrumentation-psycopg/tests/test_psycopg_integration.py::TestPostgresqlIntegrationAsync::test_span_params_attribute

Tested in a small script with Python 3.13.3 + jaegertracing/jaeger:2.6.0 docker image (OTLP/gRPC protocol).

  • tox -e py313-test-instrumentation-psycopg
  • tox -e spellcheck
  • tox -e lint-instrumentation-psycopg

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented Aug 5, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@xrmx xrmx moved this to Ready for review in @xrmx's Python PR digest Aug 22, 2025
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please add a CHANGELOG entry

@StefanoOvus StefanoOvus force-pushed the psycopg-instrumentation-capture-params branch from b30ad9c to 6eabb29 Compare August 25, 2025 15:22
@StefanoOvus StefanoOvus requested a review from a team as a code owner August 25, 2025 15:34
@StefanoOvus
Copy link
Author

@xrmx added changelog as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

PsycopgInstrumentor capture_parameters
2 participants