github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/test/mock/stats_reporter.go (about) 1 package mock 2 3 import ( 4 "github.com/square/finch/stats" 5 ) 6 7 type StatsReporter struct { 8 ReportFunc func([]stats.Instance) 9 StopFunc func() 10 } 11 12 func (r StatsReporter) Make(name string, opts map[string]string) (stats.Reporter, error) { 13 return r, nil 14 } 15 16 func (r StatsReporter) Report(from []stats.Instance) { 17 if r.ReportFunc != nil { 18 r.ReportFunc(from) 19 } 20 } 21 22 func (r StatsReporter) Stop() { 23 if r.StopFunc != nil { 24 r.StopFunc() 25 } 26 }