Transform 'extract fields' has string value as output type, no way to show in a graph

  • What Grafana version and what operating system are you using?
    9.5.14

  • What are you trying to achieve?
    Displaying data coming from postgresql in format
    [ {time=‘2023-11-17 15:14:12’, metric=“temperature:23.456”},
    {time=‘2023-11-17 15:14:12’, metric=“load:1.234”}
    ]
    so that multiple metrics can be shown in the same graph

  • How are you trying to achieve it?
    I am using the “extract fields” transform with format “key-value pairs”, source “metric”.

  • What happened?
    The fields are extracted as expected, I can see them in table view. Unfortunately, the columns “temperature” and “load” contain values in string format. I cannot build a graph from that.
    Also I have not found a way to convert all metrics to numeric type.
    I could fix that by adding another transformer “convert field type”, but unfortunately it expects named fields, so that every time a new metric value is added, I would have to add it to the convert field type configuration.

  • What did you expect to happen?
    I expected that metric values would be converted to a numeric value, or that there is an option to achieve this. Alternatively a “convert field type” that accepts a wild card syntax for field names would be OK I guess

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Welcome @martinscheffler

Try to use another additional extract for the two other metrics

Fyi, that data ia not a valid json data in case that was the design approach so you are going to run into some issues extracting the data. I would revisit this design and use proper json data as follows

[
	{
		"time": "2023-11-17 15:14:12",
		"metric": "temperature:23.456"
	},
	{
		"time": "2023-11-17 15:14:12",
		"metric": "load:1.234"
	}
]

or even better

[
	{
		"time": "2023-11-17 15:14:12",
		"temperature": "23.456"
	},
	{
		"time": "2023-11-17 15:14:12",
		"load": "1.234"
	}
]

and you get this. in fact if it is proper json postgres has some powerful function you can use to extract the data and not have to do it in grafana