Grid Toolkit for Grafana
Project description
How to Grid
Example dashboard
GritDash(
uid="human-id",
version=8,
title="your dashboard title",
description="your dashboards description",
tags=[
'tag1',
'tag2'
],
timezone="browser",
dataSource="Prometheus",
stack=Stack(
row6(panel1),
row6(panel1, panel2),
row6(panel1, panel2, panel3),
row6(panel1, panel2, panel3, panel4),
row6(panel1, panel2, panel3, panel4, panel5),
)
)
Variations
Variations allow to create a different collection of dashboards from same code base, for example per-environment variation can be achieved with Environment variation.
You can create multiple variations, and quickly generate hundreds of dashboards
# Variation is just subclass of Variation
class Environment(Variation):
color: str = "green"
Environment(name="dev", color="blue")
Environment(name="qa")
Environment(name="test")
Environment(name="prod", color="red")
When writing dashboard you can access specific variation values by calling <VariationClass>.resolve()
environment = Environment.resolve()
print(environment.color)
print(environment.name)
You create as many variatoins as you want and combine them
class Environment(Variation):
color: str = "green"
Environment(name="dev", color="blue")
Environment(name="qa")
Environment(name="test")
Environment(name="prod", color="red")
class Turn(Variation):
pass
class Taste(Variation):
pass
class Animal(Variation):
pass
Turn(name="first")
Turn(name="second")
Turn(name="third")
Taste(name="sweet")
Taste(name="sour")
Animal(name="rabbit")
Animal(name="donkey")
Animal(name="turtle")
Animal(name="rat")
And use all of them during generation
❯❯❯ python -m grit generate --module grafana.dashboards --out 'out/{turn}-{taste}-{animal}-company/{environment}' --var environment=qa environment=prod animal=* turn=first taste=sweet
Generating out/first-sweet-donkey-company/qa
Generating out/first-sweet-donkey-company/prod
Generating out/first-sweet-rabbit-company/qa
Generating out/first-sweet-rabbit-company/prod
Generating out/first-sweet-rat-company/qa
Generating out/first-sweet-rat-company/prod
Generating out/first-sweet-turtle-company/qa
Generating out/first-sweet-turtle-company/prod
Command-Line
Inspect dashboards
❯❯❯ python -m grit inspect --module dashboards
---
name: dashboards
folders:
- jmeter
- mongodb
variations:
environment:
- dev
- nab-dev
- nab-prod
- prod
- qa
- test
Publish to Grafana
❯❯❯ python -m grit publish --module grafana.dashboards --var environment=dev
Generate to output directory
❯❯❯ python -m grit generate --module grafana.dashboards --out 'out/{environment}' --var environment=*
Generating out/dev
Generating out/nab-dev
Generating out/nab-prod
Generating out/prod
Generating out/qa
Generating out/test
Utilities
Rows
You have some handy utilities
Predefined row heights
Each creating row of respective height
row3
row4
row5
row6
row7
row8
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
noroutine-grit-0.0.2.tar.gz
(8.9 kB
view hashes)
Built Distribution
Close
Hashes for noroutine_grit-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74ca44e5db7d802e5a696af509df6bde56120d527dcea39a658c128306d359bd |
|
MD5 | 77e62569e95005ba06027822c1daea12 |
|
BLAKE2b-256 | 52fd16a7930f3441de829ec3012cd1a0991e4d334a653993971940945ba58afc |