Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use modernized and standardized OpenTelemetry when tracing #1172

Conversation

odeke-em
Copy link
Contributor

@odeke-em odeke-em commented Jul 25, 2024

This change modernizes trace span attributes by using OpenTelemetry's
semantic conventions that are standardized and allow for much
better common ground adoption by broader systems, even more as
Google Cloud Tracing & Monitoring pushes towards OpenTelemetry more.

With this change we've made the replacement of these fields, directly
with imports from opentelemetry.semconv.trace.SpanAttributes, as:

  • "db.type" => DB_SYSTEM aka "db.system"
  • "db.url" => DB_CONNECTION_STRING aka "db.connection_string"
  • "db.instance" => DB_NAME aka "db.name"
  • "net.host.name" => NET_HOST_NAME aka "net.host.name"

While here, also updated opentelemetry-(api, sdk) dependencies to use
versions "1.25.0", then opentelemetry-(instrumentation) to "0.46b0"

Also added in an option toggled by environment variable

ENABLE_EXTENDED_TRACING=true

which allows spans to be annotated with the SQL statement keyed by

"db.statement"

Fixes #1170
Fixes #1171
Fixes #1173

Exhibit

With the change made, we now have this trace with attributes visualized from Google Cloud Tracing per
Screenshot 2024-07-26 at 7 12 42 PM
Screenshot 2024-07-26 at 7 11 10 PM

@odeke-em odeke-em requested review from a team as code owners July 25, 2024 00:07
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/python-spanner API. labels Jul 25, 2024
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch 3 times, most recently from dc7d3ae to a045aa5 Compare July 25, 2024 01:01
@odeke-em odeke-em changed the title fix: use standardized OpenTelemetry attributes when tracing fix: use modernized and standardized OpenTelemetry when tracing Jul 25, 2024
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch 8 times, most recently from ad15b89 to b43e4f1 Compare July 26, 2024 16:44
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 26, 2024
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch 8 times, most recently from 8aadc02 to 47f5b3d Compare July 30, 2024 14:52
@odeke-em
Copy link
Contributor Author

@harshachinta is it possible for you to hep me authorize workflows to have the tests running on every push? Thank you.

@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch from 47f5b3d to ac63111 Compare July 31, 2024 22:09
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch from ac63111 to 6da95a1 Compare August 9, 2024 14:13
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch from 90e36ed to b190663 Compare September 10, 2024 23:05
@odeke-em odeke-em force-pushed the trace-use-standardized-opentelemetry-attributes branch from d6d6ece to 58c8555 Compare September 10, 2024 23:12
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 11, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 12, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 16, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
odeke-em added a commit to odeke-em/python-spanner that referenced this pull request Sep 17, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates googleapis#1170
Fixes googleapis#1173
Built from PR googleapis#1172
harshachinta pushed a commit that referenced this pull request Sep 18, 2024
This change non-invasively introduces dependencies of opentelemetry
bringing in the latest dependencies and modernizing them.

While here also brought in modern span attributes:
* otel.scope.name
* otel.scope.version

Also added a modernized example to produce traces as well
with gRPC-instrumentation enabled, and updated the docs.

Updates #1170
Fixes #1173
Built from PR #1172
@odeke-em
Copy link
Contributor Author

odeke-em commented Nov 7, 2024

Superseded by #1199

@odeke-em odeke-em closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment