alexvaut / cStatsExporter

Windows Docker Stats exporter
Apache License 2.0
15 stars 9 forks source link

"container_label_annotation_kubernetes_io/config_seen" is not a valid label name for metric "container_last_seen" #11

Open DerrickMartinez opened 4 years ago

DerrickMartinez commented 4 years ago

Am I doing something wrong? Using Windows Server 1809

C:\k>docker run --rm -p 9030:9030  -v \\.\pipe\docker_engine:\\.\pipe\docker_engine alexvaut/cstatsexporter:latest
Starting...
Configuration read. Scrap time = 15 seconds.
6d7cdb381adb alexvaut/cstatsexporter:latest
07d6bbcd6be2 kubeletwin/pause
3c76d9a4c929 mcr.microsoft.com/windows/servercore@sha256:2ecf1e2987b91b41f576afd7f56aa40c9ddbc691d7b6b066c64d8f27fb3070ca
0434b0556fb2 mcr.microsoft.com/windows/servercore@sha256:2ecf1e2987b91b41f576afd7f56aa40c9ddbc691d7b6b066c64d8f27fb3070ca
a4ef74b2ac55 kubeletwin/pause
299ba34f6466 kubeletwin/pause
panic: descriptor Desc{fqName: "container_last_seen", help: "Last time a container was seen by the exporter.", constLabels: {}, variableLabels: [container_label_annotation_kubernetes_io/config_seen container_label_annotation_io_kubernetes_container_terminationMessagePolicy container_label_app image name container_label_annotation_io_kubernetes_container_restartCount container_label_annotation_io_kubernetes_container_hash container_label_io_kubernetes_pod_name container_label_annotation_io_kubernetes_container_terminationMessagePath container_label_annotation_io_kubernetes_pod_terminationGracePeriod container_label_io_kubernetes_pod_namespace container_label_controller-revision-hash container_label_component container_label_pod-template-generation id container_label_io_kubernetes_pod_uid container_label_pod-template-hash container_label_release container_label_io_kubernetes_container_logpath container_label_io_kubernetes_sandbox_id container_label_annotation_kubernetes_io/config_source container_label_io_kubernetes_container_name container_label_io_kubernetes_docker_type]} is invalid: "container_label_annotation_kubernetes_io/config_seen" is not a valid label name for metric "container_last_seen"

goroutine 1 [running]:
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc0002ac1e0, 0xc0003574d0, 0x1, 0x1)
        C:/Users/avautier/go/pkg/mod/github.com/prometheus/client_golang@v1.1.0/prometheus/registry.go:399 +0xb4
github.com/prometheus/client_golang/prometheus.MustRegister(...)
        C:/Users/avautier/go/pkg/mod/github.com/prometheus/client_golang@v1.1.0/prometheus/registry.go:176
github.com/prometheus/client_golang/prometheus/promauto.NewGaugeVec(0x0, 0x0, 0x0, 0x0, 0xae877d, 0x13, 0xafbcd0, 0x2f, 0x0, 0xc0000f0e00, ...)
        C:/Users/avautier/go/pkg/mod/github.com/prometheus/client_golang@v1.1.0/prometheus/promauto/auto.go:174 +0xff
main.main()
        C:/projects/cStatsExporter/main.go:153 +0x5f5
alexvaut commented 4 years ago

Label "container_label_annotation_kubernetes_io/config_seen" set on the container by kubernetes (I believe) cannot be a prometheus label (because of the slash).

I'm not sure how it is handled by cadvisor with such label name. We should try to have the same logic here.

OrangeTimes commented 4 years ago

Why this defect was closed? This is a major problem preventing adoption of this tool :-(

alexvaut commented 4 years ago

Sorry I forgot to look at this one, I think @DerrickMartinez closed it and did a pull request that I didn't accept yet. Will look at it asap.

OrangeTimes commented 4 years ago

Okay thanks, looking forward to try it out

OrangeTimes commented 4 years ago

seems fixed

punith-s commented 3 years ago

Hi @alexvaut

Is there a Tentative release for this Bug Fix ?

@OrangeTimes , @DerrickMartinez

Regards, Punith

alexvaut commented 3 years ago

@punith-s Can you try version 1.6 on dockerhub, I think it contains the fix.

aghatt commented 3 years ago

Hi @alexvaut I tried running docker run --rm -p 9030:9030 -v \\.\pipe\docker_engine:\\.\pipe\docker_engine alexvaut/cstatsexporter:latest --env KUBERNETES=true and also tried it by giving it as environment variables in the yaml file for container image as follows:

  containers:
  - name: cstatsExporter
    image: alexvaut/cstatsexporter:lates
    env:
    - name: KUBERNETES
      value: true

but it is not working on the Kubernetes container and I am getting the same error as mentioned in this bug. Is there any workaround to run the image with the Kubernetes parameter overridden to true in config.yml file using deployment yaml files on Kubernetes or via docker command.

@OrangeTimes , @DerrickMartinez

Thanks, Ayushi