Can't extract labels or values
kotyara85 opened this issue · 1 comments
kotyara85 commented
Hey there,
Here's my config
modules:
default:
metrics:
- name: status
type: object
help: status
path: '$.[*]'
labels:
upstream: '{ .status }'
values:
running: 1
json:
[
{
"node": "rabbit@localhost",
"exchange": "node.direct",
"upstream_exchange": "node.direct",
"type": "exchange",
"vhost": "/",
"upstream": "node",
"id": "f2b17dfd",
"status": "running"
},
{
"node": "rabbit@localhost",
"exchange": "node.topic",
"upstream_exchange": "node.topic",
"type": "exchange",
"vhost": "/",
"upstream": "node",
"id": "a96b8f40",
"status": "running"
}
]
exporter says this -
ts=2023-03-04T19:12:11.304Z caller=collector.go:155 level=error msg="Failed to extract label value" err="status is not found" path="{ .status }" data="\"$.[*]\""
I have no issues extracting values in jsonpath playground using my query.
Any help is appreciated. Thanks
ruben-rodriguez commented
Hello! 👋🏻
I did a quick check with your data and the following configuration works:
modules:
default:
metrics:
- name: status
type: object
help: status
path: '{$.*}'
labels:
node: '{$.node}'
id: '{$.id}'
upstream: '{$.status}'
values:
running: 1
Note that to avoid collected metric "status_running" { label:<name:"upstream" value:"running" > untyped:<value:1 > } was collected before with the same name and label values
I added some more lables so the items collected are unique for your data input.