Giter Site home page Giter Site logo

grafana / grafonnet-lib Goto Github PK

View Code? Open in Web Editor NEW
1.1K 155.0 217.0 712 KB

Jsonnet library for generating Grafana dashboard files.

Home Page: https://grafana.github.io/grafonnet-lib/

License: Apache License 2.0

Shell 0.59% Jsonnet 95.58% JavaScript 2.32% Makefile 0.94% Dockerfile 0.38% HTML 0.18%

grafonnet-lib's Introduction

Grafonnet ==DEPRECATED==

Jsonnet libraries for writing Grafana dashboards as code.

NOTE: This repository is deprecated. It is replaced with an (generated) version to be found at https://github.com/grafana/grafonnet.

Although deprecated, this repository will not be removed. It will remain in place so that code using this library will continue to function.

No new changes will be made or accepted to this repository. Please direct feature requests to the new Grafonnet repository.

grafonnet-lib's People

Contributors

aajisaka avatar adamwg avatar aechgg avatar alexppg avatar anpryl avatar arodrime avatar asiekkowa avatar bastienf avatar caarlos0 avatar cazorla19 avatar corentinaltepe avatar cyriltovena avatar cznewt avatar daniellee avatar differentialorange avatar duologic avatar enrichman avatar jdbaldry avatar jecnua avatar jtlisi avatar kobtea avatar lukaf avatar luna-duclos avatar malcolmholmes avatar roidelapluie avatar ryucaelum avatar siddharth-gitrepo avatar svenklemm avatar tomwilkie avatar trotttrotttrott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafonnet-lib's Issues

hide or remove a grafana JSON field?

I haven't come across an example where a field is hidden or not generated in JSON of Jsonnet.

Like I don't want to include all the fields to be generated of Panels object array, only field I set.
How to do this?

Thanks and Regards,
Tayyab

Insert rows with schemaVersion > 14

So with the default schemaVersion of 14 the templating requires the use of rows:

      dashboard.new(
        'Node Exporter stats',
        editable=true,
        time_from='now-1h',
        tags=["node-exporter"],
        description="Collected via node-exporter",
        graphTooltip='shared_crosshair',
      )
      .addTemplate(...)
      .addRow(
        row.new(title='Basic CPU / Mem / Disk Gauge')
        .addPanel(myAwesomeGraphPanel)
        )
      )

With newer schemaVersions rows are now superseded by a grid system, so the dashboard would be generated like this:

      dashboard.new(
        'Node Exporter stats',
        schemaVersion=19,
        editable=true,
        time_from='now-1h',
        tags=["node-exporter"],
        description="Collected via node-exporter",
        graphTooltip='shared_crosshair',
      )
      .addTemplate(...)
      .addPanel(
        myAwesomeGraphPanel,
        gridPos={
          x: 0,
          y: 0,
          w: 24,
          h: 6,
        }
      )

But how do I actually add a row element that acts as a divider with a custom heading, e.g. row.new(title='Basic CPU / Mem / Disk Gauge') from the first example? I haven't been able to figure that out. Can you give me a hint how this is done, please.

Issue with Dashboard JSON file for Grafana API

Hello,

I have an issue with the Grafana API being able to use the JSON file generated by the Grafonnet library.
It appears that Grafonnet library does not include the "dashboard" notation in the final JSON file that is needed by Grafana's API.

This is the final JSON code:

{

           (json_dashboard_code_goes_here)

}

But, the Grafana API requires the following format:

{
  "dashboard": { 
           (json_dashboard_code_goes_here)
       }
} 

If I manually type in "dashboard" and enclose the JSON Dashboard code in brackets in the file, the API successfully accepts the new Dashboard and it shows up in the Grafana GUI.

The file as it is works only when you manually copy and paste the resulting code into the "Import" option in the Grafana GUI; however, I want to use the API for simplicity and speed.

Is there a way to include the "dashboard" notation described above? Perhaps I am missing something?

Below is my use-case:

I generate the following JSON file from a simple jsonnet file:

dash.jsonnet

local grafana = import 'grafonnet-lib/grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;

dashboard.new(
	'CloudWatch Test',
	editable=true,
	schemaVersion=16,
)

This is just a barebones Dashboard titled "CloudWatch Test".

Then, using the command: jsonnet dash.jsonnet > foo.json
I successfully generate a standalone JSON file (foo.json) that I want to curl into Grafana.

After I use the following curl command:
curl -XPOST -i -H "Authorization: Bearer <key_goes_here>" --data-binary @.<folder_path_to_foo.json> -H "Content-Type: application/json" http://localhost:3000/api/dashboards/db

I get an HTTP 422 error. If I add the "dashboard" notation as described earlier, it works perfectly and the new Dashboard appears in Grafana GUI.

Thank you for looking into this!

Add support for hideTimeOverride

I was building a dashboard and noticed there isn't an option for hideTimeOverride. It's pretty helpful when creating single stat instant panels.

singlestat panel missing tableColumn parameter

The tableColumn parameter to specify the field (when data format is in table) is not within the libsonnet file for singlestat panels. Currently the field is specified as '' within the Json generation.
As the parameter is not included there is no way to specify a value for it when the Json file is made.
I've made a PR to include this missing parameter #156

The example code piece in README.md needs to be updated

Passing the id parameter will lead to RUNTIME ERROR:

RUNTIME ERROR: function has no parameter id
test-dashboard.jsonnet:11:5-18 thunk
grafonnet-lib/grafonnet/dashboard.libsonnet:60:25-28 thunk <array_element>
grafonnet-lib/grafonnet/dashboard.libsonnet:(51:18)-(61:14) object
During manifestation

Need to remove the id from the example code piece

generate grafana elemetns by given input.

hi,
Is that possible to generate some grafana elements by given input.
for instance:

local grafana = import 'grafonnet-lib/grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;
local row = grafana.row;
local template = grafana.template;
local graphPanel = grafana.graphPanel;

...

{
...
}::
grafana.dashboard.new(
)
.addRow(
  )
  for index in elastic.indices():
       .addPanel(
         index.name
        )
)

Create template of type textBox

Hello,

Currently it is not possible de create a template variable of type "text box", is it a feature planned to be developped ?

Thanks You

How to set annotation field formats?

I need to set field formats in Annotation:

Expected:
image

JSON representation from expected:

{
        "datasource": "${DS_PROMETHEUS}",
        "enable": true,
        "expr": "sum(changes(nginx_ingress_controller_config_last_reload_successful_timestamp_seconds{instance!=\"unknown\",controller_class=~\"$controller_class\",namespace=~\"$namespace\"}[30s])) by (controller_class)",
        "hide": false,
        "iconColor": "rgba(255, 96, 96, 1)",
        "limit": 100,
        "name": "Config Reloads",
        "showIn": 0,
        "step": "30s",
        "tagKeys": "controller_class",
        "tags": [],
        "titleFormat": "Config Reloaded",
        "type": "tags"
}

Current project state

Hi!
I want to automatize my workflow related to graphs and dashboards. I'm digging if grafonnet project can help me with it.
My doubts for now is mostly related to lack of commits, product maturity and of cause product vision.

As for now we have pretty basic support of grafana panels. Does it related that the whole idea was wrong and broken or lack of time and interest ?

Will folks from main project further support of idea of dashboards generation or this is just a pretty strange case ?

Add InfluxDB query editor support

grafonnet-lib supports only rawQuery InfluxDB queries.

Grafana introduced InfluxDB Query Editor in v2.1 and use it by default for InfluxDB targets now, so I think it would be a good feature if grafonnet-lib supported not only rawQuery queries, but also editor tagged queries.

Moreover, I think this option should be a default one (rawQuery=true by default in current InfluxDB target), like in Grafana UI editor.

Add Status Panel support

Status Panel by Vonage is a Grafana panel plugin meant to be used as a centralized view for the status of component in a glance. It would be convenient if grafonnet-lib supported Status Panel.

Dynamic Code based dashboard generation

Hi,

We're looking for a way to dynamically generate dashboards, based on configuration parameters that are stored in a file or ideally in a noSql db like mongodb.

Say, for instance, if option A is true, then dashboard 1 should show query x in a panel y.
So the value of option A should be read from a file or db.
On change of these config parameters, the dashboards should be created again.

Is this possible with jsonnet and the grafonnet-lib? Is it possible to:

  • import a json formatted config file?
  • connect to a db like mongodb (or other)?

Breaking changes contributions!

I've opened a couple of PRs (#192, #194) and just now I've realized that they're not backward compatibles.

I'm not an old contributor, so I don't know if this happened before (probably yes).

Basically adding parameters in the middle of a function will cause errors or unpredictable behaviours on client that are not using named parameters.

I'm not sure if this is an issue or if clients are supposed or enforced to use named parameters.

Example

// client.jsonnet
local lib = import 'lib.libsonnet';

lib.new("aaa", "zzz")
// lib.libsonnet (v1)
{
  new(
    a_param,
    z_param="z_default",
  )::
    {
      a: a_param,
      z: z_param,
    },
}

The v1 of the lib.libsonnet will output:

{
   "a": "aaa",
   "z": "zzz"
}

If we are going to update the library following the "alphabetical" order convention like this:

// lib.libsonnet (v2)
{
  new(
    a_param,
    b_param="b_default",
    z_param="z_default",
  )::
    {
      a: a_param,
      b: b_param,
      z: z_param,
    },
}

The v2 of the lib.libsonnet will output:

{
   "a": "aaa",
   "b": "zzz",
   "z": "z_default"
}

Add support to patch dashboards

Hi
I've been using this library for a couple of days and I love it, thanks for your work!
I've been trying to make patch-able dashboards, but it's a clumsy and incomplete process. The best I've acomplished is something like this:

// Variables
local defaultConfig = {
  dashboard: {
    name: "test3",
    tags: ['whitebox', 'terceros', 'vpn'],
    time_range: 'now-6h',
  }
};
// Don't touch this
local myConfig = {};

local config = if ! std.objectHas(myConfig, "dashboard") then defaultConfig;

dashboard.new(
  config.dashboard.name,
  tags=config.dashboard.tags,
  time_from=config.dashboard.time_range,
  editable=true,
)

This way, if I don't want to patch it, I just execute jsonnet normally. But if I want to patch, I just have to create a file with the content similar to the defaultConfig variable and execute jsonnet with the --ext-code-file parameter.

But this approach has some limits. It only works for the things that are explicitly exposed. What I'd like is to be able to patch the queries (to be able to modify labels, for example) o to patch the title's panels (to be able to translate the titles, for example).

I've investigated a little bit how would you that, and it seems pretty complex. The usual way to patch doesn't work with this library since the jsonnet using this library doesn't have a top level json.

I'm not sure how would somebody approach to this problem. Maybe doing that dashboard.new doesn't return the complete json and requiring the users of the library to add the first level to it's jsonnet file?

Unsure on how to add a collapsed row

I would like to use the grid layout but I'm not sure on how to add a row collapsed with some panels.

If I do addRow and then I add the panels then the panel inside are not using the grid system (should I use the span/height?).

We are on a Grafana 6.4.4, trying with the default schemaVersion (14) and the latest grafonnet-lib version.

Add repeating in gauges.

I've added the gauge panel previously, however I forgot to add the repeating variables for them to allow multiple panels to be generated when using query variables.
I've linked the PR as well: #167

Support Grafana 6+

Multiple things changed in grafana 6... is there a plan to support these schemas?

Add fieldOptions in gauge

Currently only fieldOptions.calcs is available, I guess decimals/unit and defaults would be extremely useful too.

Make pointradius parametric

Hi all,

Simple request: Can we make pointradius parametric?
Having a predefined 5 is causing us some issues with visibility.
We can add a parameter and just default it to 5 for retro-compatibility.
Does it make sense? In case you guys don't have the time I can fork and add a PR but I am not sure I will get all the docs/tests requirements correctly. ^^ Let me know if you want me to give it a go.

Thank you,
Fabrizio

Generating larger dashboards for Grafana >=5

It appears that grafonnet-lib has an issue when generating larger dashboards without the row elements for Grafana 5 and 6.

As the jsonnet source file becomes larger (e.g. more addPanel fields), the jsonnet execution time gets increasingly slower, up to a point of it apparently hanging wile using all of the CPU until interrupted.

Used Grafana 5 example dashboard from the Readme as a test case.

# As-is from the Readme (some addTemplate blocks and 1 addPanel)
$> time jsonnet -J /path/to/grafonnet-lib example.jsonnet -o example.json
real	0m0.179s
user	0m0.163s
sys	0m0.014s

# With 15 addPanel blocks copy/pasted
real	0m2.439s
user	0m2.406s
sys	0m0.021s

# With 20 addPanel blocks
real	1m38.843s
user	1m36.830s
sys	0m0.267s

# With 30 addPanel blocks
(interrupted after)
real	3m59.107s
user	3m52.272s
sys	0m0.766s

Strangely, this issue is not evident, if enclosing all of these addPanel fields in an addRow field:

# Same 30 addPanels, but inside an addRow:
$> time jsonnet -J /path/to/grafonnet-lib example.jsonnet -o example.json
real	0m0.268s
user	0m0.240s
sys	0m0.018s

Using addRow, however, does not really fix anything. The row implementation changed in Grafana 5 with the introduction of "flexible grid". It appears that grafonnet-lib would still generate pre-Grafana 5 row structure (even with schemaVersion >=16), which cannot be properly imported into Grafana 5/6. When using schemaVersion <16, the resulting dashboard, when imported, does not take into account the specified gridPos directives.

Is this an issue with my approach or grafonnet-lib itself?

singlestat sparklines

Is it possible to enable sparklines with the actual definition of singlestat or should I customize a component to do that?

RUNTIME ERROR: Field does not exist: asciiLower with ksonnet 0.8

$ ks diff --diff-strategy=subset us-central1/default
ERROR Error reading /Users/twilkie/Documents/src/github.com/raintank/deployment_tools/ksonnet/environments/us-central1/default/main.jsonnet: RUNTIME ERROR: Field does not exist: asciiLower
-------------------------------------------------
	/Users/twilkie/Documents/src/github.com/raintank/deployment_tools/ksonnet/vendor/grafonnet/dashboard.libsonnet:25:10-24	object <anonymous>

      if std.asciiLower(graphTooltip) == 'shared_tooltip' then 2

readme typeo

the example git clone has no permissions [1]
we should use it as follow
git clone https://github.com/grafana/grafonnet-lib.git

[1]

Install grafonnet
Clone this git repository:

git clone [email protected]:grafana/grafonnet-lib.git
Then import the grafonnet in your jsonnet code:

elastic search target ?

I'm trying to use some ES as target for a panel
There is any alternative for elastic search target? I assume I can use the target object directly, but It will be nice to have one for ES as other data sources

@roidelapluie

Generated Graph Panel doesn't fetch data

Hi,

I needed help making a Graph panel work using grafonnet. The generated json when imported, creates the dashboard, adds the panel but is unable to fetch any data. However, when I add a query manually on the same panel and use the same argument, it works fine. Can anyone please point out what am I missing? Am using elasticsearch as my datasource, already configured. Grafana v6.5.2, installed grafonnet via homebrew.

My libsonnet template:

local grafana = import 'grafana.libsonnet';
local dashboard = grafana.dashboard;
local elasticsearch = grafana.elasticsearch;
local template = grafana.template;
local graphPanel = grafana.graphPanel;

local jiraTickets =
  graphPanel.new(
    'P0/P1',
    span=6,
    min_span=6,
    format='short',
    fill=0,
    min=0,
    decimals=2,
    datasource='abc',
    legend_values=true,
    legend_min=true,
    legend_max=true,
    legend_current=true,
    legend_total=false,
    legend_avg=true,
    legend_alignAsTable=true,
  ) 
  .addTarget(
    elasticsearch.target(
      '<my_query>',
      '@timestamp',
      id=1,
      metrics=[{
        id:2,
        type: 'count',
      }],
      alias='P0/P1 Count',
      bucketAggs=[{
        field: "timestamp",
        id:3,
        settings: {
          interval: "auto",
          min_doc_count: 0,
          trimEdges: 0
        },
        type: "date_histogram"
      }],
    )
  );

dashboard.new(
  'Generated Jira P0/P1',
  editable=true,
  schemaVersion=18,
  time_from='now-30d',
  tags=['generated'],
)
.addPanels(
  [
    jiraTickets { gridPos: { h: 9, w: 15, x: 0, y: 0 } },
  ]
)

Generated Dashboard after adding an additional query manually on the UI:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 44,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": “abc",
      "decimals": 2,
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 15,
        "x": 0,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "minSpan": 6,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "seriesOverrides": [],
      "spaceLength": 10,
      "span": 6,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "P0/P1 Count",
          "bucketAggs": [
            {
              "field": "timestamp",
              "id": 3,
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "id": 1,
          "metrics": [
            {
              "field": "select field",
              "id": 2,
              "type": "count"
            }
          ],
          "query": "<my_query>",
          "refId": "A",
          "timeField": "timestamp"
        },
        {
          "alias": "Manual",
          "bucketAggs": [
            {
              "field": "timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "<my_query>",
          "refId": "B",
          "timeField": "timestamp"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "P0/P1",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": 0,
          "show": true
        },
        {
          "decimals": 2,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": 0,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "5s",
  "schemaVersion": 21,
  "style": "dark",
  "tags": [
    "generated"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-30d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "Generated Jira P0/P18",
  "uid": "7AIqH6yZz",
  "version": 1
}

No errors on the UI, any pointers would be greatly appreciated.

How to pass arguments in jsonnet tla-code

When creating a json file with grafana library, I want to read variables from jsonnet's CLI or an external file.
I want to replace part of query.
jsonnet's tla-code option
Is there any way to read external files?

dashboard.new (
'test',
schemaVersion = 18,
tags = ['test'],
editable = true,
)
.addTemplate (
template.custom (
name = 'service',
query = query, ★
current = '',
refresh = 'never',
label = 'service',
)
)

tablePanel generates bad target refIds

The first target refId generated by tablePanel is 'A' but the rest are unexpected unicode characters.

Example jsonnet -

local grafana = import 'grafonnet/grafana.libsonnet';
local cloudwatch = grafana.cloudwatch;
local dashboard = grafana.dashboard;
local tablePanel = grafana.tablePanel;

local functionNames = ['function-' + i for i in std.range(1,5)];

local targets = [
  cloudwatch.target(
    region     = 'us-west-1',
    namespace  = 'AWS/Lambda',
    metric     = 'Duration',
    statistic  = 'Average',
    dimensions = {'FunctionName': f}
  ) for f in functionNames
];

tablePanel.new(
  title = 'Test',
).addTargets(targets)

Output -

{
   "columns": [ ],
   "datasource": null,
   "styles": [ ],
   "targets": [
      {
         "dimensions": {
            "FunctionName": "function-1"
         },
         "highResolution": false,
         "metricName": "Duration",
         "namespace": "AWS/Lambda",
         "period": "1m",
         "refId": "A",
         "region": "us-west-1",
         "statistics": [
            "Average"
         ]
      },
      {
         "dimensions": {
            "FunctionName": "function-2"
         },
         "highResolution": false,
         "metricName": "Duration",
         "namespace": "AWS/Lambda",
         "period": "1m",
         "refId": "\u0083",
         "region": "us-west-1",
         "statistics": [
            "Average"
         ]
      },
      {
         "dimensions": {
            "FunctionName": "function-3"
         },
         "highResolution": false,
         "metricName": "Duration",
         "namespace": "AWS/Lambda",
         "period": "1m",
         "refId": "Å",
         "region": "us-west-1",
         "statistics": [
            "Average"
         ]
      },
      {
         "dimensions": {
            "FunctionName": "function-4"
         },
         "highResolution": false,
         "metricName": "Duration",
         "namespace": "AWS/Lambda",
         "period": "1m",
         "refId": "ć",
         "region": "us-west-1",
         "statistics": [
            "Average"
         ]
      },
      {
         "dimensions": {
            "FunctionName": "function-5"
         },
         "highResolution": false,
         "metricName": "Duration",
         "namespace": "AWS/Lambda",
         "period": "1m",
         "refId": "ʼn",
         "region": "us-west-1",
         "statistics": [
            "Average"
         ]
      }
   ],
   "timeFrom": null,
   "timeShift": null,
   "title": "Test",
   "type": "table"
}

Grafonnet-lib repository scope and how to manage third-party ones

Disclaimer
I'm quite new to grafonnet and don't have the full discussion history about this topic.
I'm happy to get more context or other points of view.
This issues comes from the discussion around PR #210 was has finally been declined.

How am I ?
I'm an SRE in a french IT company, trying to advocate grafonnet to dev teams.
I've implemented grafonnet snippet for polystat panel and thought it could be included in grafonnet-lib repository since Polystat is developped and maintained by Grafana. Merge has been declined.

What problem I'm trying to solve ?
I want to ease grafonnet adoption.
This means, identifying and solving frictions which can slow down grafonnet adoption.

What is the problem ?
Currently, the only official grafonnet repository is grafana/grafonnet-lib
Choice has been made to restrict the scope to the core plugins, that is plugins which are enabled in Grafana after vanilla install (and not plugins developed and maintain by grafana).

First issue: this put out of the scope some plugins, developed and maintained by Grafana, but not included in default install.
Example: polystat panel. Grafonnet owns and maintains it, but doesn't provide grafonnet for it.

Third parties plugins, and "non core" ones, are maintained by the community.
They can only be listed in docs/community-plugins.md
Development is made on a best-effort basis, often in dedicated personal repositories.

Second issue: To use them, one has to clone each needed repository, check whether plugins works or are up-to-date. For now, we have only 3 plugins listed. But this makes 3 repositories to watch for.

Having multiple third-party plugins repositories spread the maintenance effort on multiple people. At some point, one could want to handover his responsability. Current setup makes it hard to happen.

Third issue: Some mass-changes aren't currently easy to address because code is spread across multiple repositories.
Having less but clearly identified repositories would ease those kind of changes to quickly happen.

Proposal

  • All plugins developed or maintained by Grafana are eligible for main repository inclusion, whatever their "core" status.
    Grafana should do its best to maintain them and allow community contributions to keep them up-to-date.
  • For third-party plugins, Grafana should setup a dedicated repository, either under Grafana organization or a separate organization clearly identified as being driven by Grafana.
    All third-party grafonnet plugins are eligible for inclusion in this repository, given they respect the prerequisites (code style, doc, tests, etc…) from Grafana.
    Some trusted contributors from community could have write access to this repository to allow reasonable review and merge time.
    This third-party plugin repository is mentionned in grafana/grafonnet-lib documentation so that users can easily find it.
  • For both repositories, tests should be automated using continuous integration to ease reviews and merge operations.
  • When planning breaking changes in Grafana (schema changes, panel property changes, etc), Grafana should open issues in each repositories for relevant plugins so that community has time to address changes before Grafana release.

upgrade to schemaVersion 16

Forgive my ignorance, but is this on the roadmap? Is it worth doing today, or are we waiting for a subsequent/stable schema version to upgrade to? I can potentially help, though I'd need a little bit of guidance.

Looking at the dashboard migration logic, it doesn't seem awful to port. My understanding of what changed:

  1. The grid system was added (already supported here, but not enforced)
  2. Rows are now supported panel types (and panels can be nested)

Syntax error in new cloudwatch target

Hi,

In the newly merged cloudwatch target (thanks @lukaf !) there is a typo. I was migrating my existing dashboards using the new target and I noticed it. I will do a PR soon to fix it.

The error is statistic is actually statistics.

Support for folders

Hey! I'm helping @brancz with the Prometheus Operator Dashboard and want to have our own with grafonnet-lib too.
Awesome experience so far.

In the future I'd like to put all the Prometheus Operator Dashboards for Kubernetes into its own folder. Is this already supported? I can't find anything in the source code...

Thanks!

Add transparency on graph panel

Hi all,

I wanted to have the option to make the graphpanel transparent but it was not implemented. I will do a PR now to add the functionality

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.