diff options
author | Michal <mwasilewski@gmx.com> | 2023-02-08 18:54:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 19:54:01 +0200 |
commit | 5ae07d4c2f7bd0f58a15292fb93f2e0af45ab351 (patch) | |
tree | 0ba9e2aa14c10f0d842e75f4d433b2355170e415 /services | |
parent | 7d3c4c3e8a7b3bf505e3115cbf05b8bb7029a7e8 (diff) | |
download | gitea-5ae07d4c2f7bd0f58a15292fb93f2e0af45ab351.tar.gz gitea-5ae07d4c2f7bd0f58a15292fb93f2e0af45ab351.zip |
include build info in Prometheus metrics (#22819)
Related to: https://github.com/go-gitea/gitea/issues/18061
This PR adds build info to the Prometheus metrics. This includes:
- goarch: https://pkg.go.dev/runtime#GOARCH
- goos: https://pkg.go.dev/runtime#pkg-constants
- goversion: https://pkg.go.dev/runtime#Version
- gitea version: just exposes the existing
code.gitea.io/gitea/modules/setting.AppVer
It's a similar approach to what some other Golang projects are doing,
e.g. Prometheus:
https://github.com/prometheus/common/blob/main/version/info.go
example /metrics response from Prometheus:
```
# HELP prometheus_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which prometheus was built, and the goos and goarch for the build.
# TYPE prometheus_build_info gauge
prometheus_build_info{branch="HEAD",goarch="amd64",goos="linux",goversion="go1.19.4",revision="c0d8a56c69014279464c0e15d8bfb0e153af0dab",version="2.41.0"} 1
```
/metrics response from gitea with this PR:
```
# HELP gitea_build_info Build information
# TYPE gitea_build_info gauge
gitea_build_info{goarch="amd64",goos="linux",goversion="go1.20",version="2c6cc0b8c"} 1
```
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
<!--
Please check the following:
1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)
-->
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
Diffstat (limited to 'services')
0 files changed, 0 insertions, 0 deletions