Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric with type Gauge throwing errors with no reason. #2439

Open
villanisaac-kr opened this issue Jul 1, 2024 · 1 comment · May be fixed by #2536
Open

Metric with type Gauge throwing errors with no reason. #2439

villanisaac-kr opened this issue Jul 1, 2024 · 1 comment · May be fixed by #2536
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@villanisaac-kr
Copy link

villanisaac-kr commented Jul 1, 2024

What happened:

After adding below metric. I was able to see the metric in Prometheus portal but the kube-state-metrics pod keeps throwing following error:
E0701 21:29:11.117845 1 registry_factory.go:685] "gotk_resource_status" err="[status,conditions]: []: strconv.ParseFloat: parsing \"Unknown\": invalid syntax".

#configuration
---
customResourceState:
    enabled: true
    config:
      spec:
        resources:
          - groupVersionKind:
              group: kustomize.toolkit.fluxcd.io
              version: v1
              kind: Kustomization
            metricNamePrefix: gotk
            metrics:
              - name: "resource_status"
                help: "The current state of a Flux Kustomization resource."
                each:
                  type: Gauge
                  gauge:
                    path: [status, conditions]
                    labelsFromPath:
                      type: ["type"]
                    valueFrom: ["status"]
                labelsFromPath:
                  name: [metadata, name]
                  exported_namespace: [metadata, namespace]
                  suspended: [spec, suspend]
                  prune: [spec, prune]
                  revision: [status, lastAppliedRevision]
                  source_name: [spec, sourceRef, name]

What you expected to happen:

I expect no errors in the logs after adding that configuration

How to reproduce it (as minimally and precisely as possible):

Added the metric showed in the description

Anything else we need to know?:
As I said before the metric works as expected but the logs are overflowing with the error described on "What happened?" section:

gotk_resource_status{container="kube-state-metrics", customresource_group="kustomize.toolkit.fluxcd.io", customresource_kind="Kustomization", customresource_version="v1", endpoint="http", exported_namespace="flux-system", instance="172.22.15.193:8080", job="kube-state-metrics", name="prometheus", namespace="monitoring", pod="kube-prometheus-stack-kube-state-metrics-5b7fb8dc6-j7tqn", prune="true", revision="main@sha1:cc6b5b452b9b09a964deaef0b4de59817fe5caed", service="kube-prometheus-stack-kube-state-metrics", source_name="flux-system", type="Ready"}

I followed this documentation: https://github.com/kubernetes/kube-state-metrics/blob/main/docs/metrics/extend/customresourcestate-metrics.md#example-for-status-conditions-on-kubernetes-controllers

Environment:

  • kube-state-metrics version: app.kubernetes.io/version: 2.12.0
  • Kubernetes version (use kubectl version): v1.27.7
  • Cloud provider or hardware configuration: AKS
  • Other info:
    • helm.sh/chart: kube-state-metrics-5.18.1
@villanisaac-kr villanisaac-kr added the kind/bug Categorizes issue or PR as related to a bug. label Jul 1, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jul 1, 2024
@villanisaac-kr villanisaac-kr changed the title registry_factory.go:685 Invalid syntax Metric with type Gauge throwing errors with no reason. Jul 26, 2024
@dgrisonnet
Copy link
Member

/assign @rexagod
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
4 participants