Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Add OTEL spans to SQS trigger#25

Draft
kate-goldenring wants to merge 1 commit into
spinframework:mainfrom
kate-goldenring:spans
Draft

Add OTEL spans to SQS trigger#25
kate-goldenring wants to merge 1 commit into
spinframework:mainfrom
kate-goldenring:spans

Conversation

@kate-goldenring
Copy link
Copy Markdown
Contributor

TODO: Determine why span is only appearing periodically. Seems to do with how we are passing the context of the spans on spawn.

@calebschoepp calebschoepp requested a review from lann May 9, 2024 21:00
Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@calebschoepp
Copy link
Copy Markdown
Contributor

@lann for some reason we're getting weird async Span issues and using in_current_span wasn't fixing them. From what I can tell we would only need in_current_span in aws.go, but even putting it everywhere didn't solve the issue.

Comment thread src/lib.rs
fn start_receive_loop(engine: Arc<TriggerAppEngine<Self>>, client: &aws::Client, component: &Component) -> tokio::task::JoinHandle<TerminationReason> {
let future = Self::receive(engine, client.clone(), component.clone());
tokio::task::spawn(future)
tokio::task::spawn(future.in_current_span())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is no current span at this point is there? From the docs that appears to make it equivalent to .instrument(Span::new_disabled(...)).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So it sounds like we may need to add a span to this function (#[instrument(name = "spin_trigger_sqs.start_receive_loop")? From our Spin triggers (HTTP and Redis), it seemed like an initial parent span was implied, so I am a little confused here

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread src/lib.rs
}
}

#[instrument(name = "spin_trigger_sqs.process_message", skip_all, fields(otel.name = format!("{} receive", queue_name_from_url(&self.component.queue_url)), messaging.message.id = msg.display_id()))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I guess I would still expect this span to show up correctly, but I don't really know how a disabled parent span would play into that...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants