Advanced usage of simpleJson datasource


#1

I’ve successfully integrated a customized version of the simpleJson datasource with the timeseries database my colleagues and I are working on - the one thing I haven’t been able to figure out is how to return non-leaf nodes to Grafana. Or perhaps the simpleJson datasource does not support this?

To be more specific, at the 2:22 mark of Beginners Guid to Building Dashboards Torkel builds a metric query that reads:
apps->backend->backend_01->counters->requests->count

So ‘apps’ and ‘backend’ are non-leaf nodes, and ‘count’ is the leaf node. I want to be able to build similar queries for my currently proprietary (eventually to be open sourced) timeseries-database … but I don’t know how to get my fork of the simpleJson datasource to provide non-leaf nodes to Grafana. The examples I have seen only provide leaf nodes, so this is what I currently have working … but it provides a very cluttered namespace for our users to say the least.

Any advice would be greatly appreciated.


#2

To answer my own question, different datasources work differently and the leaf-node vs non-leaf-node distinction is not shared by all datasources by any means. Thus if your datasource requires leaf nodes, you are going to have to dive in and learn how to write a datasource.


#3

To be pedantic - you are going to have to jump in and learn how to write a “datasource plugin”. And to be clear - the simpleJson datasource-plugin supports only a flat namespace which extends only 1 level deep (i.e., no leaf nodes).