github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/api_metrics_wrappa.go (about) 1 package wrappa 2 3 import ( 4 "code.cloudfoundry.org/lager" 5 "github.com/chenbh/concourse/v6/atc" 6 "github.com/chenbh/concourse/v6/atc/metric" 7 "github.com/tedsuo/rata" 8 ) 9 10 type APIMetricsWrappa struct { 11 logger lager.Logger 12 } 13 14 func NewAPIMetricsWrappa(logger lager.Logger) Wrappa { 15 return APIMetricsWrappa{ 16 logger: logger, 17 } 18 } 19 20 func (wrappa APIMetricsWrappa) Wrap(handlers rata.Handlers) rata.Handlers { 21 wrapped := rata.Handlers{} 22 23 for name, handler := range handlers { 24 switch name { 25 case atc.BuildEvents, atc.DownloadCLI, atc.HijackContainer: 26 wrapped[name] = handler 27 default: 28 wrapped[name] = metric.WrapHandler(wrappa.logger, name, handler) 29 } 30 } 31 32 return wrapped 33 }