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

OpenTracing Shim not converting exceptions to format expected by OpenTelemetry #4152

Open
gorbart opened this issue Aug 27, 2024 · 2 comments · May be fixed by #4184
Open

OpenTracing Shim not converting exceptions to format expected by OpenTelemetry #4152

gorbart opened this issue Aug 27, 2024 · 2 comments · May be fixed by #4184
Assignees
Labels
bug Something isn't working

Comments

@gorbart
Copy link

gorbart commented Aug 27, 2024

Describe your environment

No response

What happened?

When using TracerShim.start_active_span as a context manager, errors raised inside this context manager are being caught by _on_error function that underneath calls SpanShim.log_kv and this is where problem lays. _on_error catches exception as an object, same with traceback and exception type. These are being passed in log_kv to OpenTelemetry's Span.add_event as argument attributes which is expected to be a dict of primitive types or lists of primitive types. All in all, OpenTelemetry logs a warning Invalid type type for attribute 'error.kind' value. Expected one of ["bool","str","bytes","int","float"] or a sequence of those types and discards this error.

It should be an easy fix with casting all objects present inside key_values to string inside log_kv function or something like that

Steps to Reproduce

with tracer.start_active_span("whatever"):
    raise Exception

Expected Result

An error present in logs

Actual Result

Warning Invalid type type for attribute 'error.kind' value. Expected one of ["bool","str","bytes","int","float"] or a sequence of those types

Additional context

No response

Would you like to implement a fix?

None

@gorbart gorbart added the bug Something isn't working label Aug 27, 2024
@xrmx
Copy link
Contributor

xrmx commented Aug 27, 2024

@gorbart Care to implement a fix?

@zhihali
Copy link
Contributor

zhihali commented Sep 4, 2024

Hi, I could pick this one.

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
3 participants