Skip to content

Make a span as an error in OTEL #85

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

Open
piclemx opened this issue Mar 31, 2025 · 7 comments
Open

Make a span as an error in OTEL #85

piclemx opened this issue Mar 31, 2025 · 7 comments

Comments

@piclemx
Copy link

piclemx commented Mar 31, 2025

Hello,

I was wondering what would be the recommended approach when using fastrace + opentelemetry to mark a span as an error.

In their documentation, you will use the span.setStatus(Error) and they have a function that does span.record(err).

What fastrace approach would be in that case?

@andylokandy
Copy link
Collaborator

andylokandy commented Mar 31, 2025

OpenTelemetry defines error to be an event with proper attributes. Therefore, in fastrace, it's very straightforward to record an error like this:

LocalSpan::add_event(Event::new("exception")
    .with_property(|| ("exception.message", "Division by zero"))
    .with_property(|| ("exception.type", "OSError"))
    .with_property(|| ("exception.stacktrace", std::backtrace::Backtrace::force_capture().to_string()))
);

@piclemx
Copy link
Author

piclemx commented Apr 8, 2025

Make senses.

@andylokandy I can reopen an issue but what about a SpanKind in the OTEL spec. I guess I could do the same kind of things. But i'm not sure that would be an attribute since I'm not finding in the spec. WDYT?

@andylokandy
Copy link
Collaborator

andylokandy commented Apr 8, 2025

Currently, span kind is same across all spans in an application. It could be configured via fastrace-opentelemetry.

@piclemx
Copy link
Author

piclemx commented Apr 8, 2025

Ok, but make it hards if I have span that needs to be Server coming from my http server and and I'm calling other services which theoretically needs to be Client.

@andylokandy
Copy link
Collaborator

yes... maybe fastrace-opentelemetry should be able to recognise it from specific attribute

@piclemx
Copy link
Author

piclemx commented Apr 8, 2025

Could just with the span.kind attribute IMO. WDYT?

@andylokandy
Copy link
Collaborator

Could just with the span.kind attribute IMO. WDYT?

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants