open-telemetry / open-telemetry/opentelemetry-python-contrib

MySQLClientInstrumentor: pass kwargs to wrap_connect

Open
#2,894 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

What problem do you want to solve?

wrap_connect has a parameter capture_parameters:
capture_parameters: Configure if db.statement.parameters should be captured.
The problem is that there is no way of passing that parameter to the MySQLClientInstrumentor.

Describe the solution you'd like

MySQLClientInstrumentor._instrument() should pass the **kwargs to wrap_connect()
As far as I am concerned, calling MySQLClientInstrumentor().instrument(capture_parameters=True) should cause capture_parameters=True to be passed properly to wrap_connect().

Describe alternatives you've considered

No response

Additional Context

To quickly try out if this would solve the problem, I implemented my own CustomMySQLClientInstrumentor derived from opentelemetry-instrumentation.mysqlclient.MySQLClientInstrumentor and basically copy-pasted its _instrument implementation while passing **kwargs to wrap_connect(). It worked.

Would you like to implement a fix?

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MySQLClientInstrumentor._instrument() in the opentelemetry-instrumentation.mysqlclient package and trace how instrument() passes kwargs into it. Verify that the kwargs reach wrap_connect(), then run the existing mysqlclient instrumentation tests if available and confirm capture_parameters=True is honored.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, python
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.