Add a /metrics endpoint for the server
This is for prometheus integration Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
4310e6d86f
commit
0e1452a4ec
79 changed files with 12803 additions and 7 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
|
@ -16,6 +17,7 @@ import (
|
|||
"github.com/kubernetes-incubator/cri-o/server/apparmor"
|
||||
"github.com/kubernetes-incubator/cri-o/server/seccomp"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
knet "k8s.io/apimachinery/pkg/util/net"
|
||||
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
||||
|
@ -276,3 +278,11 @@ func (s *Server) getPodSandboxFromRequest(podSandboxID string) (*sandbox.Sandbox
|
|||
}
|
||||
return sb, nil
|
||||
}
|
||||
|
||||
// CreateMetricsEndpoint creates a /metrics endpoint
|
||||
// for prometheus monitoring
|
||||
func (s *Server) CreateMetricsEndpoint() (*http.ServeMux, error) {
|
||||
mux := &http.ServeMux{}
|
||||
mux.Handle("/metrics", prometheus.Handler())
|
||||
return mux, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue