ATEST-311

This commit is contained in:
Fabian Märki
2016-03-08 18:05:09 +01:00
parent 80cc0acc2d
commit d50425082a
9 changed files with 321 additions and 269 deletions

100
Readme.md
View File

@ -125,33 +125,25 @@ Queries are applied to a range. The following types of ranges ranges are support
```json
"range":{
"startDate":"2015-08-06T18:00:00.000",
"startNanos":0,
"endDate":"2015-08-06T18:59:59.999",
"endNanos":999999
}
```
- **startDate**: The start date of the time range (ISO8601 format (YYYY-MM-DDThh:mm:ss.sTZD e.g. 1997-07-16T19:20:30.475+02:00 (omitting +02:00 falls back to the local time zone)).
- **[startNanos]**: The optional nanosecond offset to the milliseconds (range [0..999999]).
- **endDate**: The end date of the time range.
- **[endNanos]**: The optional nanosecond offset.
### By Time
```json
"range":{
"startMillis":0,
"startNanos":0,
"endMillis":100,
"endNanos":999999
"startSeconds":"0.0",
"endSeconds":"1.000999999"
}
```
- **startMillis**: The start time of the range in milliseconds since January 1, 1970 (the UNIX/JAVA epoch).
- **[startNanos]**: The optional nanosecond offset to the milliseconds (range [0..999999]).
- **endMillis**: The end time of the range.
- **[endNanos]**: The optional nanosecond offset.
- **startSeconds**: The start time of the range in seconds since January 1, 1970 (the UNIX epoch) as a decimal value including fractional seconds.
- **endSeconds**: The end time of the range in seconds since January 1, 1970 (the UNIX epoch) as a decimal value including fractional seconds.
<a name="query_channel_names"/>
@ -235,44 +227,36 @@ The following examples build on waveform data (see below). They also work for sc
"channel":"Channel_01",
"data":[
{
"iocMillis":0,
"iocNanos":0,
"iocSeconds":"0.000000000",
"pulseId":0,
"globalMillis":0,
"globalNanos":0,
"globalSeconds":"0.000000000",
"shape":[
4
],
"value":[1,2,3,4]
},
{
"iocMillis":10,
"iocNanos":0,
"iocSeconds":"0.010000000",
"pulseId":1,
"globalMillis":10,
"globalNanos":0,
"globalSeconds":"0.010000000",
"shape":[
4
],
"value":[2,3,4,5]
},
{
"iocMillis":20,
"iocNanos":0,
"iocSeconds":"0.020000000",
"pulseId":2,
"globalMillis":20,
"globalNanos":0,
"globalSeconds":"0.020000000",
"shape":[
4
],
"value":[3,4,5,6]
},
{
"iocMillis":30,
"iocNanos":0,
"iocSeconds":"0.030000000",
"pulseId":3,
"globalMillis":30,
"globalNanos":0,
"globalSeconds":"0.030000000",
"shape":[
4
],
@ -316,10 +300,8 @@ See JSON representation of the data above.
```json
{
"range":{
"startMillis":0,
"startNanos":0,
"endMillis":30,
"endNanos":999999
"startSeconds":"0.0",
"endSeconds":"0.030999999"
},
"channels":[
"Channel_01"
@ -330,7 +312,7 @@ See JSON representation of the data above.
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"range":{"startMillis":0,"startNanos":0,"endMillis":30,"endNanos":999999},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"range":{"startSeconds":"0.0","endSeconds":"0.030999999"},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
```
###### Response
@ -345,9 +327,7 @@ See JSON representation of the data above.
{
"range":{
"startDate":"1970-01-01T01:00:00.000",
"startNanos":0,
"endDate":"1970-01-01T01:00:00.030",
"endNanos":999999
"endDate":"1970-01-01T01:00:00.030"
},
"channels":[
"Channel_01"
@ -360,7 +340,7 @@ Supported format is ISO8601 *YYYY-MM-DDThh:mm:ss.sTZD* (e.g. *1997-07-16T19:20:3
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"range":{"startDate":"1970-01-01T01:00:00.000","startNanos":0,"endDate":"1970-01-01T01:00:00.030","endNanos":999999},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"range":{"startDate":"1970-01-01T01:00:00.000","endDate":"1970-01-01T01:00:00.030"},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
```
###### Response
@ -375,10 +355,8 @@ See JSON representation of the data above.
{
"backend":"archiverappliance",
"range":{
"startMillis":0,
"startNanos":0,
"endMillis":30,
"endNanos":999999
"startSeconds":"0.0",
"endSeconds":"0.030999999"
},
"channels":[
"Channel_01"
@ -392,7 +370,7 @@ Archiver Appliance supports queries by *time range* and *date range* only (as it
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"dbmode":"archiverappliance","range":{"startMillis":0,"startNanos":0,"endMillis":30,"endNanos":999999},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"dbmode":"archiverappliance","range":{"startSeconds":"0.0","endSeconds":"0.030999999"},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
```
###### Response
@ -453,10 +431,8 @@ curl --compressed -H "Content-Type: application/json" -X POST -d '{"compression"
"fields":[
"channel",
"pulseId",
"iocMillis",
"iocNanos",
"globalMillis",
"globalNanos",
"iocSeconds",
"globalSeconds",
"shape",
"eventCount",
"value"
@ -464,10 +440,12 @@ curl --compressed -H "Content-Type: application/json" -X POST -d '{"compression"
}
```
It is possible to request the time in seconds (since January 1, 1970 (the UNIX epoch) as a decimal value including fractional seconds - using fields *globalSeconds* and *iocSeconds*) or in milliseconds (since January 1, 1970 (the JAVA epoch) - using fields *globalMillis* and *iocMillis*)
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"responseFormat":"csv","range":{"startPulseId":0,"endPulseId":4},"channels":["channel1","channel2"],"fields":["channel","pulseId","iocMillis","iocNanos","globalMillis","globalNanos","shape","eventCount","value"]}' http://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"responseFormat":"csv","range":{"startPulseId":0,"endPulseId":4},"channels":["channel1","channel2"],"fields":["channel","pulseId","iocSeconds","globalSeconds","shape","eventCount","value"]}' http://data-api.psi.ch/sf/query
```
###### Response
@ -475,17 +453,17 @@ curl -H "Content-Type: application/json" -X POST -d '{"responseFormat":"csv","ra
The response is in CSV.
```text
channel;pulseId;iocMillis;iocNanos;globalMillis;globalNanos;shape;eventCount;value
testChannel1;0;0;0;0;0;[1];1;0
testChannel1;1;10;0;10;0;[1];1;1
testChannel1;2;20;0;20;0;[1];1;2
testChannel1;3;30;0;30;0;[1];1;3
testChannel1;4;40;0;40;0;[1];1;4
testChannel2;0;0;0;0;0;[1];1;0
testChannel2;1;10;0;10;0;[1];1;1
testChannel2;2;20;0;20;0;[1];1;2
testChannel2;3;30;0;30;0;[1];1;3
testChannel2;4;40;0;40;0;[1];1;4
channel;pulseId;iocSeconds;globalSeconds;shape;eventCount;value
testChannel1;0;0.000000000;0.000000000;[1];1;0
testChannel1;1;0.010000000;0.010000000;[1];1;1
testChannel1;2;0.020000000;0.020000000;[1];1;2
testChannel1;3;0.030000000;0.030000000;[1];1;3
testChannel1;4;0.040000000;0.040000000;[1];1;4
testChannel2;0;0.000000000;0.000000000;[1];1;0
testChannel2;1;0.010000000;0.010000000;[1];1;1
testChannel2;2;0.020000000;0.020000000;[1];1;2
testChannel2;3;0.030000000;0.030000000;[1];1;3
testChannel2;4;0.040000000;0.040000000;[1];1;4
```
##### Querying for Specific Fields
@ -735,8 +713,8 @@ Array value [aggregations](https://github.psi.ch/projects/ST/repos/ch.psi.daq.qu
"aggregations":["min","max","mean"],
"fields":["globalMillis","value"],
"range":{
"globalMillis":0,
"globalMillis":3
"startSeconds":"0.0",
"endSeconds":"0.030000000"
},
"channels":[
"Channel_01"
@ -747,7 +725,7 @@ Array value [aggregations](https://github.psi.ch/projects/ST/repos/ch.psi.daq.qu
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"binSize":10,"aggregationType":"value","aggregations":["min","max","mean"],"fields":["globalMillis","value"],"range":{"globalMillis":0,"globalMillis":3},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"binSize":10,"aggregationType":"value","aggregations":["min","max","mean"],"fields":["globalMillis","value"],"range":{"startSeconds":"0.0","endSeconds":"0.030000000"},"channels":["Channel_01"]}' http://data-api.psi.ch/sf/query
```
###### Response