What’s the right way to pull a complete answer to an InfluxQL query over http?
I’m using the acct_gather
plugin for a slurm cluster. It sends resource usage data to an influxdb v1 database. So if I write
#SBATCH --profile=Task
in an sbatch file, it records things like memory, I/O, and CPU usage to the database.
But if I try to ask for that data as a json file, e.g.,...
jobid=12345
curl -G 'http://<ip address>:<port>/query?' \
--data-urlencode "db=myslurmdatabase" \
--data-urlencode 'q=select "value" from /./ where "job"='"'$jobid'"
...then I get a partial response with only one type of measurement ("CPUFrequency"):
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "CPUFrequency",
"columns": [
"time",
"value"
],
"values": [
...
],
"partial": true
}
]
}
]
}
I think this happens for jobs that have run past a certain number of data points.
What I've found
In this thread on github somebody asked:
So how does it work? Do you get a url with the second chunk or does the http response contain multiple json bodies? Is this compatible with the json decoders in browser?
People replied to the effect that modern browsers can handle it, but I don’t think they answered the question directly.
There’s a “chunked” parameter for the
/query
endpoint. The options are eithertrue
(in which case it chunks based on series or 10,000 data points), or a specific number of points (in which case it chunks based on that number). Chunking happens either way. But it’s not clear to me how to get the next chunk.It looks like somebody has written a third-party program that can stream the chunked results from a query. But is it possible with curl, or would I have to use something like this?