Skip to content

Commit 7fc0876

Browse files
committed
fix: from NetworkRxBytes. PVIOStats will include Namespace
1 parent f644669 commit 7fc0876

4 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
163163
- **eBPF build constraints**: Restored `//go:build linux` and `//go:build !linux` constraints to all 9 eBPF package files after bulk header replacement had stripped them
164164
- `types.go`, `gen.go`, `loader.go`, `helpers.go`, `config_linux.go`, `linux.go`, `hubble_linux.go``//go:build linux`
165165
- `linux_other.go`, `hubble_other.go``//go:build !linux`
166+
- **Node network rx drop not synced** (`internal/collector/kubernetes/nodes.go`): `NodeState.NetworkRxDrop` field was declared but never populated during collection — now assigned from `totalRxDrop` alongside `NetworkRxBytes` and `NetworkTxBytes` in the Kubelet summary scrape loop
167+
- **PV I/O stats missing namespace** (`internal/collector/kubernetes/storage.go`): `PVIOStats` now includes `Namespace` from the PV's `ClaimRef`, enabling the platform backend to filter and group PV I/O data per namespace in dashboards and alerting rules
166168

167169
### Changed
168170

@@ -171,6 +173,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
171173
- **All config files updated** (`configs/`, `deploy/`): Added extended K8s metrics fields (`apiserver_metrics`, `coredns_metrics`, `container_extended_metrics`, `pv_io_stats`) to all config variants — `configs/tfo-agent.yaml`, `configs/tfo-agent.default.yaml`, `configs/tfo-agent-one-for-all.yaml`, `deploy/helm/values.yaml`, `deploy/helm/values-one-for-all.yaml`, `deploy/kubernetes/configmap.yaml`
172174
- **K8s config**: Added `network_policies: true` to all config files under `collectors.kubernetes`
173175
- **`ClusterState` type**: Added `NetworkPolicies []NetworkPolicyState` field for platform sync
176+
- **`NodeState` type**: Added `NetworkRxDrop *uint64` field for cumulative network receive drops/errors from Kubelet summary
177+
- **`PVIOStats` type**: Added `Namespace string` field sourced from PV ClaimRef for per-namespace filtering
174178
- **RBAC ClusterRole**: Added `networkpolicies` (networking.k8s.io) resource permission for NetworkPolicy collector
175179

176180
### Dependencies

internal/collector/kubernetes/nodes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ func collectNodes(
269269
}
270270
state.NetworkRxBytes = &totalRx
271271
state.NetworkTxBytes = &totalTx
272+
state.NetworkRxDrop = &totalRxDrop
272273
totalIO := totalRx + totalTx
273274
metrics = append(metrics,
274275
collector.NewMetric("k8s.node.network.io", float64(totalIO), collector.MetricTypeGauge).

internal/collector/kubernetes/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func buildPVIOStats(pvStates []PVState, pvcData []pvcVolumeData) []PVIOStats {
371371
if !ok {
372372
continue
373373
}
374-
stat := PVIOStats{PVName: pv.Name}
374+
stat := PVIOStats{PVName: pv.Name, Namespace: pv.ClaimRef.Namespace}
375375
stat.UsedBytes = pd.usedBytes
376376
stat.CapacityBytes = pd.capacityBytes
377377
stat.AvailableBytes = pd.availableBytes

internal/collector/kubernetes/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ type ClusterState struct {
144144
// The agent maps PVC volume usage data to the corresponding PV name using ClaimRef.
145145
type PVIOStats struct {
146146
PVName string `json:"pv_name"`
147+
Namespace string `json:"namespace,omitempty"`
147148
UsedBytes *int64 `json:"used_bytes,omitempty"`
148149
CapacityBytes *int64 `json:"capacity_bytes,omitempty"`
149150
InodesUsed *int64 `json:"inodes_used,omitempty"`
@@ -223,6 +224,7 @@ type NodeState struct {
223224
ImageFSCapacityBytes *uint64 `json:"image_fs_capacity_bytes,omitempty"` // container image fs capacity (Kubelet summary)
224225
NetworkRxBytes *uint64 `json:"network_rx_bytes,omitempty"` // cumulative network rx bytes (Kubelet summary)
225226
NetworkTxBytes *uint64 `json:"network_tx_bytes,omitempty"` // cumulative network tx bytes (Kubelet summary)
227+
NetworkRxDrop *uint64 `json:"network_rx_drop,omitempty"` // cumulative network rx drops/errors (Kubelet summary)
226228
InternalIP string `json:"internal_ip,omitempty"`
227229
ExternalIP string `json:"external_ip,omitempty"`
228230
Taints []TaintState `json:"taints,omitempty"`

0 commit comments

Comments
 (0)