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

Add tracing middleware and helper function #964

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

c2h5oh
Copy link
Contributor

@c2h5oh c2h5oh commented Dec 5, 2024

To get tracing across services one has to propagate tracing headers downstream.

This PR adds a middleware copies tracing headers into request context and provides a function to add those headers to any requests you are creating to other services without having to pass around the entire request - context is enough.

Comment on lines +19 to +21
if len(traceHeaders) == 0 {
traceHeaders = defaultTraceHeaders
}
Copy link

Choose a reason for hiding this comment

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

I would not put any defaults here but rather export the defaultTraceHeaders so from caller perspective it is clearer what is being done.

Copy link

@Pipello Pipello left a comment

Choose a reason for hiding this comment

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

Could you add a comments for the documentation?

It would also be nice to add some unit tests

@VojtechVitek VojtechVitek self-requested a review December 15, 2024 22:18
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.

2 participants