mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 21:27:42 +00:00
measure reddit latency when we finish reading the body
This commit is contained in:
parent
102cbb2ee2
commit
4e453e0db2
1 changed files with 1 additions and 1 deletions
|
@ -149,7 +149,6 @@ func (rc *Client) doRequest(ctx context.Context, r *Request) ([]byte, *RateLimit
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
_ = rc.statsd.Incr("reddit.api.calls", r.tags, 0.1)
|
_ = rc.statsd.Incr("reddit.api.calls", r.tags, 0.1)
|
||||||
_ = rc.statsd.Histogram("reddit.api.latency", float64(time.Since(start).Milliseconds()), r.tags, 0.1)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = rc.statsd.Incr("reddit.api.errors", r.tags, 0.1)
|
_ = rc.statsd.Incr("reddit.api.errors", r.tags, 0.1)
|
||||||
|
@ -170,6 +169,7 @@ func (rc *Client) doRequest(ctx context.Context, r *Request) ([]byte, *RateLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
bb, err := ioutil.ReadAll(resp.Body)
|
bb, err := ioutil.ReadAll(resp.Body)
|
||||||
|
_ = rc.statsd.Histogram("reddit.api.latency", float64(time.Since(start).Milliseconds()), r.tags, 0.1)
|
||||||
|
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case 200:
|
case 200:
|
||||||
|
|
Loading…
Reference in a new issue