Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(metric): Add VFP counter metric for uninitialized object #958

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.CreatePrometheusGaugeVecForMetric(
exporter.DefaultRegistry,
vfpStats,
vfpStatsDescription,
utils.State,
)
NodeConnectivityStatusGauge = exporter.CreatePrometheusGaugeVecForMetric(
exporter.DefaultRegistry,
utils.NodeConnectivityStatusName,
Expand Down
6 changes: 5 additions & 1 deletion pkg/metrics/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -56,7 +58,9 @@ var (
ForwardPacketsGauge GaugeVec
ForwardBytesGauge GaugeVec

WindowsGauge GaugeVec
// Windows
HNSStatsGauge GaugeVec
VFPStatsGauge GaugeVec

// Common gauges across os distributions
NodeConnectivityStatusGauge GaugeVec
Expand Down
7 changes: 4 additions & 3 deletions pkg/plugin/windows/hnsstats/hnsstats_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,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
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/attr_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const (
unknown = "__uknown__"
unknown = "__unknown__"
)

var (
Expand Down Expand Up @@ -49,6 +49,7 @@ var (
AclRule = "aclrule"
Active = "ACTIVE"
Device = "device"
Uninitialized = "uninitialized"

// TCP Connection Statistic Names
ResetCount = "ResetCount"
Expand Down
Loading