Skip to content

[jdbc-v2,client-v2] Build callback interface to for spans #2974

Description

@chernser

Descriptions

Here is semantic convention for DB operations spans https://opentelemetry.io/docs/specs/semconv/db/database-spans/

Some information can be provided by user application only. Passing it thru configuration is too much and doesn't work with dynamic values. So callback for adapter would work better. Base adapter can be implemented by client but should not include any observability library as dependency.

Here is what client can set in this adapter:

Attribute Available? Where from
db.system.name always constant clickhouse
db.namespace always ClientConfigProperties.DATABASE from merged settings
db.query.text query/command only the sqlQuery argument; stream inserts have no user SQL
db.collection.name insert / getTableSchema only the tableName argument
db.operation.name insert/ping/schema only known by which API was called
db.query.summary no (client-v2) requires a SQL parser
server.address / server.port per attempt; at start only if single-endpoint Endpoint from nodeSelector
db.response.status_code on failure X-ClickHouse-Exception-Code header, read in readError
error.type on failure exception class or ClientFaultCause
db.response.returned_rows on success result_rows from X-ClickHouse-Summary
db.operation.batch.size POJO insert only List#size()
db.query.parameter. query only the queryParams map
network.peer.* no Apache HttpClient doesn't surface it at this layer
clickhouse.query_id usually assigned at Client.java:1819-1821

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions