open-nomad/command/agent/metrics_endpoint.go

17 lines
423 B
Go
Raw Normal View History

package agent
import (
"net/http"
)
func (s *HTTPServer) MetricsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
if req.Method == "GET" {
return s.newMetricsRequest(resp, req)
}
return nil, CodedError(405, ErrInvalidMethod)
}
func (s *HTTPServer) newMetricsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
return s.agent.InmemSink.DisplayMetrics(resp, req)
}