From 7361fd994d18fec2babf47774b0a410b0efd2cc9 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Mon, 20 Jan 2020 18:30:41 +0200 Subject: [PATCH] Antrea Prometheus integration (#236) Integrate with Prometheus monitoring solution. Integration of the Prometheus client into Antrea controller and agent allows the exposure of various metrics to Prometheus server. In addition to Antrea's own set of metrics, Prometheus client will also expose metrics which are defined by various components which are part of the Antrea ecosystem, e.g golang, Prometheus itself etc. --- cmd/antrea-controller/controller.go | 3 +-- pkg/agent/metrics/prometheus.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/antrea-controller/controller.go b/cmd/antrea-controller/controller.go index 06ebb68519a..91e1e7e1f84 100644 --- a/cmd/antrea-controller/controller.go +++ b/cmd/antrea-controller/controller.go @@ -16,7 +16,6 @@ package main import ( "fmt" - "github.com/prometheus/common/log" "net" "net/http" "os" @@ -141,7 +140,7 @@ func createPrometheusMetricsListener(prometheusHost string, err = http.ListenAndServe(net.JoinHostPort(prometheusHost, prometheusPort), nil) if err != nil { - klog.Error("Failed to initialize Prometheus metrics server %v", err) + klog.Errorf("Failed to initialize Prometheus metrics server %v", err) } } diff --git a/pkg/agent/metrics/prometheus.go b/pkg/agent/metrics/prometheus.go index eaf3f11458c..fe4461af30a 100644 --- a/pkg/agent/metrics/prometheus.go +++ b/pkg/agent/metrics/prometheus.go @@ -122,6 +122,6 @@ func StartListener( err = http.ListenAndServe(net.JoinHostPort(prometheusHost, strconv.Itoa(prometheusPort)), nil) if err != nil { - klog.Error("Failed to initialize Prometheus metrics server %v", err) + klog.Errorf("Failed to initialize Prometheus metrics server %v", err) } }