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

Persist and restore trace headers in workqueue #554

Open
mattmoor opened this issue Sep 16, 2024 · 2 comments
Open

Persist and restore trace headers in workqueue #554

mattmoor opened this issue Sep 16, 2024 · 2 comments

Comments

@mattmoor
Copy link
Member

I left a TODO here tagging @tcnghia because he worked this magic for Pub/Sub:

writer.Metadata = map[string]string{
// TODO(nghia): Extract and persist things like trace headers here.
}

I'm guessing it's not a ton of work, but we need to extract the relevant headers and encode them above.

Then restore them here:

// Context implements workqueue.OwnedInProgressKey.
func (o *inProgressKey) Context() context.Context {
return o.ownerCtx
}

I also need to fix the dispatcher to properly use this Context() method, which is an oversight on my part, which I'll correct now.

mattmoor added a commit to mattmoor/terraform-cloudrun-glue that referenced this issue Sep 16, 2024
I realized this wasn't properly threaded when opening: chainguard-dev#554 spelling out how to save/restore trace headers.

Signed-off-by: Matt Moore <[email protected]>
mattmoor added a commit that referenced this issue Sep 16, 2024
…555)

I realized this wasn't properly threaded when opening:
#554
spelling out how to save/restore trace headers.

Signed-off-by: Matt Moore <[email protected]>
@tcnghia
Copy link
Collaborator

tcnghia commented Sep 16, 2024

For pubsub, this was the PR #374 . Newer PubSub client sets a message attribute named googclient-traceparent which becomes a header with the same name. In our metrics handler we just restore it like this https://github.com/chainguard-dev/terraform-infra-common/blob/main/pkg/httpmetrics/metrics.go#L135

For work queue, since we control the request dispatching, we don't need to do stuffs in a metrics handler, but just set the traceparent header directly.

@mattmoor
Copy link
Member Author

Does that do what we expect transitively? It feels like that would have a relatively shallow effect? 🤔

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