google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.08k stars 2.32k forks source link

Only root tcpstats are shown if --enable_metrics restricts to tcp only #3101

Open tdihp opened 2 years ago

tdihp commented 2 years ago

Issue Description:

A.T. I'm testing using cadvisor as a metric collector for tcp metrics, therefore I used only "tcp" in the list of metrics needed. It seems doesn't work as expected (only root namespace metrics shown as non-zero) until I add back the usual metrics to the basket.

Repro environment:

kustomize patch:

apiVersion: apps/v1 # for Kubernetes versions before 1.9.0 use apps/v1beta2
kind: DaemonSet
metadata:
  name: cadvisor
  namespace: cadvisor
spec:
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: "/metrics"
        prometheus.io/port: "8080"
    spec:
      containers:
      - name: cadvisor
        image: gcr.io/cadvisor/cadvisor:v0.44.0
        resources:
          requests:
            memory: 50Mi
            cpu: 50m
          limits:
            memory: 200Mi
            cpu: 500m
        args:
          - --housekeeping_interval=10s
          - --max_housekeeping_interval=15s
          - --event_storage_event_limit=default=0
          - --event_storage_age_limit=default=0
          - --enable_metrics=tcp,app,cpu,disk,diskIO,memory,network,process  # working
          # - --enable_metrics tcp  # not working
          - --store_container_labels=false
          - --whitelisted_container_labels=io.kubernetes.container.name, io.kubernetes.pod.name,io.kubernetes.pod.namespace

Prometheus begin to show much more information as soon as using a fuller set of metrics. Looks like metrics are not perfectly isolated from each other?

Expected Outcome

While new to cAdvisor project, in my humble understanding metrics parameters should be fairly independent. Let me know if otherwise.

tdihp commented 2 years ago

Looks like "tcp" depends on "network"