Vikash Singh
Vikash Singh

Reputation: 14001

Getting import error while trying to import StatusCanonicalCode using OpenTelemetry python library

Importing StatusCanonicalCode from python opentelemetry library is giving error

from opentelemetry.trace.status import StatusCanonicalCode

Error msg:

*** ImportError: cannot import name 'StatusCanonicalCode' from 'opentelemetry.trace.status'

The file opentelemetry.trace.status doesn't have StatusCanonicalCode class.

But these documentations and specifications gives this import as a valid example:

https://opentelemetry.lightstep.com/python/tracing/ -> search for StatusCanonicalCode

The same import is also present in jaeger library.

Am I missing something here?

Upvotes: 0

Views: 4532

Answers (1)

Srikanth Chekuri
Srikanth Chekuri

Reputation: 2274

But the documentation and specifications give this import as a valid example:

Where did spec or documentation say this import as a valid example? (Lightstep is not official, they are just vendors)

We have changed the canonical code to the status code very long back. Here is the PR which made that change https://github.com/open-telemetry/opentelemetry-python/pull/1282.

The same import is also present in the jaeger library

Again this link is one of the former maintainer's test documentation but not official. Here is the official documentation https://opentelemetry-python.readthedocs.io/en/latest/

Upvotes: 1

Related Questions