diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index bed09d4623..ce6c0a3513 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -40,12 +40,18 @@ func InitializeMetrics() { utils.ForwardBytesGaugeName, forwardBytesGaugeDescription, utils.Direction) - WindowsGauge = exporter.CreatePrometheusGaugeVecForMetric( + HNSStatsGauge = exporter.CreatePrometheusGaugeVecForMetric( exporter.DefaultRegistry, hnsStats, hnsStatsDescription, utils.Direction, ) + VFPStatsGauge = exporter.CreatePrometheusCounterVecForMetric( + exporter.DefaultRegistry, + vfpStats, + vfpStatsDescription, + utils.State, + ) NodeConnectivityStatusGauge = exporter.CreatePrometheusGaugeVecForMetric( exporter.DefaultRegistry, utils.NodeConnectivityStatusName, diff --git a/pkg/metrics/types.go b/pkg/metrics/types.go index cff5c28884..681fc03556 100644 --- a/pkg/metrics/types.go +++ b/pkg/metrics/types.go @@ -16,6 +16,8 @@ const ( // Windows hnsStats = "windows_hns_stats" hnsStatsDescription = "Include many different metrics from packets sent/received to closed connections" + vfpStats = "windows_vfp_stats" + vfpStatsDescription = "Include many different metrics from packets sent/received to closed connections" // Linux only metrics (for now). nodeApiServerHandshakeLatencyHistName = "node_apiserver_handshake_latency_ms" @@ -56,7 +58,9 @@ var ( ForwardPacketsGauge GaugeVec ForwardBytesGauge GaugeVec - WindowsGauge GaugeVec + // Windows + HNSStatsGauge GaugeVec + VFPStatsGauge CounterVec // Common gauges across os distributions NodeConnectivityStatusGauge GaugeVec diff --git a/pkg/plugin/windows/hnsstats/hnsstats_windows.go b/pkg/plugin/windows/hnsstats/hnsstats_windows.go index 09ca584f96..5fae2e75de 100644 --- a/pkg/plugin/windows/hnsstats/hnsstats_windows.go +++ b/pkg/plugin/windows/hnsstats/hnsstats_windows.go @@ -159,14 +159,15 @@ func notifyHnsStats(h *hnsstats, stats *HnsStatsData) { metrics.ForwardBytesGauge.WithLabelValues(ingressLabel).Set(float64(stats.hnscounters.BytesReceived)) h.l.Debug("emitting bytes received count metric", zap.Uint64(BytesReceived, stats.hnscounters.BytesReceived)) - metrics.WindowsGauge.WithLabelValues(PacketsReceived).Set(float64(stats.hnscounters.PacketsReceived)) - metrics.WindowsGauge.WithLabelValues(PacketsSent).Set(float64(stats.hnscounters.PacketsSent)) + metrics.HNSStatsGauge.WithLabelValues(PacketsReceived).Set(float64(stats.hnscounters.PacketsReceived)) + metrics.HNSStatsGauge.WithLabelValues(PacketsSent).Set(float64(stats.hnscounters.PacketsSent)) metrics.DropPacketsGauge.WithLabelValues(utils.Endpoint, egressLabel).Set(float64(stats.hnscounters.DroppedPacketsOutgoing)) metrics.DropPacketsGauge.WithLabelValues(utils.Endpoint, ingressLabel).Set(float64(stats.hnscounters.DroppedPacketsIncoming)) if stats.vfpCounters == nil { - h.l.Warn("will not record some metrics since VFP port counters failed to be set") + metrics.VFPStatsGauge.WithLabelValues(utils.Uninitialized).Inc() + h.l.Debug("will not record some metrics since VFP port counters failed to be set") return } diff --git a/pkg/utils/attr_utils.go b/pkg/utils/attr_utils.go index 9d102dc9d7..7bd667a473 100644 --- a/pkg/utils/attr_utils.go +++ b/pkg/utils/attr_utils.go @@ -7,7 +7,7 @@ import ( ) const ( - unknown = "__uknown__" + unknown = "__unknown__" ) var ( @@ -49,6 +49,7 @@ var ( AclRule = "aclrule" Active = "ACTIVE" Device = "device" + Uninitialized = "uninitialized" // TCP Connection Statistic Names ResetCount = "ResetCount"