From 78d810751dbb65587c4990006b926eb99bdf8b5a Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Tue, 14 Sep 2021 20:41:40 +0200 Subject: [PATCH] tempo-mixin: add Makefile and CI check (#957) * tempo-mixin: add Makefile and CI check * Install jsonnet-bundler * Install jsonnet-bundler (attempt 2) * Install jsonnet-bundler (attempt 3) * Install Jsonnet * Install Jsonnet (attempt 2) * Install Jsonnet (attempt 3) * Install Jsonnet (attempt 4) * Intentionally modify tempo-mixin without regenerating yamls * Revert "Intentionally modify tempo-mixin without regenerating yamls" This reverts commit e76761e95377ff0384cfd955e436e7bc6bae1ea4. * Clarify you need jsonnet as well --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ Makefile | 8 ++++++++ operations/tempo-mixin/Makefile | 18 ++++++++++++++++++ operations/tempo-mixin/README.md | 19 ++++++++----------- 4 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 operations/tempo-mixin/Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2634785b48..1e15aa6ac73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,3 +43,24 @@ jobs: - name: Build Tempo-Query run: make tempo-query + + tempo-mixin: + name: Check tempo-mixin + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.16 + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Install jsonnet & jsonnet-bundler + run: | + brew install jsonnet + go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 + + - name: Check out code + uses: actions/checkout@v2 + + - name: Check tempo-mixin + run: make tempo-mixin-check diff --git a/Makefile b/Makefile index df9dc7110aa..4ff2c0d41a9 100644 --- a/Makefile +++ b/Makefile @@ -200,3 +200,11 @@ docs: docs-test: docker pull ${DOCS_IMAGE} docker run -v ${PWD}/docs/tempo/website:/hugo/content/docs/tempo/latest:z -p 3002:3002 --rm $(DOCS_IMAGE) /bin/bash -c 'mkdir -p content/docs/grafana/latest/ && touch content/docs/grafana/latest/menu.yaml && make prod' + +### tempo-mixin +.PHONY: tempo-mixin tempo-mixin-check +tempo-mixin: + $(MAKE) -C operations/tempo-mixin all + +tempo-mixin-check: + $(MAKE) -C operations/tempo-mixin check diff --git a/operations/tempo-mixin/Makefile b/operations/tempo-mixin/Makefile new file mode 100644 index 00000000000..16471f8fb0c --- /dev/null +++ b/operations/tempo-mixin/Makefile @@ -0,0 +1,18 @@ +.PHONY: all check install dashboards alerts rules + +all: dashboards alerts rules + +check: all + git diff --exit-code -- yamls/ + +install: + jb install + +dashboards: install + jsonnet -J vendor -S dashboards.jsonnet -m yamls + +alerts: install + jsonnet -J vendor -S alerts.jsonnet > yamls/alerts.yaml + +rules: install + jsonnet -J vendor -S rules.jsonnet > yamls/rules.yaml diff --git a/operations/tempo-mixin/README.md b/operations/tempo-mixin/README.md index d5c90823582..5225013a2f2 100644 --- a/operations/tempo-mixin/README.md +++ b/operations/tempo-mixin/README.md @@ -1,17 +1,14 @@ -Dashboards, rules and alerts are in the `yamls` folder. Use them directly in Prometheus & Grafana to monitor Tempo. +# tempo-mixin -To generate dashboards with this mixin use: +Dashboards, rules and alerts are in the [`yamls`](./yamls) folder. Use them directly in Prometheus & Grafana to monitor Tempo. -```console -jb install && jsonnet -J vendor -S dashboards.jsonnet -m yamls -``` +### Build -To generate alerts, use: -```console -jsonnet -J vendor -S alerts.jsonnet > yamls/alerts.yaml -``` +To regenerate dashboards, rule and alerts, run `make all`. + +This requires [jsonnet](https://jsonnet.org/) and [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler) to be installed, install these with the following commands: -To generate recording rules, use: ```console -jsonnet -J vendor -S rules.jsonnet > yamls/rules.yaml +brew install jsonnet +go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 ```