forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metrics/grafana: use jsonnet to generate tidb-summary Grafana json fi…
…les (pingcap#32333) ref pingcap#32194
- Loading branch information
Showing
5 changed files
with
2,237 additions
and
3,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## About | ||
|
||
Use [jsonnet](https://github.com/google/go-jsonnet) to generate Grafana-compliant json scripts for use with TiDB. | ||
|
||
Why jsonnet? | ||
|
||
1. jsonnet is a DSL created by Google for json, which is good for advanced json editing work. | ||
2. Grafana provides the [jsonnet library](https://grafana.github.io/grafonnet-lib/) specifically for generating Grafana json, which makes maintaining TiDB's json scripts much easier. | ||
|
||
## Usage | ||
|
||
1. Modify the jsonnet files (e.g. tidb_summary.jsonnet). | ||
2. Run `generate_json.sh` to generate the json files by the jsonnet files. | ||
3. Commit the modifications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2022 PingCAP, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
go install github.com/google/go-jsonnet/cmd/jsonnet@latest | ||
git clone https://github.com/grafana/grafonnet-lib.git | ||
|
||
export JSONNET_PATH=grafonnet-lib | ||
jsonnet tidb_summary.jsonnet > tidb_summary.json | ||
rm -rf $JSONNET_PATH | ||
|
Oops, something went wrong.