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

[feature-request] Provide an option to set http client options, like headers or maybe update the http req. #35

Open
mgale opened this issue Jan 5, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@mgale
Copy link

mgale commented Jan 5, 2022

I would like to pass contextual data to the Getter interface Get function via ctx.

For example, using tracing tools like Datadog, the client HTTP headers need to be added before the HTTP request is sent and pulled off when the loading function is run. That could allow complete application visibility:
https://docs.datadoghq.com/tracing/setup_overview/custom_instrumentation/go/#distributed-tracing

It could also allow the caller to pass other context-related information into the fill function. It seems like receiving side is possible by providing a custom Context func:
https://github.com/mailgun/groupcache/blob/master/http.go#L74

However, it does not look like there is any way currently to add onto the HTTP client request:
https://github.com/mailgun/groupcache/blob/master/http.go#L244

@thrawn01
Copy link
Contributor

thrawn01 commented Jan 6, 2022

This would be a welcome addition, I'm not sure what is the best way to pass tracing data around, but I suspect it will be via some header in the request.

@thrawn01 thrawn01 added the help wanted Extra attention is needed label Jan 6, 2022
mgale added a commit to mgale/groupcache that referenced this issue Feb 7, 2022
@mgale
Copy link
Author

mgale commented Feb 7, 2022

I create a PR here: #37 which I have not tested yet. Feedback welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants