Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-78221

correct result value format

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • 4.22.0
    • 4.22.0
    • Monitoring
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Low
    • None
    • None
    • None
    • MON Sprint 285
    • 1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      observed in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_kubernetes-metrics-server/52/pull-ci-openshift-kubernetes-metrics-server-main-e2e-agnostic-cmo/2029798519220473856

                      === RUN   TestPrometheusMetrics/openshift-state-metrics
                          prometheus_test.go:47: context deadline exceeded: error validating response body "{\"status\":\"success\",\"data\":{\"resultType\":\"vector\",\"result\":[{\"metric\":{},\"value\":[1772782825.210,\"1\"]}],\"analysis\":{}}}" for query "count(last_over_time(up{service=\"openshift-state-metrics\",namespace=\"openshift-monitoring\"}[1m]) == 1)": expected 2 targets to be up but got 1.000000
                      --- FAIL: TestPrometheusMetrics (60.51s)
      

      "count(last_over_time(up{service="%s",namespace="openshift-monitoring"}[1m]) == 1)" value is integer, not float64

      $ oc -n openshift-monitoring exec -c prometheus prometheus-k8s-0 -- curl -k -H "Authorization: Bearer $token" 'https://thanos-querier.openshift-monitoring.svc:9091/api/v1/query?' --data-urlencode 'query=count(last_over_time(up{service="openshift-state-metrics",namespace="openshift-monitoring"}[1m]) == 1)' | jq
      {
        "status": "success",
        "data": {
          "resultType": "vector",
          "result": [
            {
              "metric": {},
              "value": [
                1773219769.297,
                "2"
              ]
            }
          ],
          "analysis": {}
        }
      }
      

      func is TestPrometheusMetrics, code: https://github.com/openshift/cluster-monitoring-operator/blob/main/test/e2e/prometheus_test.go#L32

      change

      return fmt.Errorf("expected %d targets to be up but got %f", metric, v) 

      to

      return fmt.Errorf("expected %d targets to be up but got %v", metric, v) 

      would be fine

              juzhao@redhat.com Junqi Zhao
              juzhao@redhat.com Junqi Zhao
              Junqi Zhao Junqi Zhao
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: