Skip to content

Commit 3774123

Browse files
authored
Refactor mixin dashboards (#885)
This is a complete refactor of the dashboard system. It brings the dashboard creation, metrics, alerting, etc into alignment with other projects that use jsonnet/grafonnet/mixins. This should allow users to customize what we have created and deploy into their environments. The dashboard was the focus of this iteration, reaching parity with the previous dashboard. - Add in jsonnet and grafonnet - Add scripts to compile and lint mixin - Add CI for the mixin --------- Signed-off-by: Joe Adams <[email protected]>
1 parent bb63208 commit 3774123

27 files changed

+1296
-2250
lines changed

.github/workflows/mixin.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: mixin
3+
on:
4+
pull_request:
5+
paths:
6+
- "elasticsearch-mixin/**"
7+
8+
jobs:
9+
check-mixin:
10+
name: check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: 1.22.5
19+
- name: Install dependencies
20+
run: |
21+
go install github.com/google/go-jsonnet/cmd/[email protected]
22+
go install github.com/google/go-jsonnet/cmd/[email protected]
23+
go install github.com/google/go-jsonnet/cmd/[email protected]
24+
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@16dc166166d91e93475b86b9355a4faed2400c18
25+
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
26+
- name: Lint
27+
run: bash ./scripts/lint-jsonnet.sh
28+
- name: Compile mixin
29+
run: bash ./scripts/compile-mixin.sh
30+
- name: Verify compiled mixin matches repo
31+
run: |
32+
git diff --exit-code -- ./elasticsearch-mixin || (echo "Compiled mixin does not match repo" && exit 1)
33+
# Check if there are any new untracked files
34+
test -z "$(git status --porcelain)" || (echo "Untracked files found, please run ./scripts/compile-mixin.sh" && exit 1)

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ elasticsearch_exporter
44
*-stamp
55
.tarballs
66
/vendor
7+
vendor/

elasticsearch-mixin/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Elasticsearch Exporter Mixin
2+
3+
This is a mixin for the elasticsearch_exporter to define dashboards, alerts, and monitoring queries for use with this exporter.
4+
5+
Good example of upstream mixin for reference: https://github.com/kubernetes-monitoring/kubernetes-mixin
6+
7+
## Development
8+
9+
### JSONNET
10+
https://jsonnet.org/
11+
12+
```go install github.com/google/go-jsonnet/cmd/jsonnet@latest```
13+
14+
### JSONNET BUNDLER
15+
jsonnet bundler is a package manager for jsonnet
16+
17+
https://github.com/jsonnet-bundler/jsonnet-bundler
18+
19+
```go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest```
20+
21+
### Grafonnet
22+
Grafana libraries for jsonnet: https://grafana.github.io/grafonnet/
23+
24+
```jb install github.com/grafana/grafonnet/gen/grafonnet-latest@main```
25+
26+
### Run the build
27+
```bash
28+
./scripts/compile-mixin.sh
29+
```
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)