robusta-dev / krr

Prometheus-based Kubernetes Resource Recommendations
MIT License
3.05k stars 160 forks source link

Errors when using metrics from greptimedb #364

Open yerlaser opened 1 week ago

yerlaser commented 1 week ago

Describe the bug I am trying to use krr with greptimedb and get the following errors:

           WARNING  Error: Expected exactly one result from Prometheus query.                                                                              prometheus_metrics_service.py:213
                                sum(max by (instance) (machine_memory_bytes{  }))

           WARNING  Error: Expected exactly one result from Prometheus query.                                                                              prometheus_metrics_service.py:213
                                sum(max by (instance) (machine_cpu_cores{  }))

           ERROR    Exception occurred while getting cluster summary: float() argument must be a string or a real number, not 'NoneType'                   prometheus_metrics_service.py:259
           ERROR    Failed to load pods for Deployment argocd/argocd-notifications-controller/argocd-notifications-controller: HTTP Status Code 500                             loader.py:89
                    (b'{"status":"error","data":{"resultType":"","result":[]},"error":"Unsupported arrow data type, type: Dictionary(Int64,
                    Float64)","errorType":"EngineExecuteQuery"}')
                    Traceback (most recent call last):
                      File "krr/robusta_krr/core/integrations/prometheus/loader.py", line 87, in load_pods
                        return await self.loader.load_pods(object, period)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      File "krr/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 278, in
                    load_pods
                        replicasets = await self.query(
                                      ^^^^^^^^^^^^^^^^^
                      File "krr/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 119, in
                    query
                        return await loop.run_in_executor(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
                        result = self.fn(*self.args, **self.kwargs)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      File "krr/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 121, in
                    <lambda>
                        lambda: self.prometheus.safe_custom_query(query=query)["result"],
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      File ".cache/pypoetry/virtualenvs/robusta-krr-TSFKkwYg-py3.12/lib/python3.12/site-packages/prometrix/connect/custom_connect.py", line 89, in
                    safe_custom_query
                        raise PrometheusApiClientException(
                    prometheus_api_client.exceptions.PrometheusApiClientException: HTTP Status Code 500
                    (b'{"status":"error","data":{"resultType":"","result":[]},"error":"Unsupported arrow data type, type: Dictionary(Int64,
                    Float64)","errorType":"EngineExecuteQuery"}')