lens icon indicating copy to clipboard operation
lens copied to clipboard

Lens and Custom Prometheus installation. Metrics are not visible => "404 page not found".

Open JWebDev opened this issue 1 year ago • 1 comments

Hello. I installed Prometheus official Prometheus with Helm charts. Lens detects Prometheus иut it doesn't show metrics. I can imagine why. But in the Lance logs there is only a general message and it does not indicate which metric is not available.

This solution doesn't work either: https://github.com/lensapp/lens/blob/master/troubleshooting/custom-prometheus.md#manual I looked at several metrics from here, I have them all. Probably the labels don't match somewhere. https://github.com/lensapp/lens/tree/master/packages/technical-features/prometheus/src

There is a connection to the service, Lens automatically detects the service. image

If anyone needs it, here is an example of the service. Don't forget to add appropriate labels to the deployment.

apiVersion: v1
kind: Service
metadata:
  name: lens-metrics-service
  namespace: prometheus
  labels:
    app: prometheus
    component: server
    heritage: Helm
    release: prometheus
spec:
  selector:
    app: prometheus
    component: server
    heritage: Helm
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 9090

Now let's move on to the errors. I won't show anything new here.

Lens logs.

info: [CONTEXT-HANDLER]: using helm14 as prometheus provider for clusterId=1c2fcf927d9e8fc6637202d3fdbcc498
warn: [METRICS-ROUTE]: failed to get metrics for clusterId=1c2fcf927d9e8fc6637202d3fdbcc498: Metrics not available {"stack":"Error: Metrics not available\n    at loadMetricHelper (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35829:31)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 3)\n    at async C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35874:36\n    at async Object.route (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:34859:32)\n    at async Router.route (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35090:9)\n    at async LensProxy.handleRequest (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:33367:13)"}
info: [CLUSTER]: refresh {"accessible":true,"disconnected":false,"id":"1c2fcf927d9e8fc6637202d3fdbcc333","name":"infra","online":true,"ready":true}
info: [CLUSTER]: refresh {"accessible":true,"disconnected":false,"id":"8843900644ce20e50683bc6d40a31bfb","name":"app","online":true,"ready":true}
info: [CONTEXT-HANDLER]: using helm14 as prometheus provider for clusterId=1c2fcf927d9e8fc6637202d3fdbcc333
warn: [METRICS-ROUTE]: failed to get metrics for clusterId=1c2fcf927d9e8fc6637202d3fdbcc333: Metrics not available {"stack":"Error: Metrics not available\n    at loadMetricHelper (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35829:31)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Promise.all (index 6)\n    at async C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35874:36\n    at async Object.route (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:34859:32)\n    at async Router.route (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:35090:9)\n    at async LensProxy.handleRequest (C:\\Users\\JDev\\AppData\\Local\\Programs\\Lens\\resources\\app.asar\\node_modules\\@lensapp\\core\\static\\build\\library\\main.js:33367:13)"}
info: [CLUSTER]: refresh {"accessible":true,"disconnected":false,"id":"1c2fcf927d9e8fc6637202d3fdbcc333","name":"infra","online":true,"ready":true}

Lens developer console. image

Can someone please tell me how I can see which request(metric) has an error and what exactly is missing? If I know which metric isn't working, I can see what's wrong(probably other labels).

Prometheus installation: https://artifacthub.io/packages/helm/prometheus-community/prometheus

At the moment, the latest version of Lens and Prometheus are installed.

Thanks.

JWebDev avatar Sep 28 '23 04:09 JWebDev

I am having the same error. I have a Prometheus proxy to Grafana cloud. It is working for prometheus-adapter, but Lens does not like it. I with Lens would document what metrics APIs it is calling as well as what logic it uses for auto-detecting Prometheus. But since it has been 8 months with no update here, I am not going to hold my breath.

RobCannon avatar May 21 '24 21:05 RobCannon