Sitelet https://github.com/googleapis/python-spanner/issues/1170
Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

spanner_v1/trace: trace_call span attributes are hard-coded and don't follow OpenTelemetry semantic conventions; should instead use incorrect standardized OpenTelemetry attributes #1170

Description

@odeke-em

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!

Activity

  1. added 13 commits that reference this issue on Jul 25, 2024
    6732963
    3e99517
    dc7d3ae
    a045aa5
    ddc0057
    13c326d
    4d31d9d
    c2801a5
    c41c4e5
    ed8f987
    ad15b89
    b43e4f1
    b83a4df
  2. 34 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions