You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A collection of utility classes to construct and publish grafana graphs. The library is built ground up to incorporate grafana terminologies.
Dashboard: Represents the final dashboard that is displayed.
Row: A row in grafana. Dashboard consists or many rows.
Panel: A visual display item. A panel could be a graph, single stat or others. A row consists of many panels.
Target: A dot separated graphite string. E.g, a.b.count. A Panel consists of many targets.
Annotations: Lined markers that will annotate a graph (panel). A Dashboard can have annotations added to it.
Templates: Variables that can be included in the state. E.g, a.$dc.b.count (to switch between datacenters). A Dashboard can have templates added to it.
Code to generate the dashboard
You will be able to generate and publish a grafana graph using the following steps.
Step 1: Configure grafana
if you would like grafana to publish your dashboard you need this step. If you do not need grafana to publish your dashboard, you can skip this step.
Alerts are optional. An alert is set on a target, each target added to the panel receives a refId of 'A', 'B', ..., 'Z'.
constconditionOnRequestLowVolume=newCondition().onQuery('A').withEvaluator(1,'lt').withReducer('max');constalert=newAlert({name:'Low volume of requests'});alert.addCondition(conditionOnRequestLowVolume);// ORconstalert=newAlert({name:'Low volume of requests'}).addCondition(conditionOnRequestLowVolume);requestVolume.addAlert(alert);
It is also possible to add an alert by passing it to the Graph constructor