Skip to content

test(mysql): cover database semconv modes#4683

Open
popsiclelmlm wants to merge 1 commit into
open-telemetry:mainfrom
popsiclelmlm:codex/mysql-semconv-tests
Open

test(mysql): cover database semconv modes#4683
popsiclelmlm wants to merge 1 commit into
open-telemetry:mainfrom
popsiclelmlm:codex/mysql-semconv-tests

Conversation

@popsiclelmlm

Copy link
Copy Markdown

Summary

Adds MySQL instrumentation tests for default, stable, and duplicate database semantic convention modes.

Reproduction

Issue #1632 asks to make sure MySQL instrumentation follows semantic conventions. The MySQL package delegated span attributes to the shared DB-API helpers, but the package tests did not assert the exact legacy/stable/duplicate attribute sets.

Root cause

Without MySQL-specific semconv assertions, regressions in the connection attributes passed through MySQLInstrumentor.instrument_connection() could miss schema URL, database, user, and peer/server attribute changes.

Changes

  • Add a semconv opt-in test helper that resets the semconv singleton around each mode.
  • Include user on the MySQL connection mock so legacy/dup db.user is verified.
  • Assert MySQL span attributes for default, database,http, and database/dup,http/dup modes.

Tests

  • .venv/bin/python -m pytest instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py -q -k semconv
  • .venv/bin/python -m pytest instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py -q
  • .venv/bin/python -m ruff check instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py
  • .venv/bin/python -m py_compile instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py

Screenshots/Logs

Not applicable; test-only change.

Refs #1632

Adds MySQL instrumentation coverage for default, stable, and duplicate database semantic convention modes.

Assisted-by: ChatGPT 5
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.

1 participant