-
Notifications
You must be signed in to change notification settings - Fork 7
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
Program panics when serde_json is built with arbitrary_precision feature #14
Comments
Thank you for submitting this issue. As per several issues in the I will have to spend some more time to dig into the Prometheus API and see in which cases it returns a string or a float. As far as I remember most response types return a float within a string because a query could in theory return a string value instead of a scalar, as documented here. But none of the the Prometheus endpoints ever return a string that does not contain a float. Be that as it may, maybe we can just get rid of the untagged enum that is currently used in
I think I will stick to the current strategy of deserializing to |
Update: I changed the API a little to eliminate a "helper" enum in the {
"groups": [
{
"rules": [
{
"alerts": [
{
"activeAt": "2018-07-04T20:27:12.60602144+02:00",
"annotations": {
"summary": "High request latency"
},
"labels": {
"alertname": "HighRequestLatency",
"severity": "page"
},
"state": "firing",
"value": "1e+00"
}
],
"annotations": {
"summary": "High request latency"
},
"duration": 600,
"health": "ok",
"labels": {
"severity": "page"
},
"name": "HighRequestLatency",
"query": "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5",
"type": "alerting",
"evaluationTime": 0.000312805,
"lastEvaluation": "2023-10-05T19:51:25.462004334+02:00",
"keepFiringFor": 60
},
{
"health": "ok",
"name": "job:http_inprogress_requests:sum",
"query": "sum by (job) (http_inprogress_requests)",
"type": "recording",
"evaluationTime": 0.000256946,
"lastEvaluation": "2023-10-05T19:51:25.052982522+02:00"
}
],
"file": "/rules.yaml",
"interval": 60,
"limit": 0,
"name": "example",
"evaluationTime": 0.000267716,
"lastEvaluation": "2023-10-05T19:51:25.052974842+02:00"
}
]
} In this instance members of the However I'm hesitant to change the deserialize procedure here because a different implementation that does not use an enum (but e.g. an intermediary I will think this over again soon, but for now this issue seems to be blocked on this which in turn depends on this. |
Description
Program panics when serde_json is built with arbitrary_precision feature
To reproduce
Cause
prometheus-http-query/src/response.rs
Line 322 in 45422c0
My opinion
This is a bug in the current crate.
I believe there is no need to convert String to F64, as that is the prerogative of those who really need it.
On the other hand, if contributors wish not to fix this, the correct operation of the crate with arbitrary_precision feature should be implemented.
The text was updated successfully, but these errors were encountered: