Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KlwntSingh committed Feb 22, 2024
1 parent 2a60088 commit d6d3176
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type MemoryStat struct {
type FileSystemStat struct {
Time time.Time
Name string
Device string
Type string
AvailableBytes uint64
CapacityBytes uint64
UsedBytes uint64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ func (f *FileSystemMetricExtractor) GetValue(rawMetric RawMetric, _ cExtractor.C
for _, v := range rawMetric.FileSystemStats {
metric := cExtractor.NewCadvisorMetric(containerType, f.logger)

if v.Name != "" {
metric.AddTag(ci.DiskDev, v.Name)
}
metric.AddTag(ci.DiskDev, v.Device)
metric.AddTag(ci.FSType, v.Type)

metric.AddField(ci.MetricName(containerType, ci.FSUsage), v.UsedBytes)
metric.AddField(ci.MetricName(containerType, ci.FSCapacity), v.CapacityBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ func TestFSStats(t *testing.T) {
"node_filesystem_utilization": float64(40.358791544917224),
}
expectedTags := map[string]string{
"Type": "NodeFS",
"fstype": "",
"device": "",
"Type": "NodeFS",
}
cExtractor.AssertContainsTaggedField(t, cMetrics[0], expectedFields, expectedTags)

Expand Down Expand Up @@ -66,7 +68,8 @@ func TestFSStats(t *testing.T) {
"container_filesystem_utilization": float64(0.3955174875484043),
}
expectedTags = map[string]string{
"device": "rootfs",
"fstype": "",
"device": "",
"Type": "ContainerFS",
}
cExtractor.AssertContainsTaggedField(t, cMetrics[0], expectedFields, expectedTags)
Expand All @@ -78,7 +81,8 @@ func TestFSStats(t *testing.T) {
"container_filesystem_utilization": float64(0.0010704219949207732),
}
expectedTags = map[string]string{
"device": "logfs",
"fstype": "",
"device": "",
"Type": "ContainerFS",
}
cExtractor.AssertContainsTaggedField(t, cMetrics[1], expectedFields, expectedTags)
Expand Down

0 comments on commit d6d3176

Please sign in to comment.