Skip to content

Commit

Permalink
cadvisor: Add log for container filesystem metrics aws#192
Browse files Browse the repository at this point in the history
It's a bit annoying ... but it helps when user turn on debug log
  • Loading branch information
pingleig committed Mar 24, 2021
1 parent 58ef034 commit dff19cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/inputs/cadvisor/container_info_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ func processContainer(info *cinfo.ContainerInfo, detailMode bool, containerOrche
tags[ContainerNamekey] = containerName
tags[ContainerIdkey] = path.Base(info.Name)
containerType = TypeContainer

// TODO(pingleig): wait for upstream fix https://github.com/aws/amazon-cloudwatch-agent/issues/192
if !info.Spec.HasFilesystem {
log.Printf("D! containerd does not have container filesystem metrics from cadvisor, See https://github.com/aws/amazon-cloudwatch-agent/issues/192")
}
}
} else {
containerType = TypeNode
Expand Down
2 changes: 2 additions & 0 deletions plugins/inputs/cadvisor/extractors/fs_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ type FileSystemMetricExtractor struct {
allowListRegexP *regexp.Regexp
}

// TODO(pingleig): it is always false for container using containerd https://github.com/aws/amazon-cloudwatch-agent/issues/192
func (f *FileSystemMetricExtractor) HasValue(info *cinfo.ContainerInfo) bool {
return info.Spec.HasFilesystem
}

func (f *FileSystemMetricExtractor) GetValue(info *cinfo.ContainerInfo, containerType string) []*CAdvisorMetric {
var metrics []*CAdvisorMetric
if containerType == TypePod || containerType == TypeInfraContainer {
log.Printf("D! fs ignore type %q path %s", containerType, info.Name)
return metrics
}

Expand Down

0 comments on commit dff19cc

Please sign in to comment.