Skip to content

Commit

Permalink
feat(reporter/http): uses an interface for http client so users can p…
Browse files Browse the repository at this point in the history
…lug other clients.
  • Loading branch information
jcchavezs committed Oct 21, 2019
1 parent c29478e commit b4d33f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions reporter/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ const (
defaultMaxBacklog = 1000
)

// Client will do a request to the Zipkin HTTP Collector
type Client interface {
Do(req *http.Request) (*http.Response, error)
}

// httpReporter will send spans to a Zipkin HTTP Collector using Zipkin V2 API.
type httpReporter struct {
url string
client *http.Client
client Client
logger *log.Logger
batchInterval time.Duration
batchSize int
Expand Down Expand Up @@ -200,7 +205,7 @@ func BatchInterval(d time.Duration) ReporterOption {
}

// Client sets a custom http client to use.
func Client(client *http.Client) ReporterOption {
func Client(client Client) ReporterOption {
return func(r *httpReporter) { r.client = client }
}

Expand Down

0 comments on commit b4d33f0

Please sign in to comment.