Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dbname as collecting parameter for PEP0249 #461

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

pvital
Copy link
Member

@pvital pvital commented Oct 18, 2023

This PR contains two commits.

The first one, 55e826e, adds dbname as a collecting parameter for PEP0249. When connecting to a PostgreSQL server, for example, using the psycopg2 module, the parameter dbname can be used to specify the database name to connect into, like the following piece of code:

    conn = psycopg2.connect(
        host=os.environ['POSTGRES_HOST'],
        dbname=os.environ['POSTGRES_DB'],
        user=os.environ['POSTGRES_USER'],
        password=os.environ['POSTGRES_PASSWORD']
    )

Without this fix, the Instana UI is not able to display the database name when inspecting an EXIT span, as shown in the following image:

before_commit_0f9434e02013

With this fix, the name of the database is collected and displayed:

after_commit_0f9434e02013

The second commit, 221432e, adapts all the unit tests that use PEP0249 to guarantee that all options for database parameter names during the connection are tested.

@pvital pvital requested review from Ferenc- and GSVarsha October 18, 2023 13:13
@pvital pvital self-assigned this Oct 18, 2023
tests/clients/test_psycopg2.py Outdated Show resolved Hide resolved
tests/clients/test_pymysql.py Outdated Show resolved Hide resolved
Signed-off-by: Paulo Vital <paulo.vital@ibm.com>
Guarantees that PEP0249 can test all options for database parameter name
during the connection.

Signed-off-by: Paulo Vital <paulo.vital@ibm.com>
@pvital pvital force-pushed the dbname_param_support branch from 221432e to 3dbfd5c Compare October 24, 2023 23:55
@pvital pvital requested a review from Ferenc- October 24, 2023 23:56
Copy link
Collaborator

@Ferenc- Ferenc- left a comment

Choose a reason for hiding this comment

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

Approved

@pvital pvital merged commit 47b1c4b into master Oct 25, 2023
2 checks passed
@pvital pvital deleted the dbname_param_support branch October 25, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants