open-telemetry / open-telemetry/opentelemetry-python-contrib
`opentelemetry-instrumentation-pymssql`: expose `capture_parameters`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Part of #4787 (global db.query.parameter.<key> tracking issue).
Background
pymssql builds on the dbapi base but defines its own
DatabaseApiIntegration subclass. Once the dbapi sub-issue lands the base knows
how to emit db.query.parameter.<key> correctly — but only when
capture_parameters=True. The instrumentor never exposes that option, so users
have no way to enable parameter capture.
psycopg2 already exposes capture_parameters and is the reference
implementation.
What to do
Thread a capture_parameters option through the instrumentor, mirroring
psycopg2:
- In
_instrument, readcapture_parameters = kwargs.get("capture_parameters", False)
and pass it to the dbapi wrapping call. - In
instrument_connection, add acapture_parametersparameter and pass it
through. - Ensure the pymssql
DatabaseApiIntegrationsubclass forwards
capture_parametersto the base (check its__init__/ factory usage so the
flag is not dropped). - Document the option in the module docstring.
No parameter-formatting logic lives here — it all comes from the dbapi base.
Acceptance criteria
instrument(capture_parameters=True)and
instrument_connection(conn, capture_parameters=True)both enable capture.- With capture enabled, spans carry
db.query.parameter.<key>under the new
semconv anddb.statement.parametersunder the old semconv (via the base). - Default remains no parameter capture.
Tests
- Verify
capture_parametersis forwarded through the pymssql subclass to the
dbapi layer for both entry points. - Verify
db.query.parameter.<key>appears under the new semconv when enabled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the pymssql instrumentor, its _instrument and instrument_connection entry points, and the DatabaseApiIntegration subclass or factory usage. Compare the psycopg2 instrumentation for capture_parameters, then add forwarding tests for both entry points and verify the new and old semantic-convention attributes while keeping the default disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100