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

tracing: using package with import errors is unreasoanable and defeats the purpose of adding instrumentation if a feature should be programmed without even dependencies #1225

Open
odeke-em opened this issue Nov 5, 2024 · 0 comments
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API.

Comments

@odeke-em
Copy link
Contributor

odeke-em commented Nov 5, 2024

from google.cloud.spanner_v1 import gapic_version
try:
from opentelemetry import trace
from opentelemetry.trace.status import Status, StatusCode
from opentelemetry.semconv.attributes.otel_attributes import (
OTEL_SCOPE_NAME,
OTEL_SCOPE_VERSION,
)
HAS_OPENTELEMETRY_INSTALLED = True
except ImportError:
HAS_OPENTELEMETRY_INSTALLED = False

to me is a very unreasonable condition because we say that these libraries are traced meanwhile on just a single failed import, we work around this and then return None for spans. Why not fail loudly when dependencies are not correctly installed? This feels more like a kludge and customers can falsely use the package thinking they are exporting spans: no other language instrumentations work like this: if a customer doesn't want OpenTelemetry, let them disable it but that should not leak into our code, because OpenTelemetry-Python will provide a NoopSpan. Ensuring that the imports work correctly should be a pre-requisite.

Kindly cc-ing @harshachinta @sakthivelmanii @surbhigarg92 @alkatrivedi

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Nov 5, 2024
@aseering aseering assigned surbhigarg92 and unassigned aseering Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API.
Projects
None yet
Development

No branches or pull requests

4 participants