Runbooks Style Guide¶
This document outlines the style guide for Runbooks.
Jsonnet¶
Imports¶
Group imports by type, separated by a newline. There are three kinds of imports:
- Global imports: these are files referenced relative from the Jsonnet Library paths (
jpath). - Local imports: these are files referenced relative to the current file. These must be prefixed with
./the make it clear that they are local. - Derived imports: these are resources extracted from imported files and bound to a local variable (e.g.,
g.dashboardorg.query.prometheus).
Within these groups, imports should be sorted alphabetically by the imported filename, not the variable name.
This is enforced by the jsonnetfmt tool.
Example:
Grafonnet Derived Imports¶
Use the variable name g for Grafonnet library imports.
Our Jsonnet heavily relies on Grafonnet, which provides a lot of functionality.
To make it clear that these are derived from the Grafonnet import, we prefix them with g followed by PascalCase.
Example: