spanner_v1/trace: trace_call span attributes are hard-coded and don't follow OpenTelemetry semantic conventions; should instead use incorrect standardized OpenTelemetry attributes
If we examine the code in here
| attributes = { | |
| "db.type": "spanner", | |
| "db.url": SpannerClient.DEFAULT_ENDPOINT, | |
| "db.instance": session._database.name, | |
| "net.host.name": SpannerClient.DEFAULT_ENDPOINT, | |
| } |
Fixes
We should import the package opentelemetry.semconv.attributes and from it we can use the following imported variables
- "db.type" should be DB_SYSTEM aka "db.system" = "google.cloud.spanner"
- "db.instance_name" should be DB_NAME aka "db.name"
- "db.url" should use DB_CONNECTION_STRING aka "db.connection_string"
- "net.host.name" should use NET_HOST_NAME
The code in question was written in 2020, long before OpenTelemetry standardized semantic conventions hence I am sending over a change pretty shortly to fix this!