I’m pushing to InfluxDB records that look like this
{
"value": 20.0,
"name": "Thermometer 0"
}
To a table called temperature
.
The
tag
field is not used anymore.
I’m trying to have a Time Series that shows the temperatures grouped by the name
key.
I tried by grouping by the name field and then aliasing to $tag_name
but doesn’t appear to be working.
I tried with a bunch of posts of how to do this but I could not find a solution.
Posts I tried to follow to no avail:
Hi there,
I’m using InfluxDB for a Sensor named “Office 1” that measures Temp, Hum, CO2.
When using Grafana the measurements are stored in database “events”.
I then select from Office 1 and have all 3 fields as fields available in Grafana.
However, the Legend shows “Office 1” for each line in the Graph, which is not very helpful.
I’d like to show the field name instead (Temp/Hum/CO2) but there doesn’t seem to be a $field placeholder
for the Alias By field.
How can I do this?
And: Am I do…
Hello,
I’m trying to display custom field name (${__field.name}) in my grafana but for some reason is just showing “Value”
here what I’m getting
[image]
here the original before add ${__field.name}, I want to get just supplies description without this part {prtMarkerSuppliesDescription=
{prtMarkerSuppliesDescription=“Kit mantenimient”}
{prtMarkerSuppliesDescription=“T�ner negro”}
{prtMarkerSuppliesDescription=“Unidad imagen”}
[image]
here my query.
[image]
any advice on how to cust…
(There where other 3 but I cannot post them, since there’s a limit of 2 links per post)
How can I do this?
grant2
April 29, 2024, 11:04pm
2
Hi @quiquelluc
Can you share a sample dataset (5 to 10 records) including the time? The record below does not include time.
{
"value": 20.0,
"name": "Thermometer 0"
}
Yeah, sorry for the delay. The JSON was just a representation of the data. I’m using the rust influxdb
crate.
The code I’m using to push the data looks like this, although I’m not sure how useful this is.
let query = WriteQuery::new(Timestamp::Milliseconds(Utc::now().timestamp_millis(), "temperature")
.add_field("name", name)
.add_field("value", temperature);
As you can see in the images, when querying the two different fields Grafana shows them in different tables, which I can switch between in the dropdown at the center of the screen.
I don’t know what’s up with the name, or why there is a json with an empty tag field. That as far as I know has nothing to do with my code.
do you only have fields name and value
and no tags in your measurement of temperature
?
Yeah so apparently I suck at influxdb. I did not know that I was supposed to use tag for the thermometer name. Using a tag for the name allowed me to use the $tag_name
syntax in Grafana and it worked perfectly fine. Thanks.
1 Like