gitea/contrib
Vitaly Zhuravlev 2cd1479e77
Add grafana gitea-mixin (#17758)
This PR adds gitea-mixin, configurable Grafana dashboards (and potentially prometheus alerts+recording rules) based on Gitea [metrics](https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics).

The overview dashboard is described using jsonnet and grafonnet library: https://grafana.github.io/grafonnet-lib/

Mixins help to define dashboard and alerts as code so they can be collaboratively improved by the users.

![image](https://user-images.githubusercontent.com/14870891/142862822-fe57b384-c74a-4103-8548-033e92f90751.png)

__
## Generate config files

You can manually generate dashboards, but first you should install some tools:

```bash
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
go get github.com/google/go-jsonnet/cmd/jsonnet
# or in brew: brew install go-jsonnet
```

For linting and formatting, you would also need `mixtool` and `jsonnetfmt` installed. If you
have a working Go development environment, it's easiest to run the following:

```bash
go get github.com/monitoring-mixins/mixtool/cmd/mixtool
go get github.com/google/go-jsonnet/cmd/jsonnetfmt
```

The files in `dashboards_out` need to be imported
into your Grafana server.  The exact details will be depending on your environment.

Edit `config.libsonnet` (for example, list of Gitea metrics to be shown under stats can be adjusted). if required and then build JSON dashboard files for Grafana:

```bash
make
```


For more about mixins, please see:
https://github.com/monitoring-mixins/docs
https://www.youtube.com/watch?v=GDdnL5R_l-Y* add gitea mixin

* remove alerts/rules

* gitea-mixin: add interval factor of 1/2 to remove duplicated change events

* gitea-mixin: fix changes panel, add aggregation interval for changes panel

* gitea-mixin: add totals singlestat

* gitea mixin: switch change graph to timeseries type

* add color overrides for issue labels

* bump grafonnet version

* gitea-mixin: convert graphs to timeseries

* gitea-mixin:  make fmt

* gitea-mixin: add .PHONE in Makefile

* gitea-mixin: add time configration

* gitea-mixin: make fmt and collapse addPanel grid

* gitea-mixin: add static ids for shared panels

* gitea-mixin: add flags showIssuesByRepository, showIssuesByLabel to show/hide corresponding panels

* gitea-mixin: update aggregation interval

* gitea-mixin: update defaults

* gitea-mixin: update panel names

* rename dir to gitea-monitoring-mixin

* gitea-mixin: add gitea_issues_open, gitea_issues_closed metrics

* gitea-mixin: update visible name for datasource

* gitea-mixin: update README

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2021-12-20 07:52:33 +00:00
..
environment-to-ini Improve install code to avoid low-level mistakes. (#17779) 2021-12-01 15:50:01 +08:00
fhs-compliant-script Use shadowing script for docker (#17846) 2021-12-01 18:08:27 +00:00
fixtures Decouple unit test code from business code (#17623) 2021-11-12 22:36:47 +08:00
gitea-monitoring-mixin Add grafana gitea-mixin (#17758) 2021-12-20 07:52:33 +00:00
ide fix quotation marks in launch.json (#13325) 2020-10-27 16:58:09 -04:00
init Make the default PID file compile-time settable (#12485) 2020-08-15 21:15:27 +01:00
launchd Synced gitignores with github repo (#1245) 2017-03-15 13:30:00 +01:00
legal [Contrib] Change License Link to Full CC0 Legalcode (PP and TOS) (#10057) 2020-06-02 21:22:17 -04:00
options/label Adding advanced label set. (#11298) 2020-05-07 07:47:34 +01:00
pr Use fmt.Sprintf correctly (#17886) 2021-12-02 20:36:50 +01:00
supervisor Synced gitignores with github repo (#1245) 2017-03-15 13:30:00 +01:00
systemd Use Wants= over Requires= in systemd file (#15897) 2021-05-17 16:09:15 +03:00
README Synced gitignores with github repo (#1245) 2017-03-15 13:30:00 +01:00
autoboot.sh Synced gitignores with github repo (#1245) 2017-03-15 13:30:00 +01:00
mysql.sql Synced gitignores with github repo (#1245) 2017-03-15 13:30:00 +01:00
update_dependencies.sh Update bluemonday to v1.0.15 (#16379) 2021-07-09 03:30:31 +02:00

README

All files in subdirectories are templates, do modifications based on your environment first.