grafana / grafana/alerting

Make timeouts in the HTTP client configurable

Open
#324 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
89
Forks
74
Avg merge
2d 7h
Merged PRs (30d)
8

Description

The [`NewTLSClient` function](https://github.com/grafana/alerting/blob/3c7640592aa884caf050ca19e515838d402fd6b1/http/tls.go#L10-L31) returns an `*http.Client` with hard-coded timeouts.

```go
return &http.Client{
Timeout: time.Second * 30,
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 5 * time.Second,
},
}
```

We can make these timeouts configurable via arguments, allowing users to tweak these values to their needs.

Contributor guide

Open the contributing guide

Research direction

Start in http/tls.go at NewTLSClient and review the hard-coded HTTP client, dialer, and TLS handshake timeouts shown in the issue. Trace how this function is called, expose the timeout values through its arguments, and verify that callers can configure them without changing the intended defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.