Skip to content

Conversation

@tammy-baylis-swi
Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi commented Jan 21, 2026

Description

Add SQLAlchemy instrumentor support for when OTEL_SEMCONV_STABILITY_OPT_IN includes

  • "database" or "database/dup"
  • "http" or "http/dup"

This changes the SQLComment in span attribute feature if opted in. Inclusion of sqlcomment on query span would be on db.statement and/or db.query.text attribute if default, "database", or "database/dup".

Fixes #2679

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Added unit tests

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

Comment on lines +325 to +327
# Extract db_name for operation name
# Prefer old semconv (db.name) over new semconv (db.namespace) for backwards compatibility
db_name = attrs.get(DB_NAME) or attrs.get(DB_NAMESPACE) or ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a small design choice; lmk if should be another way.

@tammy-baylis-swi tammy-baylis-swi marked this pull request as ready for review January 22, 2026 23:47
@tammy-baylis-swi tammy-baylis-swi requested a review from a team as a code owner January 22, 2026 23:47
@tammy-baylis-swi tammy-baylis-swi changed the title DB semantic convention stability migration for SQLAlchemy DB and HTTP semantic convention stability migration for SQLAlchemy Jan 26, 2026
@tammy-baylis-swi tammy-baylis-swi moved this to Ready for review in @xrmx's Python PR digest Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

opentelemetry-instrumentation-sqlalchemy: semantic convention stability migration

2 participants