A few weeks ago we released External datasets for Dashbuilder. At that time a limited type of JSON was supported, now external datasets are more powerful than ever supporting any JSON format, CSV and metrics.
External datasets are the source of data that are outside Dashbuilder, hence they can be loaded on client side, removing the requirement of a backend to run dashbuilder.
In this post we will share all the new features added to external datasets. By the way, you can try the new features in a quick-try editor.
External DataSets improvements
External datasets now support the following new features:
- Headers: It is possible to declare headers. This is important to provide bearer tokens or any custom header
- Columns: As stated in the announcement post, column information can be provided on the JSON itself otherwise dashbuilder “guess” the type for the columns and give it a generic name. Now it is possible to declare the columns to override the values coming from the JSON.
- Transformation: Most of the cases the JSON you want to use will not be in the formats supported by Dashbuilder. To overcome this we now support transform expressions. Our selected tool is JSONata, but there are discussions to support jq in future versions.
The transform expression can be provided using the field expression. The result expression will be applied on the input JSON and the result must be a JSON two dimension array. To find the right expression for your JSON you can use the online JSONata editor.
More than simply transforming the input to an array, the support to expressions is also important to cover edge cases of a source and apply complex changes to the original source. Check JSONata documentation for more information.
- Inline JSON: You may not have access to the dataset during development. In this case you can use the new content field to declare an inline JSON two dimensional array that will serve as the dataset.
New supported formats
JSON is already supported by external datasets, and to extend the power of external datasets we introduced two new formats that are supported on the client (without the requirement of a backend):
- CSV: Dashbuilder now has experimental support for CSV as the external data set. The only format it supports is the specified in RFC 4180 with the following limitations:
- The first line, supposedly the header, is always skipped
- Fields with line breaks are not supported
- Metrics: Nowadays Prometheus is the standard for keeping track of metrics of an application. It is possible to grab data directly from Prometheus REST API Using JSON and transformation. There are cases where the service is not connected to Prometheus and users may want to read directly from the metrics source, for this reason we transform content from URLs ending with “metrics” as a dataset, which makes it possible to read metrics without the need of a Prometheus installation.
Bear in mind that it only reads a snapshot of the metrics, to keep the history of metrics you will still need a Prometheus.
All these new external dataset formats are internally handled as a JSON two dimensional array, which means that you can still transform it using JSONata.
In this post we shared the new features available in the latest Dashbuilder release. Soon we will share real data visualizations and dashboards using popular APIs. Stay tuned!