#Parsing Grafana Webhook ValueString

4 messages · Page 1 of 1 (latest)

worldly sonnet
#

I'm parsing a Grafana data structure that looks like

[ 
 var='B20'        metric='artnet_fixture_status{instance=\"127.0.0.1:8000\", \
 job=\"artnet\", uid=\"6574:1B6A6254\"}' 
 labels=
 {
  __name__=artnet_fixture_status, 
  instance=127.0.0.1:8000, 
  job=artnet, uid=6574:1B6A6254
 } value=0 
]``` which is like... almost json? am i missing a very obvious way to parse this? my ideal is a HashMap<String, String> from the keys and values in the `labels` map, eg
```rs
HashMap::from(
[
("name".to_string(), "artnet_fixture_status".to_string()), 
("instance".to_string(), "127.0.0.1:8000".to_string()),
("job".to_string(), "artnet".to_string()),
("uid".to_string(), "6574:1B6A6254".to_string()),
]);
``` etc
cunning field
#

That is indeed almost json. If you're using a crate, it might have support for using serde. Else, you get to write a parser.

worldly sonnet
#

Oh joy

#

No crate