Skip to content

Commit

Permalink
Refactor mixin dashboards (#885)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sysadmind authored Dec 14, 2024
1 parent bb63208 commit 3774123
Show file tree
Hide file tree
Showing 27 changed files with 1,296 additions and 2,250 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/mixin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: mixin
on:
pull_request:
paths:
- "elasticsearch-mixin/**"

jobs:
check-mixin:
name: check

Check failure on line 10 in .github/workflows/mixin.yml

View workflow job for this annotation

GitHub Actions / Go tests

10:7 [indentation] wrong indentation: expected 4 but found 6
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.5
- name: Install dependencies
run: |
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@16dc166166d91e93475b86b9355a4faed2400c18
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
- name: Lint
run: bash ./scripts/lint-jsonnet.sh
- name: Compile mixin
run: bash ./scripts/compile-mixin.sh
- name: Verify compiled mixin matches repo
run: |
git diff --exit-code -- ./elasticsearch-mixin || (echo "Compiled mixin does not match repo" && exit 1)
# Check if there are any new untracked files
test -z "$(git status --porcelain)" || (echo "Untracked files found, please run ./scripts/compile-mixin.sh" && exit 1)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ elasticsearch_exporter
*-stamp
.tarballs
/vendor
vendor/
29 changes: 29 additions & 0 deletions elasticsearch-mixin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Elasticsearch Exporter Mixin

This is a mixin for the elasticsearch_exporter to define dashboards, alerts, and monitoring queries for use with this exporter.

Good example of upstream mixin for reference: https://github.com/kubernetes-monitoring/kubernetes-mixin

## Development

### JSONNET
https://jsonnet.org/

```go install github.com/google/go-jsonnet/cmd/jsonnet@latest```

### JSONNET BUNDLER
jsonnet bundler is a package manager for jsonnet

https://github.com/jsonnet-bundler/jsonnet-bundler

```go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest```

### Grafonnet
Grafana libraries for jsonnet: https://grafana.github.io/grafonnet/

```jb install github.com/grafana/grafonnet/gen/grafonnet-latest@main```

### Run the build
```bash
./scripts/compile-mixin.sh
```
1 change: 1 addition & 0 deletions elasticsearch-mixin/compiled/alerts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit 3774123

Please sign in to comment.