Skip to content

[add]: Can obtain multiple values from one request #5

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[add]: Can obtain multiple values from one request #5

wants to merge 1 commit into from

Conversation

sergiosanche
Copy link

It can obtain multiple values from one request. Sometimes in the json there are more than one value to get so this change let us to it.

The target now looks this way:
http://localhost:9116/probe?target=http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D&jsonpath.nanoseconds=$.parse_time_nanoseconds&jsonpath.size=$.size

We must provide:

  • target, as usual.
  • jsonpath.[prometheus_metric_name]=[json_path]

The last param can be more than one time and will create as many metrics as we define.

E.g:

nagraops@debian-nagraops:~/repo/monitoring/json-exporter$ curl "http://localhost:9116/probe?target=http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D&jsonpath.parse_time_nanoseconds=$.parse_time_nanoseconds&jsonpath.size=$.size"
# HELP parse_time_nanoseconds Retrieved value
# TYPE parse_time_nanoseconds gauge
parse_time_nanoseconds 41996
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 1
# HELP size Retrieved value
# TYPE size gauge
size 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant