// Handler represents a type which can register itself with a router for
// http routing, and a Recorder for trace data collection.
typeHandlerinterface{
Register(router*mux.Router,recorderRecorder)error
}
constsampleConfig=`
#path="/api/v1/spans"#URLpathforspandata
#port=9411#PortonwhichTelegraflistens
`
// Zipkin is a telegraf configuration structure for the zipkin input plugin,
// but it also contains fields for the management of a separate, concurrent
// zipkin http server
typeZipkinstruct{
ServiceAddressstring
Portint
Pathstring
addressstring
handlerHandler
server*http.Server
waitGroup*sync.WaitGroup
}
// Description is a necessary method implementation from telegraf.ServiceInput
func(zZipkin)Description()string{
return"This plugin implements the Zipkin http server to gather trace and timing data needed to troubleshoot latency problems in microservice architectures."
}
// SampleConfig is a necessary method implementation from telegraf.ServiceInput
func(zZipkin)SampleConfig()string{
returnsampleConfig
}
// Gather is empty for the zipkin plugin; all gathering is done through
// the separate goroutine launched in (*Zipkin).Start()