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

Illegal access to span.kind #3046

Open
soulmerge opened this issue Nov 25, 2024 · 0 comments
Open

Illegal access to span.kind #3046

soulmerge opened this issue Nov 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@soulmerge
Copy link

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

@soulmerge soulmerge added the bug Something isn't working label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant