Documentation ¶
Overview ¶
Package http implements a HTTP reporter to send spans to Zipkin V2 collectors.
Index ¶
- func NewReporter(url string, opts ...ReporterOption) reporter.Reporter
- type HTTPDoer
- type ReporterOption
- func BatchInterval(d time.Duration) ReporterOption
- func BatchSize(n int) ReporterOption
- func Client(client HTTPDoer) ReporterOption
- func Logger(l *log.Logger) ReporterOption
- func MaxBacklog(n int) ReporterOption
- func RequestCallback(rc RequestCallbackFn) ReporterOption
- func Serializer(serializer reporter.SpanSerializer) ReporterOption
- func Timeout(duration time.Duration) ReporterOption
- type RequestCallbackFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewReporter ¶
func NewReporter(url string, opts ...ReporterOption) reporter.Reporter
NewReporter returns a new HTTP Reporter. url should be the endpoint to send the spans to, e.g. http://localhost:9411/api/v2/spans
Types ¶
type ReporterOption ¶
type ReporterOption func(r *httpReporter)
ReporterOption sets a parameter for the HTTP Reporter
func BatchInterval ¶
func BatchInterval(d time.Duration) ReporterOption
BatchInterval sets the maximum duration we will buffer traces before emitting them to the collector. The default batch interval is 1 second.
func BatchSize ¶
func BatchSize(n int) ReporterOption
BatchSize sets the maximum batch size, after which a collect will be triggered. The default batch size is 100 traces.
func Client ¶
func Client(client HTTPDoer) ReporterOption
Client sets a custom http client to use under the interface HTTPDoer which includes a `Do` method with same signature as the *http.Client
func Logger ¶
func Logger(l *log.Logger) ReporterOption
Logger sets the logger used to report errors in the collection process.
func MaxBacklog ¶
func MaxBacklog(n int) ReporterOption
MaxBacklog sets the maximum backlog size. When batch size reaches this threshold, spans from the beginning of the batch will be disposed.
func RequestCallback ¶
func RequestCallback(rc RequestCallbackFn) ReporterOption
RequestCallback registers a callback function to adjust the reporter *http.Request before it sends the request to Zipkin.
func Serializer ¶
func Serializer(serializer reporter.SpanSerializer) ReporterOption
Serializer sets the serialization function to use for sending span data to Zipkin.
func Timeout ¶
func Timeout(duration time.Duration) ReporterOption
Timeout sets maximum timeout for the http request through its context.
type RequestCallbackFn ¶
RequestCallbackFn receives the initialized request from the Collector before sending it over the wire. This allows one to plug in additional headers or do other customization.