Documentation
¶
Overview ¶
Package metriceventstream allows exposing your circuit's health as a metric stream that you can visualize with the hystrix dashboard. Note, you do not have to use hystrix open/close logic to take advantage of this.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricEventStream ¶
type MetricEventStream struct { Manager *circuit.Manager TickDuration time.Duration // contains filtered or unexported fields }
MetricEventStream is a HTTP handler that supports hystrix's metric stream API See https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring#metrics-event-stream. It requires that your metrics are monitored by rolling stats, because it uses them to get health information.
Example ¶
This example creates an event stream handler, starts it, then later closes the handler
// metriceventstream uses rolling stats to report circuit information sf := rolling.StatFactory{} h := circuit.Manager{ DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{sf.CreateConfig}, } es := metriceventstream.MetricEventStream{ Manager: &h, } go func() { if err := es.Start(); err != nil { log.Fatal(err) } }() // ES is a http.Handler, so you can pass it directly to your mux http.Handle("/hystrix.stream", &es) // ... if err := es.Close(); err != nil { log.Fatal(err) }
Output:
func (*MetricEventStream) Close ¶
func (m *MetricEventStream) Close() error
Close ends the Start function
func (*MetricEventStream) ServeHTTP ¶
func (m *MetricEventStream) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP sends a never ending list of metric events
func (*MetricEventStream) Start ¶
func (m *MetricEventStream) Start() error
Start should be called once per MetricEventStream. It runs forever, until Close is called.