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

sdk: a bytes attribute crashes the console span exporter #623

Closed
mauriciovasquezbernal opened this issue Apr 28, 2020 · 5 comments
Closed
Assignees
Labels
bug Something isn't working sdk Affects the SDK package.

Comments

@mauriciovasquezbernal
Copy link
Member

The current logic to check attributes' types admits the bytes in, it creates problem in the exporters that don't perform type check.

Reproducer:

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
    SimpleExportSpanProcessor,
    ConsoleSpanExporter,
)

trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
  SimpleExportSpanProcessor(ConsoleSpanExporter())
)

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("foo") as foo:
  foo.set_attribute("willcrash", b"hi")
  print("Hello world from OpenTelemetry Python!")

I did a quick look and it happens because bytes is a Sequence, and each element inside is an integer.

I don't know if the we should update the logic to reject that kind of attributes or update the exporters to be able to accept them.

@mauriciovasquezbernal mauriciovasquezbernal added bug Something isn't working sdk Affects the SDK package. labels Apr 28, 2020
@sethmaxwl
Copy link
Contributor

I can take this

@codeboten
Copy link
Contributor

Thanks! Assigned.

@sethmaxwl
Copy link
Contributor

Would decoding anything of the type bytes before setting the attribute be an acceptable fix here?

@aabmass
Copy link
Member

aabmass commented Jun 4, 2020

@codeboten
Copy link
Contributor

fixed by #775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sdk Affects the SDK package.
Projects
None yet
Development

No branches or pull requests

4 participants