package tezt-tezos
Create Grafana dashboards.
Grafana configuration.
url
is the base URL of the Grafana API.
api_token
is the bearer token to use in the Authorization header. If not provided, it will try to connect without authenticating (insecure mode).
data_source
is the name of the InfluxDB data source configured in Grafana.
val config_of_json : Tezt_wrapper.JSON.t -> config
Read a Grafana configuration from a JSON value.
Y axes for Grafana panels.
format
is the unit of the axis. A typical example is "s"
, meaning "seconds". See Grafana documentation for other possible values.
type graph = {
title : string;
description : string;
queries : (InfluxDB.select * alias option) list;
interval : duration option;
yaxis_1 : yaxis option;
yaxis_2 : yaxis option;
}
Grafana graph panels.
Queries should use Grafana_time_filter
in their WHERE clause and Grafana_interval
in a GROUP BY time clause to reduce the size of the query. If an interval
is specified, it will represent the minimum accepted by Grafana_interval
to draw the graph.
The GROUP BY time clause should usually also contain a FILL clause to make continuous graphs instead of bunches of dots.
Each query is optionally associated to an alias. This alias will be used to name the resulting curve in the graph key. If this alias is not given, Grafana will deduce it automatically from the query.
Example query:
InfluxDB.select
[Function (MEAN, Field "duration")]
~from:(Measurement "rpc")
~where:Grafana_time_filter
~group_by:(Time {interval = Grafana_interval; tag = None; fill = None})
Grafana panels.
Rows are horizontal separators between graphs, with a title.
Grafana dashboards.
uid
is a unique identifier of your choosing. It will be used in the URL of the dashboard. It must be composed of between 1 and 128 alphanumeric characters, dashes, periods or underscores.
Create or update a dashboard.
If the dashboard already exists, it is deleted first. All version history is lost.
val simple_query :
?tags:(InfluxDB.tag * string) list ->
measurement:InfluxDB.measurement ->
field:InfluxDB.field ->
test:string ->
unit ->
InfluxDB.select
Make a simple SELECT query for a graph panel.
Usage: simple_query
~tags:[("tag1", "value1"), ("tag2", "value2")]
~measurement
~field
~test:test_title
()
Default tags
is an empty list.
This returns the following query:
SELECT MEAN(field)
FROM measurement
WHERE $timeFilter AND test = test_title AND tag1 = value1 AND tag2 = value2
GROUP BY time($__interval) fill(previous)
val simple_graph :
?title:string ->
?description:string ->
?yaxis_format:string ->
?tags:(InfluxDB.tag * string) list ->
?interval:duration ->
measurement:InfluxDB.measurement ->
field:InfluxDB.field ->
test:string ->
unit ->
panel
Make a graph panel from a simple query.
Usage: simple_graph ~measurement ~field ~test ()
The query is built using simple_query
.
Default title
is the measurement name. Default description
is ""
. Default yaxis_format
is s
(seconds). Default tags
is an empty list.
val graphs_per_tags :
?title:string ->
?description:string ->
?yaxis_format:string ->
?interval:duration ->
measurement:InfluxDB.measurement ->
field:InfluxDB.field ->
test:string ->
tags:(InfluxDB.tag * string) list ->
unit ->
panel
Make a graph panel that draws a curve per given tag.
Usage: graphs_per_tags
~measurement
~field
~test:test_title
~tags:[(tag1, value1); (tag2, value2)]
()
This will draw a curve in the resulting graph for each one of the following request:
SELECT MEAN(field)
FROM measurement
WHERE $timeFilter AND test = test_title AND tag1 = value1
GROUP BY time($__interval) fill(previous)
SELECT MEAN(field)
FROM measurement
WHERE $timeFilter AND test = test_name AND tag2 = value2
GROUP BY time($__interval) fill(previous)
Default title
is the measurement name. Default description
is ""
. Default yaxis_format
is s
(seconds). Default tags
is an empty list.