Skip to content

Remove deprecated database instrumentation API methods#15944

Merged
trask merged 5 commits intomainfrom
copilot/remove-deprecated-instrumentation-code
Jan 21, 2026
Merged

Remove deprecated database instrumentation API methods#15944
trask merged 5 commits intomainfrom
copilot/remove-deprecated-instrumentation-code

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 19, 2026

Removes deprecated methods from database instrumentation APIs that have been replaced with newer alternatives following updated semantic conventions.

Core API Changes

Deleted DbClientCommonAttributesGetter interface - functionality consolidated into DbClientAttributesGetter

DbClientAttributesGetter:

  • Removed: getStatement() → use getDbQueryText()
  • Removed: getOperation() → use getDbOperationName()
  • Removed: getResponseStatusCode(REQUEST, RESPONSE) → use getDbResponseStatusCode(RESPONSE, Throwable)
  • Retained deprecated: getUser(), getConnectionString() (still needed for old semconv emission)

SqlClientAttributesGetter:

  • Removed: getBatchSize() → use getDbOperationBatchSize()
  • Removed: getQueryParameters() → use getDbQueryParameters()

SqlStatementInfo:

  • Removed: getFullStatement() → use getQueryText()
  • Removed: getOperation() → use getOperationName()
  • Removed: getMainIdentifier() → use getCollectionName() / getStoredProcedureName()

MultiQuery:

  • Removed: getMainIdentifier(), getOperation(), getStatements()
  • Use: getCollectionName(), getStoredProcedureName(), getOperationName(), getQueryTexts()

SqlClientAttributesExtractorBuilder:

  • Retained deprecated: setTableAttribute() (still needed for old semconv support)

Instrumentation Updates

Retained deprecated getUser() and getConnectionString() method overrides in implementations for old semconv support:

  • JDBC, MongoDB, R2DBC, Vert.x Redis/SQL clients

Removed deprecated getDbQueryText() overrides (converted to proper implementations):

  • Lettuce, Redisson

For Spymemcached, removed deprecated override (using default implementation).

Original prompt

Remove Deprecated Database Instrumentation Code

Affected Modules

Core API: instrumentation-api-incubator
DB Instrumentations: jdbc, mongo-3.1, r2dbc-1.0, lettuce-5.0/5.1, redisson, spymemcached-2.12, vertx-redis-client-4.0, vertx-sql-client

Removal Plan

Phase 1: Core API (instrumentation-api-incubator)

DbClientCommonAttributesGetter - Remove entire interface → Use DbClientAttributesGetter

DbClientAttributesGetter - Remove deprecated methods:

  • getStatement()getDbQueryText()
  • getOperation()getDbOperationName()
  • getDbResponseStatusCode(REQUEST, RESPONSE)getDbResponseStatusCode(RESPONSE, Throwable)

SqlClientAttributesGetter - Remove:

  • getBatchSize()getDbOperationBatchSize()
  • getParameters()getDbQueryParameters()

SqlStatementInfo - Remove:

  • getMainIdentifier()getQueryText()
  • getOperation()getOperationName()
  • getTable()getCollectionName() / getStoredProcedureName()

MultiQuery - Remove:

  • getTable()getCollectionName() / getStoredProcedureName()
  • getOperation()getOperationName()
  • getFullStatement()getQueryTexts()

SqlClientAttributesExtractorBuilder - Remove deprecated configuration method (no longer needed)

Phase 2: JDBC Instrumentation

Files: JdbcAttributesGetter.java (L29, L43), OpenTelemetryPreparedStatement.java (L243), OpenTelemetryCallableStatement.java (L568), OpenTelemetryDataSource.java (L62, L74)

Actions: Remove old semantic convention methods, update to new API

Testing: Full JDBC test suite with PostgreSQL, MySQL, H2, Oracle, SQL Server

Phase 3: MongoDB

File: MongoDbAttributesGetter.java (L64)

Actions: Update to DbClientAttributesGetter, test CRUD/aggregations/transactions

Phase 4: R2DBC

File: R2dbcSqlAttributesGetter.java (L27, L40)

Actions: Update to new API, test with PostgreSQL, MySQL, H2 drivers

Phase 5: Redis (Lettuce)

File: LettuceDbAttributesGetter.java (L36)

Actions: Update to new DB attributes API, test commands/pipelines/transactions

Phase 6: Redis (Redisson)

File: RedissonDbAttributesGetter.java (L27)

Actions: Update API, test distributed object operations

Phase 7: Memcached

File: SpymemcachedAttributesGetter.java (L25)

Actions: Update API, test get/set/delete operations

Phase 8: Vert.x Database Clients

Files: VertxRedisClientAttributesGetter.java (L28, L44), VertxSqlClientAttributesGetter.java (L31)

Actions: Update API, test async operations with PostgreSQL, MySQL, DB2

Testing Strategy

Gradle Test Tasks:

# Core API
./gradlew :instrumentation-api-incubator:test

# JDBC
./gradlew :instrumentation:jdbc:library:test
./gradlew :instrumentation:jdbc:javaagent:test

# MongoDB
./gradlew :instrumentation:mongo:mongo-3.1:library:test
./gradlew :instrumentation:mongo:mongo-3.1:javaagent:test

# R2DBC
./gradlew :instrumentation:r2dbc-1.0:library:test
./gradlew :instrumentation:r2dbc-1.0:javaagent:test

# Lettuce
./gradlew :instrumentation:lettuce:lettuce-5.0:javaagent:test
./gradlew :instrumentation:lettuce:lettuce-5.1:library:test

# Redisson
./gradlew :instrumentation:redisson:redisson-3.0:javaagent:test

# Spymemcached
./gradlew :instrumentation:spymemcached-2.12:javaagent:test

# Vert.x
./gradlew :instrumentation:vertx:vertx-redis-client-4.0:javaagent:test
./gradlew :instrumentation:vertx:vertx-sql-client:vertx-sql-client-4.0:javaagent:test

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Remove deprecated database instrumentation code Remove deprecated database instrumentation API methods Jan 20, 2026
Copilot AI requested a review from trask January 20, 2026 00:03
Copilot AI requested a review from trask January 20, 2026 02:33
*/
@Deprecated
@Nullable
default String getUser(REQUEST request) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this method and getConnectionString were pulled down into this interface from the deleted DbClientCommonAttributesGetter

@trask trask marked this pull request as ready for review January 20, 2026 04:18
@trask trask requested a review from a team as a code owner January 20, 2026 04:18

// TODO: make this required to implement
@Nullable
default String getDbQueryText(REQUEST request) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we could consider making this required. The removal of getStatement would most likely break compilation of code that implements that method anyway (if it uses the @Overrides).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll send follow-up PR

@trask trask merged commit 3ca0102 into main Jan 21, 2026
162 of 164 checks passed
@trask trask deleted the copilot/remove-deprecated-instrumentation-code branch January 21, 2026 22:17
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.

3 participants