-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonpath filter for root level key-value #102
Comments
Try this: '{$[?(@.status=="running")]}' |
thanks for your reply, but it's not working.
|
I had the same issue today, no solution after 1 hour of struggling. Did you find a way to solve this ? |
+1 Also having this issue |
+1 The same issue. |
3 similar comments
+1 The same issue. |
+1 The same issue. |
+1 The same issue. |
anyone find the answer to this? Wasn't able to figure it out :( |
+1 The same issue. |
Anyone has been able to figure this out yet? |
Any updates here? |
Given the same {
"status": "running"
} I was able to extract status and apply it as label as suggested here My ---
modules:
health:
metrics:
- name: service_status
type: object
help: Service Status
path: '{$}'
labels:
status: '{ .status }'
values:
availability: 1 To the root path in JSONPath is |
+1 The same issue here. Solution shown above is looking at list structure, not nested objects, which seems to be the main issue for the json-exporter |
+1 The same issue. |
+1 |
1 similar comment
+1 |
+1 same here |
Looks like to filter in JSONPath, you need a list. {"status": "running"} => [{ "status": "running"}] so it's impossible to do it with plain JSONPath |
Hi, i got some problem when trying to use jsonpath filter in root level key-value.
what i want:
for the example json:
if
status == "running"
, set static metric = 1if
status == "stopped"
, set static metric = 0my config.yml:
what did i see
http://localhost:7979/probe?target=http://host.docker.internal:8000/status.json
returns me nothing but white screen,and get following error in console
other info
the path
$.[?($.status=="running")]
was tested successfully in https://jsonpath.herokuapp.com/,but failed in https://jsonpath.com/.
and i also tried other path like
.[?($.status=="running")]
,.[?(@.status=="running")]
, and$.[?(@.status=="running")]
but none of them working but got the same error message.looking for your help and thanks in advance
The text was updated successfully, but these errors were encountered: