Skip to content

Commit

Permalink
[receiver/kubeletstats] refactor receiver to explicitly detail metric…
Browse files Browse the repository at this point in the history
…s emited. (#9517)

* Update metadata.yaml to list all metrics

* Updated accumulator to use new metrics

* Fix import

* Fix lint

* Moved init functions into Types

* Fix lint

* Fix lint

* run goporto

* re-enabled volume metrics
  • Loading branch information
TylerHelmuth authored May 3, 2022
1 parent 4ee1594 commit c2a5704
Show file tree
Hide file tree
Showing 11 changed files with 892 additions and 210 deletions.
80 changes: 62 additions & 18 deletions receiver/kubeletstatsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,71 @@ These are the metrics available for this scraper.

| Name | Description | Unit | Type | Attributes |
| ---- | ----------- | ---- | ---- | ---------- |
| **cpu.time** | CPU time | s | Sum(Double) | <ul> </ul> |
| **cpu.utilization** | CPU utilization | 1 | Gauge(Double) | <ul> </ul> |
| **filesystem.available** | Filesystem available | By | Gauge(Int) | <ul> </ul> |
| **filesystem.capacity** | Filesystem capacity | By | Gauge(Int) | <ul> </ul> |
| **filesystem.usage** | Filesystem usage | By | Gauge(Int) | <ul> </ul> |
| **memory.available** | Memory available | By | Gauge(Int) | <ul> </ul> |
| **memory.major_page_faults** | Memory major_page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **memory.page_faults** | Memory page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **memory.rss** | Memory rss | By | Gauge(Int) | <ul> </ul> |
| **memory.usage** | Memory usage | By | Gauge(Int) | <ul> </ul> |
| **memory.working_set** | Memory working_set | By | Gauge(Int) | <ul> </ul> |
| **network.errors** | Network errors | 1 | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **network.io** | Network IO | By | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **volume.available** | The number of available bytes in the volume. | By | Gauge(Int) | <ul> </ul> |
| **volume.capacity** | The total capacity in bytes of the volume. | By | Gauge(Int) | <ul> </ul> |
| **volume.inodes** | The total inodes in the filesystem. | 1 | Gauge(Int) | <ul> </ul> |
| **volume.inodes.free** | The free inodes in the filesystem. | 1 | Gauge(Int) | <ul> </ul> |
| **volume.inodes.used** | The inodes used by the filesystem. This may not equal inodes - free because filesystem may share inodes with other filesystems. | 1 | Gauge(Int) | <ul> </ul> |
| **container.cpu.time** | Container CPU time | s | Sum(Double) | <ul> </ul> |
| **container.cpu.utilization** | Container CPU utilization | 1 | Gauge(Double) | <ul> </ul> |
| **container.filesystem.available** | Container filesystem available | By | Gauge(Int) | <ul> </ul> |
| **container.filesystem.capacity** | Container filesystem capacity | By | Gauge(Int) | <ul> </ul> |
| **container.filesystem.usage** | Container filesystem usage | By | Gauge(Int) | <ul> </ul> |
| **container.memory.available** | Container memory available | By | Gauge(Int) | <ul> </ul> |
| **container.memory.major_page_faults** | Container memory major_page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **container.memory.page_faults** | Container memory page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **container.memory.rss** | Container memory rss | By | Gauge(Int) | <ul> </ul> |
| **container.memory.usage** | Container memory usage | By | Gauge(Int) | <ul> </ul> |
| **container.memory.working_set** | Container memory working_set | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.cpu.time** | Node CPU time | s | Sum(Double) | <ul> </ul> |
| **k8s.node.cpu.utilization** | Node CPU utilization | 1 | Gauge(Double) | <ul> </ul> |
| **k8s.node.filesystem.available** | Node filesystem available | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.filesystem.capacity** | Node filesystem capacity | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.filesystem.usage** | Node filesystem usage | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.available** | Node memory available | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.major_page_faults** | Node memory major_page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.page_faults** | Node memory page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.rss** | Node memory rss | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.usage** | Node memory usage | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.memory.working_set** | Node memory working_set | By | Gauge(Int) | <ul> </ul> |
| **k8s.node.network.errors** | Node network errors | 1 | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **k8s.node.network.io** | Node network IO | By | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **k8s.pod.cpu.time** | Pod CPU time | s | Sum(Double) | <ul> </ul> |
| **k8s.pod.cpu.utilization** | Pod CPU utilization | 1 | Gauge(Double) | <ul> </ul> |
| **k8s.pod.filesystem.available** | Pod filesystem available | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.filesystem.capacity** | Pod filesystem capacity | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.filesystem.usage** | Pod filesystem usage | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.available** | Pod memory available | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.major_page_faults** | Pod memory major_page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.page_faults** | Pod memory page_faults | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.rss** | Pod memory rss | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.usage** | Pod memory usage | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.memory.working_set** | Pod memory working_set | By | Gauge(Int) | <ul> </ul> |
| **k8s.pod.network.errors** | Pod network errors | 1 | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **k8s.pod.network.io** | Pod network IO | By | Sum(Int) | <ul> <li>interface</li> <li>direction</li> </ul> |
| **k8s.volume.available** | The number of available bytes in the volume. | By | Gauge(Int) | <ul> </ul> |
| **k8s.volume.capacity** | The total capacity in bytes of the volume. | By | Gauge(Int) | <ul> </ul> |
| **k8s.volume.inodes** | The total inodes in the filesystem. | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.volume.inodes.free** | The free inodes in the filesystem. | 1 | Gauge(Int) | <ul> </ul> |
| **k8s.volume.inodes.used** | The inodes used by the filesystem. This may not equal inodes - free because filesystem may share inodes with other filesystems. | 1 | Gauge(Int) | <ul> </ul> |

**Highlighted metrics** are emitted by default.

## Resource attributes

| Name | Description | Type |
| ---- | ----------- | ---- |
| aws.volume.id | The id of the AWS Volume | String |
| container.id | Container id used to identify container | String |
| container.name | Container name used by container runtime | String |
| fs.type | The filesystem type of the Volume | String |
| gce.pd.name | The name of the persistent disk in GCE | String |
| glusterfs.endpoints.name | The endpoint name that details Glusterfs topology | String |
| glusterfs.path | Glusterfs volume path | String |
| k8s.namespace.name | The name of the namespace that the pod is running in | String |
| k8s.node.name | The name of the Node | String |
| k8s.persistentvolumeclaim.name | The name of the Persistent Volume Claim | String |
| k8s.pod.name | The name of the Pod | String |
| k8s.pod.uid | The UID of the Pod | String |
| k8s.volume.name | The name of the Volume | String |
| k8s.volume.type | The type of the Volume | String |
| partition | The partition in the Volume | String |

## Metric attributes

| Name | Description | Values |
Expand Down
32 changes: 15 additions & 17 deletions receiver/kubeletstatsreceiver/internal/kubelet/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"
stats "k8s.io/kubelet/pkg/apis/stats/v1alpha1"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

type MetricGroup string
Expand Down Expand Up @@ -50,11 +52,7 @@ type metricDataAccumulator struct {
}

const (
k8sPrefix = "k8s."
nodePrefix = k8sPrefix + "node."
podPrefix = k8sPrefix + "pod."
containerPrefix = "container."
scopeName = "otelcol/kubeletstatsreceiver"
scopeName = "otelcol/kubeletstatsreceiver"
)

func (a *metricDataAccumulator) nodeStats(s stats.NodeStats) {
Expand All @@ -71,10 +69,10 @@ func (a *metricDataAccumulator) nodeStats(s stats.NodeStats) {

startTime := pcommon.NewTimestampFromTime(s.StartTime.Time)
currentTime := pcommon.NewTimestampFromTime(a.time)
addCPUMetrics(ilm.Metrics(), nodePrefix, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), nodePrefix, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), nodePrefix, s.Fs, currentTime)
addNetworkMetrics(ilm.Metrics(), nodePrefix, s.Network, startTime, currentTime)
addCPUMetrics(ilm.Metrics(), metadata.NodeCPUMetrics, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), metadata.NodeMemoryMetrics, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), metadata.NodeFilesystemMetrics, s.Fs, currentTime)
addNetworkMetrics(ilm.Metrics(), metadata.NodeNetworkMetrics, s.Network, startTime, currentTime)
// todo s.Runtime.ImageFs

a.m = append(a.m, md)
Expand All @@ -94,10 +92,10 @@ func (a *metricDataAccumulator) podStats(s stats.PodStats) {

startTime := pcommon.NewTimestampFromTime(s.StartTime.Time)
currentTime := pcommon.NewTimestampFromTime(a.time)
addCPUMetrics(ilm.Metrics(), podPrefix, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), podPrefix, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), podPrefix, s.EphemeralStorage, currentTime)
addNetworkMetrics(ilm.Metrics(), podPrefix, s.Network, startTime, currentTime)
addCPUMetrics(ilm.Metrics(), metadata.PodCPUMetrics, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), metadata.PodMemoryMetrics, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), metadata.PodFilesystemMetrics, s.EphemeralStorage, currentTime)
addNetworkMetrics(ilm.Metrics(), metadata.PodNetworkMetrics, s.Network, startTime, currentTime)

a.m = append(a.m, md)
}
Expand All @@ -124,9 +122,9 @@ func (a *metricDataAccumulator) containerStats(sPod stats.PodStats, s stats.Cont

startTime := pcommon.NewTimestampFromTime(s.StartTime.Time)
currentTime := pcommon.NewTimestampFromTime(a.time)
addCPUMetrics(ilm.Metrics(), containerPrefix, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), containerPrefix, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), containerPrefix, s.Rootfs, currentTime)
addCPUMetrics(ilm.Metrics(), metadata.ContainerCPUMetrics, s.CPU, startTime, currentTime)
addMemoryMetrics(ilm.Metrics(), metadata.ContainerMemoryMetrics, s.Memory, currentTime)
addFilesystemMetrics(ilm.Metrics(), metadata.ContainerFilesystemMetrics, s.Rootfs, currentTime)
a.m = append(a.m, md)
}

Expand All @@ -151,6 +149,6 @@ func (a *metricDataAccumulator) volumeStats(sPod stats.PodStats, s stats.VolumeS
ilm.Scope().SetName(scopeName)

currentTime := pcommon.NewTimestampFromTime(a.time)
addVolumeMetrics(ilm.Metrics(), k8sPrefix, s, currentTime)
addVolumeMetrics(ilm.Metrics(), metadata.K8sVolumeMetrics, s, currentTime)
a.m = append(a.m, md)
}
14 changes: 7 additions & 7 deletions receiver/kubeletstatsreceiver/internal/kubelet/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func addCPUMetrics(dest pmetric.MetricSlice, prefix string, s *stats.CPUStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func addCPUMetrics(dest pmetric.MetricSlice, cpuMetrics metadata.CPUMetrics, s *stats.CPUStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
if s == nil {
return
}
addCPUUsageMetric(dest, prefix, s, currentTime)
addCPUTimeMetric(dest, prefix, s, startTime, currentTime)
addCPUUsageMetric(dest, cpuMetrics.Utilization, s, currentTime)
addCPUTimeMetric(dest, cpuMetrics.Time, s, startTime, currentTime)
}

func addCPUUsageMetric(dest pmetric.MetricSlice, prefix string, s *stats.CPUStats, currentTime pcommon.Timestamp) {
func addCPUUsageMetric(dest pmetric.MetricSlice, metricInt metadata.MetricIntf, s *stats.CPUStats, currentTime pcommon.Timestamp) {
if s.UsageNanoCores == nil {
return
}
value := float64(*s.UsageNanoCores) / 1_000_000_000
fillDoubleGauge(dest.AppendEmpty(), prefix, metadata.M.CPUUtilization, value, currentTime)
fillDoubleGauge(dest.AppendEmpty(), metricInt, value, currentTime)
}

func addCPUTimeMetric(dest pmetric.MetricSlice, prefix string, s *stats.CPUStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func addCPUTimeMetric(dest pmetric.MetricSlice, metricInt metadata.MetricIntf, s *stats.CPUStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
if s.UsageCoreNanoSeconds == nil {
return
}
value := float64(*s.UsageCoreNanoSeconds) / 1_000_000_000
fillDoubleSum(dest.AppendEmpty(), prefix, metadata.M.CPUTime, value, startTime, currentTime)
fillDoubleSum(dest.AppendEmpty(), metricInt, value, startTime, currentTime)
}
8 changes: 4 additions & 4 deletions receiver/kubeletstatsreceiver/internal/kubelet/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func addFilesystemMetrics(dest pmetric.MetricSlice, prefix string, s *stats.FsStats, currentTime pcommon.Timestamp) {
func addFilesystemMetrics(dest pmetric.MetricSlice, filesystemMetrics metadata.FilesystemMetrics, s *stats.FsStats, currentTime pcommon.Timestamp) {
if s == nil {
return
}

addIntGauge(dest, prefix, metadata.M.FilesystemAvailable, s.AvailableBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.FilesystemCapacity, s.CapacityBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.FilesystemUsage, s.UsedBytes, currentTime)
addIntGauge(dest, filesystemMetrics.Available, s.AvailableBytes, currentTime)
addIntGauge(dest, filesystemMetrics.Capacity, s.CapacityBytes, currentTime)
addIntGauge(dest, filesystemMetrics.Usage, s.UsedBytes, currentTime)
}
14 changes: 7 additions & 7 deletions receiver/kubeletstatsreceiver/internal/kubelet/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func addMemoryMetrics(dest pmetric.MetricSlice, prefix string, s *stats.MemoryStats, currentTime pcommon.Timestamp) {
func addMemoryMetrics(dest pmetric.MetricSlice, memoryMetrics metadata.MemoryMetrics, s *stats.MemoryStats, currentTime pcommon.Timestamp) {
if s == nil {
return
}

addIntGauge(dest, prefix, metadata.M.MemoryAvailable, s.AvailableBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.MemoryUsage, s.UsageBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.MemoryRss, s.RSSBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.MemoryWorkingSet, s.WorkingSetBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.MemoryPageFaults, s.PageFaults, currentTime)
addIntGauge(dest, prefix, metadata.M.MemoryMajorPageFaults, s.MajorPageFaults, currentTime)
addIntGauge(dest, memoryMetrics.Available, s.AvailableBytes, currentTime)
addIntGauge(dest, memoryMetrics.Usage, s.UsageBytes, currentTime)
addIntGauge(dest, memoryMetrics.Rss, s.RSSBytes, currentTime)
addIntGauge(dest, memoryMetrics.WorkingSet, s.WorkingSetBytes, currentTime)
addIntGauge(dest, memoryMetrics.PageFaults, s.PageFaults, currentTime)
addIntGauge(dest, memoryMetrics.MajorPageFaults, s.MajorPageFaults, currentTime)
}
16 changes: 7 additions & 9 deletions receiver/kubeletstatsreceiver/internal/kubelet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,33 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func addNetworkMetrics(dest pmetric.MetricSlice, prefix string, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func addNetworkMetrics(dest pmetric.MetricSlice, networkMetrics metadata.NetworkMetrics, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
if s == nil {
return
}
addNetworkIOMetric(dest, prefix, s, startTime, currentTime)
addNetworkErrorsMetric(dest, prefix, s, startTime, currentTime)
addNetworkIOMetric(dest, networkMetrics.IO, s, startTime, currentTime)
addNetworkErrorsMetric(dest, networkMetrics.Errors, s, startTime, currentTime)
}

func addNetworkIOMetric(dest pmetric.MetricSlice, prefix string, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func addNetworkIOMetric(dest pmetric.MetricSlice, metricInt metadata.MetricIntf, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
if s.RxBytes == nil && s.TxBytes == nil {
return
}

m := dest.AppendEmpty()
metadata.M.NetworkIo.Init(m)
m.SetName(prefix + m.Name())
metricInt.Init(m)

fillNetworkDataPoint(m.Sum().DataPoints(), s.Name, metadata.AttributeDirection.Receive, s.RxBytes, startTime, currentTime)
fillNetworkDataPoint(m.Sum().DataPoints(), s.Name, metadata.AttributeDirection.Transmit, s.TxBytes, startTime, currentTime)
}

func addNetworkErrorsMetric(dest pmetric.MetricSlice, prefix string, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func addNetworkErrorsMetric(dest pmetric.MetricSlice, metricInt metadata.MetricIntf, s *stats.NetworkStats, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
if s.RxBytes == nil && s.TxBytes == nil {
return
}

m := dest.AppendEmpty()
metadata.M.NetworkErrors.Init(m)
m.SetName(prefix + m.Name())
metricInt.Init(m)

fillNetworkDataPoint(m.Sum().DataPoints(), s.Name, metadata.AttributeDirection.Receive, s.RxErrors, startTime, currentTime)
fillNetworkDataPoint(m.Sum().DataPoints(), s.Name, metadata.AttributeDirection.Transmit, s.TxErrors, startTime, currentTime)
Expand Down
13 changes: 5 additions & 8 deletions receiver/kubeletstatsreceiver/internal/kubelet/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,29 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func fillDoubleGauge(dest pmetric.Metric, prefix string, metricInt metadata.MetricIntf, value float64, currentTime pcommon.Timestamp) {
func fillDoubleGauge(dest pmetric.Metric, metricInt metadata.MetricIntf, value float64, currentTime pcommon.Timestamp) {
metricInt.Init(dest)
dest.SetName(prefix + dest.Name())
dp := dest.Gauge().DataPoints().AppendEmpty()
dp.SetDoubleVal(value)
dp.SetTimestamp(currentTime)
}

func addIntGauge(dest pmetric.MetricSlice, prefix string, metricInt metadata.MetricIntf, value *uint64, currentTime pcommon.Timestamp) {
func addIntGauge(dest pmetric.MetricSlice, metricInt metadata.MetricIntf, value *uint64, currentTime pcommon.Timestamp) {
if value == nil {
return
}
fillIntGauge(dest.AppendEmpty(), prefix, metricInt, int64(*value), currentTime)
fillIntGauge(dest.AppendEmpty(), metricInt, int64(*value), currentTime)
}

func fillIntGauge(dest pmetric.Metric, prefix string, metricInt metadata.MetricIntf, value int64, currentTime pcommon.Timestamp) {
func fillIntGauge(dest pmetric.Metric, metricInt metadata.MetricIntf, value int64, currentTime pcommon.Timestamp) {
metricInt.Init(dest)
dest.SetName(prefix + dest.Name())
dp := dest.Gauge().DataPoints().AppendEmpty()
dp.SetIntVal(value)
dp.SetTimestamp(currentTime)
}

func fillDoubleSum(dest pmetric.Metric, prefix string, metricInt metadata.MetricIntf, value float64, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
func fillDoubleSum(dest pmetric.Metric, metricInt metadata.MetricIntf, value float64, startTime pcommon.Timestamp, currentTime pcommon.Timestamp) {
metricInt.Init(dest)
dest.SetName(prefix + dest.Name())
dp := dest.Sum().DataPoints().AppendEmpty()
dp.SetDoubleVal(value)
dp.SetStartTimestamp(startTime)
Expand Down
12 changes: 6 additions & 6 deletions receiver/kubeletstatsreceiver/internal/kubelet/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver/internal/metadata"
)

func addVolumeMetrics(dest pmetric.MetricSlice, prefix string, s stats.VolumeStats, currentTime pcommon.Timestamp) {
addIntGauge(dest, prefix, metadata.M.VolumeAvailable, s.AvailableBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.VolumeCapacity, s.CapacityBytes, currentTime)
addIntGauge(dest, prefix, metadata.M.VolumeInodes, s.Inodes, currentTime)
addIntGauge(dest, prefix, metadata.M.VolumeInodesFree, s.InodesFree, currentTime)
addIntGauge(dest, prefix, metadata.M.VolumeInodesUsed, s.InodesUsed, currentTime)
func addVolumeMetrics(dest pmetric.MetricSlice, volumeMetrics metadata.VolumeMetrics, s stats.VolumeStats, currentTime pcommon.Timestamp) {
addIntGauge(dest, volumeMetrics.Available, s.AvailableBytes, currentTime)
addIntGauge(dest, volumeMetrics.Capacity, s.CapacityBytes, currentTime)
addIntGauge(dest, volumeMetrics.Inodes, s.Inodes, currentTime)
addIntGauge(dest, volumeMetrics.InodesFree, s.InodesFree, currentTime)
addIntGauge(dest, volumeMetrics.InodesUsed, s.InodesUsed, currentTime)
}

func getLabelsFromVolume(volume v1.Volume, labels map[string]string) {
Expand Down
Loading

0 comments on commit c2a5704

Please sign in to comment.