You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-09-16 09:26:25 +02:00
Merge pull request #788 from Aneurysm9/OTG-786
Ensure zipkin exporter reads and closes response body
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -112,6 +113,16 @@ func (e *Exporter) ExportSpans(ctx context.Context, batch []*export.SpanData) {
|
||||
return
|
||||
}
|
||||
e.logf("zipkin responded with status %d", resp.StatusCode)
|
||||
|
||||
_, err = ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
e.logf("failed to read response body: %v", err)
|
||||
}
|
||||
|
||||
err = resp.Body.Close()
|
||||
if err != nil {
|
||||
e.logf("failed to close response body: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Exporter) logf(format string, args ...interface{}) {
|
||||
|
Reference in New Issue
Block a user