-
Notifications
You must be signed in to change notification settings - Fork 198
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
How to Convert Simple JSON to Prometheus Format #186
Comments
Hi @yaohongkok, Just an example (was also mentioned in #172 (comment) briefly as an alternative solution): Let's say some server provides its availability status in several different ways (
This way, you can keep your prometheus configuration file simple as shown above (don't really need to worry about Just one thing to note from the error you mentioned in the issue: apply enough labels (or the right labels) for uniquely identifying information. In the given example, if |
Hello everyone. Dear @rustycl0ck and @SuperQ, hope you are doing well.
I am creating an issue because I am stuck trying to follow @rustycl0ck's suggestion. I hope someone can shed some light on this matter.
I have the following data in
bad_examples/mydata1.json
and
bad_examples/mydata2.json
I will host this data via a python server:
So, I can get my data when I do the following:
I would like convert statusCode of OK to 0 and statusCode of BAD to 1. This is my expected output:
I am encountering some issues to achieve the above result without using our previously pull request #172.
I tried @rustycl0ck's suggestion and ended up with a simple config known as
config_simple.yml
stored underbad_examples/
:So, I run the json exporter as:
and I make the call to the exporter:
I get the following output:
This is the first issue I encountered.
It seems like the exporter expect the labels to be under the path and therefore it is return empty string. This is one of the reasons why our pull request #172 use the path of "$", which uses the root.
Ok, now let's expand the YML config further to be
bad_examples/config.yml
:Let's set up the exporter again:
Now, let's make a call to the exporter:
I get the following error:
This is issue #2. I looked at the code with extra logging and I cannot really figure out what is happening.
I think the problem here is at the config.yml layer. Maybe I am not familiar enough with how to generate the right YML file. I hope someone can help me with this matter. Thank you.
Or if you see pull request #172 being helpful to solve this problem, this could be a good reason to merge the changes back into this repo.
The text was updated successfully, but these errors were encountered: