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

dbapi: Add db.collection.name, use connection kwargs for connection attributes #2869

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

keithZmudzinski
Copy link

@keithZmudzinski keithZmudzinski commented Sep 12, 2024

Description

This pull request adds 3 features to the opentelemetry-instrumentation-dbapi library.

  1. Includes db.collection.name in the span name if possible. This is in line with the semantic conventions for database span names: https://opentelemetry.io/docs/specs/semconv/database/database-spans/#name
  2. Adds the db.collection.name attribute to the span if possible.
  3. Uses more sources for the db.user, net.peer.name, and net.peer.port span attributes.
    • I found that when using opentelemetry-instrumentation-dbapi to instrument MySQLdb, there wasn't a way to get the host from the instantiated Connection class. However, the host is present in the kwargs used to create the connection. If we parse the kwargs for these attributes, we are more likely to get them.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I've used these changes in a local project using the console exporter and New Relic across a variety of sql connections. Confirmed the expected attributes were populated.
Added unit tests to verify the changes.

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 (NA)

Copy link

linux-foundation-easycla bot commented Sep 12, 2024

CLA Not Signed

@keithZmudzinski keithZmudzinski requested a review from a team September 12, 2024 22:51
@keithZmudzinski
Copy link
Author

I'm working on getting the CLA signed, but for what it's worth I've passed dbapi tests and linting locally

@keithZmudzinski
Copy link
Author

Making progress on the CLA, I've got a person who said they'd be the CLA manager

@keithZmudzinski
Copy link
Author

We've got a CLA manager, just awaiting approval now

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.

1 participant