Skip to content

Conversation

@lcian
Copy link
Member

@lcian lcian commented May 8, 2025

Adds capturing span events as Sentry events.
This is the behavior we have in other SDKs.

In the future we can consider ways to e.g. set tags on the event from special span attributes like we do in the tracing integration.

We don't capture a stack trace as we have no way to get it reliably. The event itself does not carry it, it's just a struct with name, timestamp and attributes.

Should it be opt-in?

@lcian lcian requested review from Swatinem and sl0thentr0py May 8, 2025 12:58
@lcian lcian marked this pull request as draft May 8, 2025 13:08
@lcian
Copy link
Member Author

lcian commented May 8, 2025

We could instead capture breadcrumbs, 1 Sentry event per OTEL event could be too much, let's discuss this.

// Sentry span attributes/context values

for event in data.events {
sentry_core::capture_event(convert_event(&event));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a bit weird that you only get these on_end, and not when they happen.
if we decide to attach them as breadcrumbs, they should have proper ordering in relation to other breadcrumbs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, on the other hand you know exactly which span they are in and you have the timestamp, so it shouldn't be much of a problem.

let mut contexts = BTreeMap::<String, Context>::new();
contexts.insert("otel".to_owned(), otel_context.into());
Event {
level: sentry_core::Level::Error,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn’t an otel event have a level?
for tracing we have this code that does different things depending on the event level.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately in Rust they just carry a message, timestamp and attributes.
It seems that there is some misalignment in OTEL itself when it comes to this.
In e.g. Java they carry exceptions, so it makes sense to create errors out of them. @sl0thentr0py I don't think I mentioned this before when discussing this.

@lcian
Copy link
Member Author

lcian commented Jun 17, 2025

Closing this for now

@lcian lcian closed this Jun 17, 2025
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

Successfully merging this pull request may close these issues.

3 participants