# Metrics not compatible with prometheus which is deployed using operator that has routePrefix in spec

**URL:** https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177
**Category:** Lens Support & Troubleshooting
**Tags:** metrics
**Created:** [April 18, 2024, 9:00am UTC](https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177 "2024-04-18T09:00:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ywang14](https://forums.k8slens.dev/user_avatar/forums.k8slens.dev/ywang14/32/1139_2.png) [@ywang14](https://forums.k8slens.dev/u/ywang14)
#### Post date: [April 18, 2024, 9:00am UTC](https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177/1 "2024-04-18T09:00:19Z")

</div>

Hi, the metrics does not show up in my case.

I think it is because the spec I use has routePrefix in it

```auto
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: monitor
  namespace: kube-prometheus-stack-prometheus
spec:
  ...
  routePrefix: /prometheus

```

I tried following metrics settings in cluster settings

PROMETHEUS: `Prometheus Operator`  
PROMETHEUS SERVICE ADDRESS: `monitor/kube-prometheus-stack-prometheus:9090/prometheus`

and it is not working.

---

<div class="post-metadata">

### Author: ![ywang14](https://forums.k8slens.dev/user_avatar/forums.k8slens.dev/ywang14/32/1139_2.png) [@ywang14](https://forums.k8slens.dev/u/ywang14)
#### Post date: [April 18, 2024, 9:52am UTC](https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177/2 "2024-04-18T09:52:30Z")

</div>

I got this in kube-api-server log, the requestURI is 404

```auto
{
    "kind": "Event",
    "apiVersion": "audit.k8s.io/v1",
    "level": "RequestResponse",
    "auditID": " *****",
    "stage": "ResponseStarted",
    "requestURI": "/api/v1/namespaces/monitor/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query_range",
    "verb": "create",
    ...
   "responseStatus": {
        "metadata": {},
        "code": 404
    },
    ...
}

```

the correct URI should be

`/api/v1/namespaces/monitor/services/kube-prometheus-stack-prometheus:9090/proxy/prometheus/api/v1/query_range`

---

<div class="post-metadata">

### Author: ![phorsmalahti](https://forums.k8slens.dev/user_avatar/forums.k8slens.dev/phorsmalahti/32/560_2.png) [@phorsmalahti](https://forums.k8slens.dev/u/phorsmalahti)
#### Post date: [April 18, 2024, 1:04pm UTC](https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177/3 "2024-04-18T13:04:36Z")

</div>

Hi, this is a known issue/feature request. We plan to add a configuration option to Metrics settings which would allow setting a prefix to the url. Currently there is no real workaround.

---

<div class="post-metadata">

### Author: ![phorsmalahti](https://forums.k8slens.dev/user_avatar/forums.k8slens.dev/phorsmalahti/32/560_2.png) [@phorsmalahti](https://forums.k8slens.dev/u/phorsmalahti)
#### Post date: [April 25, 2024, 4:04am UTC](https://forums.k8slens.dev/t/metrics-not-compatible-with-prometheus-which-is-deployed-using-operator-that-has-routeprefix-in-spec/3177/4 "2024-04-25T04:04:24Z")

</div>

Hi, could you try this service address:

kube-prometheus-stack-prometheus/monitor:9090/prometheus

this is assuming the service name is “monitor” - please adjust if it’s something else. It seems the namespace is kube-prometheus-stack-prometheus, not monitor.

Note that the input should be in form “namespace/service:port” but it should optionally accept a prefix.
