Mocking table dataset (not timeserie)


#1

Is there any way to mock-up table-formatted data for testing or demonstrating panel plugins?

The TestDB datasource only supports timeserie-formatted data sets, which seems like an unnecessary limitation.

Also, I notice the ‘Mock Response’ window in the Query Inspector looks like it might allow me to inject mocked-up data - but I can’t figure out how to make this work, not could I find any documentation for this.

Any ideas?


#2

OK, since no-one had any suggestions, I went ahead and created a simple node.js server app to read CSV files to work with the SimpleJSON data source. It’s not production-ready code, but it works for both table and time series data sets.

If anyone else needs something like this for testing and/or demonstration purposes, I recommend taking a look.

With a bit of polishing, it could be used for low-volume production environments too.


#3

You can add the Grafana TestData datasource

image

For older versions it is a little bit different:

Grafana TestData is not enabled by default. To enable it, first navigate to the Plugins section, found in your Grafana main menu. Click the Apps tabs in the Plugins section and select the Grafana TestData App. (Or navigate to http://your_grafana_instance/plugins/testdata/edit to go directly there). Click the enable button to enable. It will now show up in the list of datasources.


#4

Yes - thanks you for the explanation which will probably help other people with similar problems. The trouble is that this data source only supports time-series data sets - that is, a sequence of values of a single metric over time. I was looking for something that supports table data sets, which you cannot do with the Grafana TestData data source.

In the meantime, I created a simple node.js server to read CSV files and present them as table or time series datasets to the SimpleJSON data source. This does what I need, though not quite as trivial to set up as the TestData datasource. If anyone is interested, take a look at https://github.com/michaeldmoore/CSVServer

Cheers,:


#5

Very cool, I’ll give it a spin. Looks very useful in general!