github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/production/loki-mixin/README.md (about)

     1  # loki-mixin
     2  
     3  loki-mixin is a jsonnet library containing a set of Loki monitoring dashboards, alerts and rules collected based on our experience operating Loki in Grafana Cloud.
     4  
     5  ## Dashboards
     6  
     7  To test the dashboards against a local grafana & Loki setup perform the following steps.
     8  
     9  ### Pre-requisites
    10  
    11  * jb is a jsonnet package manager
    12  To install it follow the instructions at: https://github.com/jsonnet-bundler/jsonnet-bundler.
    13  
    14  * Grizzly is a tool for managing jsonnet dashboards in Grafana: https://github.com/grafana/grizzly.
    15  To install it follow the instructions at: https://grafana.github.io/grizzly/installation/.
    16  
    17  * Make sure you have the latest dependencies in the `vendor` directory by running the following command in `production/loki-mixin`:
    18  
    19  ```shell
    20  jb install
    21  ```
    22  
    23  * On your Grafana instance create an API key with role 'Admin' under Configuration > API keys. 
    24  Copy this key for the next step.
    25  
    26  ### Testing dashboards
    27  
    28  To test the dashboard in your local grafana instance, in directory `production/loki-mixin` run the command:
    29  
    30  ```shell
    31  GRAFANA_URL=http://localhost:3000 GRAFANA_TOKEN=<API_KEY> JSONNET_PATH=$(pwd)/lib:$(pwd)/vendor grr watch ./ dashboards.libsonnet
    32  ```
    33  
    34  `grr watch` will detect changes when you save files and try to add/update dashboards:
    35  
    36  ```shell
    37  INFO[0000] Watching for changes
    38  INFO[0005] Changes detected. Applyingdashboards.libsonnet
    39  INFO[0007] Applying 10 resources
    40  Dashboard.reads-resources added
    41  Dashboard.writes-resources added
    42  Dashboard.reads updated
    43  Dashboard.writes updated
    44  ...
    45  ```
    46  
    47  **Disclaimer:** Since these dashboards are used on our own production setup, these contain very specific configurations to our cloud environment which may need to overridden for other setups and use-cases.