Configuration file¶
A report is declared entirely within a YAML file consisting of a few main
sections: datasources
, views
, and outputs
. In each section, you
can declare as many plugin instances as you wish (to e.g., declare multiple
database Datasources or multiple Plot visualizations in your report). As dictated by the YAML spec, duplicate keys (IDs) are
not allowed; ensure that each plugin instance has its own ID unique to its
section.
Note
It is possible to specify multiple configuration files when generating a report. In this case, the configurations are merged together, with the last file taking priority:
kpireport -c base-config.yaml -c extra-config.yaml
A full example¶
For more examples see Examples.
---
title: My report
datasources:
db:
plugin: mysql
args:
host: 127.0.0.1
jenkins:
plugin: jenkins
args:
host: 127.0.0.1:8000
views:
line_plot:
title: A line plot
plugin: plot
args:
# Note that this refers to the "db" datasource registered above.
datasource: db
query: |
select time, value from my_db.my_table
where time > {from} and time < {to}
results_table:
title: A table of values
plugin: table
args:
# Note that this refers to the "db" datasource registered above.
datasource: db
query: |
select count(value), value from my_db.my_table
where time > {from} and time < {to}
group by value
outputs:
mail:
plugin: smtp
args:
smtp_host: 127.0.0.1
smtp_port: 1025
Schema¶
Configuration file¶
https://kpi-reporter.readthedocs.io/page/configuration.schema.json |
||
type |
object |
|
properties |
||
|
Title of the report. |
|
type |
string |
|
|
The report interval in days. This value is only used if start_date is not explicitly defined. |
|
type |
integer |
|
default |
7 |
|
|
Beginning of reporting period. |
|
type |
string |
|
default |
End date minus the number of dates in interval_days. |
|
format |
date |
|
|
End of reporting period. |
|
type |
string |
|
default |
Current date. |
|
format |
date |
|
|
||
|
Set of named datasource instances; the keys define the IDs. |
|
type |
object |
|
additionalProperties |
||
|
Set of named view instances; the keys define the IDs. |
|
type |
object |
|
additionalProperties |
||
|
Set of named output driver instances; the keys define the IDs. |
|
type |
object |
|
additionalProperties |
||
additionalProperties |
False |
theme¶
type |
object |
|
properties |
||
|
Number of columns in view grid layout. |
|
type |
integer |
|
default |
6 |
|
|
Width of single column in view grid layout, in pixels. |
|
type |
integer |
|
default |
86 |
|
|
Path to directory with additional theme assets. |
|
type |
string |
|
additionalProperties |
False |
datasource¶
type |
object |
|
properties |
||
|
Name of datasource plugin to use. |
|
type |
string |
|
|
type |
object |
additionalProperties |
True |
|
additionalProperties |
False |
view¶
type |
object |
|
properties |
||
|
Name of view plugin to use. |
|
type |
string |
|
|
type |
object |
additionalProperties |
True |
|
|
Optional headline title for the view. |
|
type |
string |
|
|
Optional description for the view. |
|
type |
string |
|
|
Number of grid columns to take up. |
|
type |
integer |
|
default |
Total number of columns defined in theme (full bleed). |
|
additionalProperties |
False |
output¶
type |
object |
|
properties |
||
|
Name of output driver plugin to use. |
|
type |
string |
|
|
type |
object |
additionalProperties |
True |
|
additionalProperties |
False |
View instances¶
The View instances defined in the views
section define what is rendered in
the final report. Each view is placed into a layout in the order in which they
are defined, i.e., the first declared View will show at the top, and the last
will show at the bottom.
The report layout follows a simple grid system with 6 columns. By default, Views
will each take the full width. However, you can change this with the cols
configuration option. For example, consider this configuration:
views:
view_a:
view_b:
cols: 2
view_c:
cols: 4
view_d:
view_e:
cols: 3
view_f:
cols: 3
The views would be rendered in the report like this:
View A
View B
View C
View D
View E
View F