Skip to content

Commit 0e1452a

Browse files
committed
Add a /metrics endpoint for the server
This is for prometheus integration Signed-off-by: Mrunal Patel <[email protected]>
1 parent 4310e6d commit 0e1452a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+12803
-7
lines changed

server/server.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"io/ioutil"
77
"net"
8+
"net/http"
89
"os"
910
"sync"
1011

@@ -16,6 +17,7 @@ import (
1617
"github.com/kubernetes-incubator/cri-o/server/apparmor"
1718
"github.com/kubernetes-incubator/cri-o/server/seccomp"
1819
"github.com/pkg/errors"
20+
"github.com/prometheus/client_golang/prometheus"
1921
"github.com/sirupsen/logrus"
2022
knet "k8s.io/apimachinery/pkg/util/net"
2123
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
@@ -276,3 +278,11 @@ func (s *Server) getPodSandboxFromRequest(podSandboxID string) (*sandbox.Sandbox
276278
}
277279
return sb, nil
278280
}
281+
282+
// CreateMetricsEndpoint creates a /metrics endpoint
283+
// for prometheus monitoring
284+
func (s *Server) CreateMetricsEndpoint() (*http.ServeMux, error) {
285+
mux := &http.ServeMux{}
286+
mux.Handle("/metrics", prometheus.Handler())
287+
return mux, nil
288+
}

vendor.conf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ golang.org/x/sys 4cd6d1a821c7175768725b55ca82f14683a29ea4
5757
golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756
5858
github.com/kr/pty v1.0.0
5959
github.com/gogo/protobuf v0.3
60-
github.com/golang/protobuf 8ee79997227bf9b34611aee7946ae64735e6fd93
60+
github.com/golang/protobuf 748d386b5c1ea99658fd69fe9f03991ce86a90c1
6161
github.com/coreos/go-systemd v14
6262
github.com/coreos/pkg v3
6363
github.com/golang/groupcache b710c8433bd175204919eb38776e944233235d03
@@ -71,3 +71,9 @@ github.com/godbus/dbus v4.0.0
7171
github.com/urfave/cli v1.19.1
7272
github.com/vbatts/tar-split v0.10.1
7373
github.com/renstrom/dedent v1.0.0
74+
github.com/prometheus/client_golang v0.8.0
75+
github.com/prometheus/procfs e645f4e5aaa8506fc71d6edbc5c4ff02c04c46f2
76+
github.com/prometheus/common 61f87aac8082fa8c3c5655c7608d7478d46ac2ad
77+
github.com/prometheus/client_model 6f3806018612930941127f2a7c6c453ba2c527d2
78+
github.com/matttproud/golang_protobuf_extensions v1.0.0
79+
github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9

vendor/github.com/beorn7/perks/LICENSE

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/beorn7/perks/README.md

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/beorn7/perks/quantile/stream.go

Lines changed: 292 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)