-
Notifications
You must be signed in to change notification settings - Fork 18
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
Values could not be parsed to Float64 #3
Comments
To your second question, you can use this in your scrape config to overwrite the metric name (which is just a hidden label called __name__):
This overwrites "value" with "custom_metric_name". |
Thanks for that @spampel If only it would work for me 😂 👍🏻 |
I found the problem, it does not parse strings to float. There is a pull request (#1) fixing some of the problems with this exporter, including yours. You can use this instead and it shoudl work: https://github.com/huiyiqun/json-exporter I tested this and it should solve your problem. |
This is great to hear. Will get this installed and setup tomorrow. Thanks ! |
Hi @spzf, is there a method for querying more than one key from a single source that can be picked up by Prometheus or do I have to setup a url per metric I wish to digest from each json source? |
I've checked out https://github.com/huiyiqun/json-exporter and have gotten a bit further. this is the json I am trying to pull metrics in ; {
I was expecting this to create a new metric label per jsonpath but instead just have a duplicated metric label called "value". Would like to be able to pre-fix each label with something that is unique; I.E; Does that make sense? I am aware that there is a way to rename the metric but cannot see this working in this scenario? Also - genericErrorMessage generates a "Values could not be parsed to Float64" error message when trying to scrape the value - suspect it is not handling the "null" value. |
@VR6Pete Can you post the exact response that you get as return? I might be able to assist you in transforming it in the metrics you want. |
Hi @SPFZ - genericErrorMessage 2018/03/20 13:59:00 () could not be parsed to Float64 |
@VR6Pete From what I understand from the code it does not support querying multiple values. This exporter does: https://github.com/kawamuray/prometheus-json-exporter But you can only read one target and there are 3 open pull request. If I had the time I would extend one of the exporters to support multiple targets and multi jsonpath' . The only limitation then would be the 2000 character limit for the get request from prometheus to the exporter. |
Thanks @SPFZ - I do actually use that exporter for a specific interface I wrote but as you say does not scale beyond that currently. |
@SPFZ or anyone else... Willing to put some funds to help push this forward? Let me know if interested. |
@VR6Pete As said before I was not happy with any of the json exporters in existance, therefore I wrote an exporter specific to my problem in python. |
Is this available on github or are you able to share @SPFZ? |
It is company internal and specific to our problem, but writing an exporter is simple. A good starting tutorial can be found on Brian Brazils blog: https://www.robustperception.io/writing-json-exporters-in-python/ |
Thanks for the reply, I just don’t have the time at the moment to learn python I’m afraid. Still looking for some assistance with getting https://github.com/kawamuray/prometheus-json-exporter upto scratch. |
I have another scenario where the string cannot be converted. json output; {"version":"18.6.1.12"} Console output: 2018/08/13 09:00:24 18.6.1.12(string) could not be parsed to Float64 Web UI ouput from probe results; values is string but cannot be converted to Float64 Just to confirm I am running the branched version SPFZ posted earlier on in this discussion. |
I have set this up but struggling to get it return any data from my feed.
console output states the following:
2018/03/12 11:39:10 Found value 17.8
but when hitting the URL it just displays:
Values could not be parsed to Float64
The json I am trying to query is as follows:
{
"isValid":true,
"validationRuleErrors":[],
"httpStatusCode":200,
"genericErrorMessage":null,
"data":{
"version":"17.8"
}
}
I am able to read httpStatusCode OK, however for other values such as isValid etc... this throws the same error.
Example query:
http://XXXX:9116/probe?target=http://XXXX.com/api/version/?json=%7B%22key%22:%22value%22&jsonpath=$.data.version
Secondly, is there a way to change the metric label from just outputting "value" to give each of the above json keys a unique identifier.
Any ideas ?
The text was updated successfully, but these errors were encountered: