mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
implement grpc metrics for ceph-csi
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
01a78cace5
commit
a81a3bf96b
@ -18,10 +18,6 @@ package liveness
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ceph/ceph-csi/pkg/util"
|
||||
@ -29,7 +25,6 @@ import (
|
||||
connlib "github.com/kubernetes-csi/csi-lib-utils/connection"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/rpc"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
@ -88,21 +83,9 @@ func recordLiveness(endpoint string, pollTime, timeout time.Duration) {
|
||||
func Run(conf *util.Config) {
|
||||
klog.Infof("Liveness Running")
|
||||
|
||||
ip := os.Getenv("POD_IP")
|
||||
|
||||
if ip == "" {
|
||||
klog.Warning("missing POD_IP env var defaulting to 0.0.0.0")
|
||||
ip = "0.0.0.0"
|
||||
}
|
||||
|
||||
// start liveness collection
|
||||
go recordLiveness(conf.Endpoint, conf.PollTime, conf.PoolTimeout)
|
||||
|
||||
// start up prometheus endpoint
|
||||
addr := net.JoinHostPort(ip, strconv.Itoa(conf.LivenessPort))
|
||||
http.Handle(conf.LivenessPath, promhttp.Handler())
|
||||
err := http.ListenAndServe(addr, nil)
|
||||
if err != nil {
|
||||
klog.Fatalln(err)
|
||||
}
|
||||
util.StartMetricsServer(conf)
|
||||
}
|
||||
|
Reference in New Issue
Block a user