Score:1

Display metric for multiple servers on a single grafana panel, using a Snowflake datasource populated from Kafka

ps flag

I have a collection of servers which submit metrics to a single kafka topic. This data is stored as a row in a snowflake database in this format:

{
  "disk_util": 47.7,
  "location": "location1",
  "timestamp": "1683703169378"
}

I'm using this snowflake plugin: https://github.com/michelin/snowflake-grafana-datasource

What I'm trying to do is represent this disk_util metric on a single grafana panel.

I have created a variable named locations using this query:

SELECT LOWER(JSON_EXTRACT_PATH_TEXT(RECORDS, 'location')) FROM METRICS

The panel query:

SELECT
  INSERT_TIME as time,
  to_number(JSON_EXTRACT_PATH_TEXT(RECORDS, 'disk_util'), 10, 1)
FROM
  METRICS
WHERE
  $__timeFilter(INSERT_TIME)
AND
  JSON_EXTRACT_PATH_TEXT(RECORDS, 'location') IN (${locations:singlequote})

The problem is I don't know how to get each location to appear as it's own plot line on one panel as his query mashes it all together on one line when I select multiple locations.

Score:0
za flag

Just add location coulmn to your select, so Grafana can actually differentiate between metrics.

Something like this should help:

SELECT
  INSERT_TIME as time,
  to_number(JSON_EXTRACT_PATH_TEXT(RECORDS, 'disk_util'), 10, 1),
  JSON_EXTRACT_PATH_TEXT(RECORDS, 'location')
FROM
  METRICS
WHERE
  $__timeFilter(INSERT_TIME)
AND
  JSON_EXTRACT_PATH_TEXT(RECORDS, 'location') IN (${locations:singlequote})
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.