Skip to content

Illegal access to span.kind #3046

Open
Open
@soulmerge

Description

Describe your environment

No response

What happened?

Several instrumentation modules seem to access a kind property of Span objects, even though no such property exists in the Span ABC. The implementations seem to assume that opentelemetry-sdk is active, which uses its own Span class deriving from ReadableSpan, which in turn provides a kind property.

Here is an overview of modules making that erroneous assumption:

$ ag '\.kind\b' $(ag -l '\.kind\b' instrumentation/opentelemetry-instrumentation-* | grep -v '/tests/')
instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
714:                    if current_span.kind == trace.SpanKind.SERVER:
870:            and server_span.kind == trace.SpanKind.SERVER

instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py
259:                if span.is_recording() and span.kind == SpanKind.SERVER:
275:                if span.is_recording() and span.kind == SpanKind.SERVER:
369:                if span.is_recording() and span.kind == SpanKind.SERVER:
396:                if span.is_recording() and span.kind == SpanKind.SERVER:

instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py
356:            if span.is_recording() and span.kind == trace.SpanKind.SERVER:
488:            if span.is_recording() and span.kind == trace.SpanKind.SERVER:

instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py
374:                        and span.kind == trace.SpanKind.SERVER
461:            if span.is_recording() and span.kind == trace.SpanKind.SERVER:

instrumentation/opentelemetry-instrumentation-pyramid/src/opentelemetry/instrumentation/pyramid/callbacks.py
115:        if span.kind == trace.SpanKind.SERVER:
236:                if span.is_recording() and span.kind == trace.SpanKind.SERVER:

instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/__init__.py
504:        if span.is_recording() and span.kind == trace.SpanKind.SERVER:
564:        if ctx.span.is_recording() and ctx.span.kind == trace.SpanKind.SERVER:

instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py
611:            if span.is_recording() and span.kind == trace.SpanKind.SERVER:
647:        if span.is_recording() and span.kind == trace.SpanKind.SERVER:

Steps to Reproduce

Expected Result

Actual Result

Additional context

No response

Would you like to implement a fix?

None

Activity

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions