Skip to content

Commit

Permalink
fix nil response panic
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderTreeTech committed Sep 14, 2021
1 parent 9c900fe commit a7da9d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/database/es/stats.go
Expand Up @@ -80,8 +80,11 @@ func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error
} else {
resp, err = http.DefaultTransport.RoundTrip(req)
}

span = span.SetTag("http.status_code", resp.StatusCode)

if resp != nil {
span = span.SetTag("http.status_code", resp.StatusCode)
}

if err != nil {
ext.Error.Set(span, true)
span.LogFields(log.String("event", "error"), log.String("message", err.Error()))
Expand Down

0 comments on commit a7da9d5

Please sign in to comment.