[discourse] Prometheus as source for analytics #4324
-
Originally posted by member on Discourse Hello team! Now I’m trying to connect a new feature, but I ran into a problem. With the Prometheus version 3.0.1 (latest) everything works fine, but with version 2.55.1 the graph is not displayed in the UI. For the test, I ran docker-compose from the example with image: prom/prometheus:v2.55.1 and got the same effect. Can I somehow fix this myself or will only update to Prometheus 3.0.1? |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments
-
There aren't any Flipt-specific configurations or code that change UI behavior based on the Prometheus version—Flipt uses the Prometheus Go client library and interacts with Prometheus via its API in a version-agnostic way. The example Docker Compose setup uses the latest Prometheus image, which works, but switching to v2.55.1 causes the graph to disappear, as you've seen. This suggests the issue is likely due to a change or incompatibility in Prometheus itself, not Flipt. It's possible that Prometheus 2.55.1 responds differently to certain queries or has a bug that was fixed in 3.0.1. The Flipt backend expects a specific response format (a matrix type) and handles errors if the response is unexpected, which could explain the missing graph if 2.55.1 returns something different or incomplete for the same query (source). If you need this working with 2.55.1, you could try running the same Prometheus query manually in the Prometheus UI for both versions and compare the results. If 2.55.1 returns a different structure or no data, that's likely the root cause. Otherwise, upgrading to 3.0.1 is the most straightforward fix, since that's the version Flipt's examples and tests are known to work with. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: Hey! We recently merged a fix that should work with older versions of prometheus. We haven’t yet released it as a new version of Flipt, but will create a new release this coming week. In the mean time, can you try to use the
And it seemed to work using prometheus v2.55.1 and flipt nightly |
Beta Was this translation helpful? Give feedback.
-
Reply from member on Discourse: Hey @mark! Checked now with night build: Version: v1.52.1There is still no analytics in my case (the result is the same as in my screenshot above). |
Beta Was this translation helpful? Give feedback.
-
Reply from erka on Discourse: There is no problem with Prometheus v2.55.1. It’s a UI bug. As workaround switch Timezone UTC on/off in Settings. The chart will not be broken after that. |
Beta Was this translation helpful? Give feedback.
-
Reply from member on Discourse: I tried it and it worked with the https://github.com/flipt-io/flipt/blob/main/examples/analytics/prometheus/docker-compose.yml but it still doesn’t work for me. Maybe the problem is on my side, I’ll try to find it P.S in Grafana everything is ok |
Beta Was this translation helpful? Give feedback.
-
Reply from andi4000 on Discourse: Thanks for this! I was scratching my head why is analytics on my |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: @andi4000 we just released v1.53.0 that should contain this fix
Release v1.53.0 · flipt-io/fliptAdded ui: new table view for flags and segments (#3664) Changed ui: stop using /meta/config endpoint (#3684) Please let us know if it resolves the issue! |
Beta Was this translation helpful? Give feedback.
-
Reply from member on Discourse: Thanks for the update. |
Beta Was this translation helpful? Give feedback.
-
Reply from member on Discourse: upd: In Grafana everything is ok, I just checked it again. |
Beta Was this translation helpful? Give feedback.
-
Reply from andi4000 on Discourse: Thanks for the update! It works on docker compose ( But for some reason it’s not yet working on our k8s cluster. I can see data in prometheus, but not at flipt and grafana (with this dashboard) |
Beta Was this translation helpful? Give feedback.
-
Reply from andi4000 on Discourse: I noticed this prometheus query here:
flipt-io/flipt/blob/df4bd3894e214cc4741a6cbd06404c577b75055a/internal/server/analytics/prometheus/client.go#L47
But when I check the data points in prometheus, it looks like this:
If I understand this correctly, flipt retrieves zero data because the query is wrong. The Whereas on local compose setup, the data point looks like this:
Which makes sense why it works on docker compose, but not in k8s. Is there something I can do on my end to make this work? Sorry, I’m not very well versed in golang or prometheus setup. |
Beta Was this translation helpful? Give feedback.
-
Reply from erka on Discourse: It looks there is no easy way out… Per Prometheus docs
What is the best way out for your setup? |
Beta Was this translation helpful? Give feedback.
-
Reply from andi4000 on Discourse: Thanks for the hint! I consulted with a colleague and yea that could work. But we’re going to need to create our own Reference for future reader: ServiceMonitor [monitoring.coreos.com/v1] - Monitoring APIs | API reference | OpenShift Container Platform 4.10, look for But in the long term, isn’t it better for flipt to use other label e.g. Edit: add PR and docs reference link |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Reply from member on Discourse: Thanks for the suggested solution. It worked with this fix. |
Beta Was this translation helpful? Give feedback.
-
Reply from mark on Discourse: Hey @andi4000 ! Thanks for the contributions to the helm chart re: ServiceMonitor and honor labels. (And for coming back to update this post!) I agree that we should probably deprecate This is currently what we have in code:
We should likely add new attributes like:
|
Beta Was this translation helpful? Give feedback.
Reply from member on Discourse:
Thanks for the suggested solution. It worked with this fix.