Skip to content

Expose capture_parameters in sqlite3 instrumentation - #4908

Open
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4793-opentelemetry-instrumentation-sqlite3-ex
Open

Expose capture_parameters in sqlite3 instrumentation#4908
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4793-opentelemetry-instrumentation-sqlite3-ex

Conversation

@saisharan0103

Copy link
Copy Markdown

Fixes #4793.

The sqlite3 instrumentor delegates query execution wrapping to opentelemetry.instrumentation.dbapi, but it did not expose or forward dbapi's capture_parameters option. This meant SQLite3Instrumentor().instrument(capture_parameters=True) silently dropped the option before dbapi.wrap_connect was called, and SQLite3Instrumentor.instrument_connection(...) had no capture_parameters parameter to pass to dbapi.instrument_connection.

This change mirrors the dbapi option threading used by other instrumentors:

  • Reads capture_parameters from _instrument kwargs with a False default.
  • Passes capture_parameters into dbapi.wrap_connect for both sqlite3 and sqlite3.dbapi2 modules.
  • Adds capture_parameters: bool = False to instrument_connection, documents it in the method docstring, and forwards it to dbapi.instrument_connection.
  • Extends the module docstring with a short capture-parameters usage note.
  • Adds focused sqlite3 tests for default forwarding, enabled forwarding, per-connection forwarding, and span attributes when capture is enabled.

ruff check instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/__init__.py instrumentation/opentelemetry-instrumentation-sqlite3/tests/test_sqlite3.py reports no new findings on the changed files.
Ran pytest -x locally with no new failures.

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ❌ The email address for the commit (78ac1e6) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

opentelemetry-instrumentation-sqlite3: expose capture_parameters

1 participant