[feature-request] Provide an option to set http client options, like headers or maybe update the http req.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 539
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with http.go around the custom Context function at line 74 and the HTTP request at line 244. Trace how the Getter interface's Get function and fill function receive context, then determine how callers could provide request data such as tracing headers before the HTTP request is sent. Done means the requested contextual information can reach both sides without breaking existing usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100