0
votes

I have a query (using CloudWatch as a data source) that retrieves a dataset that includes a count of certain event types - fields x, y, z | stats count() by x

the result returned by the query (e.g. if I run the query in log insights):

x   |  count()
-------------
Foo | 16
Bar | 3

(So the aggregation of stats is run in CW Logs). I want to represent this in Grafana in the same way it is shown above, but when I use the query with a table panel, the results are populated into a drop-down selector, and the table only shows 1 row - e.g. Foo 16 and I need to select which row I want to display in the table.

What is the best way to show all results? I'm not sure whether I should be leaving the stats function off the data query and doing the aggregation / count on Grafana side, or if I am using the wrong panel type / visualation and the query is right (looking on which approach would be best here if both are possible).

thanks in advance.

2

2 Answers

1
votes

I encountered this same issue with Grafana 7.0.0.

When parsing an arrayed query response using the Grafana "Table" visualization, the drop-down result selector is a feature of the v7+ versions. The Grafana Explore functions apparently use the older table visualization, which is bundled in V7 versions as "table-old". The table-old visualization should return all query results as rows in the table, without a selector.

0
votes

It is also possible to click on "Inspect" and then click on the JSON tab. remove the below field from the JSON:

 "statsGroups": [
        ...
      ]

NOTE 1: it is sometimes annoying that when editing the panel it is added back automatically

UPDATE

A more clean solution (but sometimes limiting) is to use the "Merge" transformation