Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version string to metrics #18061

Open
steled opened this issue Dec 21, 2021 · 6 comments · May be fixed by #18454
Open

Add version string to metrics #18061

steled opened this issue Dec 21, 2021 · 6 comments · May be fixed by #18454

Comments

@steled
Copy link

@steled steled commented Dec 21, 2021

Feature Description

Hi,

I'm monitoring my Gitea instance via Prometheus and Grafana.
It would be great to have a string for the current Gitea version and the new one in the metrics to set an Grafana alert for possible new version on it.

Screenshots

No response

@Flygrounder
Copy link

@Flygrounder Flygrounder commented Jan 4, 2022

Sounds like a useful feature. But Prometheus does not support string metrics and adding version string as a label does not sound like a good idea.

Maybe we should convert semver to an integer e.g. 1.15.9 = 1 * 100^2 + 15 * 100 + 9 = 11509

@techknowlogick
Copy link
Member

@techknowlogick techknowlogick commented Jan 4, 2022

@Flygrounder that's a good suggestion, although I'm not sure it'd work in all cases, as there are occasions when the version wouldn't always be in a format that could be converted so cleanly, ex v1.16.0-dev-796-gd228d346c

@Flygrounder
Copy link

@Flygrounder Flygrounder commented Jan 4, 2022

But this is only the case with dev versions, for which you probably do not want to get alerts because they are constantly updated. Perhaps in that case reporting 11600 would be fine.

@wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jan 5, 2022

I think we had better keep the original version format, and just use a new field like updateAvailable to indicate that there is a new update. Converting a version string to an (big) integer may introduce new problems.

@Flygrounder
Copy link

@Flygrounder Flygrounder commented Jan 5, 2022

To be clear, I was talking only about converting semver to an integer in Prometheus metrics, not for the entire project.

Additional benefit of having version metric in contrast to updateAvailable is that you can correlate other metrics to the specific Gitea version and see how well each version performs.

jonpalmisc added a commit to jonpalmisc/gitea that referenced this issue Jan 29, 2022
- Add `NumAppVer` variable to store the app version numerically
- Add new "version" metric, collector for Prometheus

Resolves: go-gitea#18061
@jonpalmisc jonpalmisc linked a pull request that will close this issue Jan 29, 2022
@jonpalmisc
Copy link

@jonpalmisc jonpalmisc commented Jan 29, 2022

If you've just gotten a notification about my PR, I regret to inform you that I am being forced to make my PR as part of an academic assignment. I will be closing it after the assignment has been submitted, unless for some reason this is deemed an acceptable fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants