Ibm cloud 无法从IBM IOT基金会在指定的时间范围内检索历史事件

Ibm cloud 无法从IBM IOT基金会在指定的时间范围内检索历史事件,ibm-cloud,iot,Ibm Cloud,Iot,我正在尝试使用检索特定时间范围内的历史事件。 但是,如果我指定API调用的可选开始/结束参数,IOT基金会不会像预期的那样识别它们,并在意外的时间范围内返回事件。 我想知道我是否使用了错误的API,或者它是物联网基金会的bug。 以下是检索过去24小时内事件的代码(test_hist.js)。 (我的凭证参数替换为*s。) 但当我稍后运行相同的代码时,API返回了意外的事件时间段 昨天的11:45被指定为开始参数,但API返回的事件(11:16…)比11:45早 11:45(今天的)被指定为

我正在尝试使用检索特定时间范围内的历史事件。 但是,如果我指定API调用的可选开始/结束参数,IOT基金会不会像预期的那样识别它们,并在意外的时间范围内返回事件。 我想知道我是否使用了错误的API,或者它是物联网基金会的bug。
以下是检索过去24小时内事件的代码(test_hist.js)。
(我的凭证参数替换为*s。)

但当我稍后运行相同的代码时,API返回了意外的事件时间段

  • 昨天的11:45被指定为开始参数,但API返回的事件(11:16…)比11:45早
  • 11:45(今天的)被指定为结束参数,但API没有返回10:23到11:45之间的事件,而是早于10:23的事件
具体如下

    $ node test_hist.js 
    DEBUG: start=1446000327271 : Wed Oct 28 2015 11:45:27 GMT+0900 (JST)
    DEBUG: end  =1446086727271 : Thu Oct 29 2015 11:45:27 GMT+0900 (JST)
    DEBUG: path=/api/v0002/historian/types/HARemoteControl/devices/HARemoteControl001?start=1446000327271&end=1446086727271
    DEBUG: bookmark=1:iotHistorianSessionId=vbazIN0SDWrJTaep06zTipWS1TqbPMv/9m8EEumw5uuL6Gj6FiWl5z9POLeB5xLv; HttpOnly
    DEBUG: Thu Oct 29 2015 08:43:03 GMT+0900 (JST) ... Thu Oct 29 2015 10:22:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 07:03:03 GMT+0900 (JST) ... Thu Oct 29 2015 08:42:13 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 05:23:05 GMT+0900 (JST) ... Thu Oct 29 2015 07:02:06 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 03:43:08 GMT+0900 (JST) ... Thu Oct 29 2015 05:22:05 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 02:03:08 GMT+0900 (JST) ... Thu Oct 29 2015 03:42:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 00:23:03 GMT+0900 (JST) ... Thu Oct 29 2015 02:02:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 22:43:03 GMT+0900 (JST) ... Thu Oct 29 2015 00:22:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 21:13:08 GMT+0900 (JST) ... Wed Oct 28 2015 22:42:13 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 19:33:03 GMT+0900 (JST) ... Wed Oct 28 2015 21:12:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 17:53:03 GMT+0900 (JST) ... Wed Oct 28 2015 19:32:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 16:13:02 GMT+0900 (JST) ... Wed Oct 28 2015 17:52:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 14:33:02 GMT+0900 (JST) ... Wed Oct 28 2015 16:12:05 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 12:56:02 GMT+0900 (JST) ... Wed Oct 28 2015 14:32:02 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 11:16:02 GMT+0900 (JST) ... Wed Oct 28 2015 12:55:02 GMT+0900 (JST) events.length=100 more...
    $
节点:

  • 我的RaspberryPi会定期(每1分钟)发送事件,有时偶尔也会发送。因此,预计1440多个事件将与此代码一起返回
  • 出现此症状后,如果忽略开始和结束参数,则API将按预期返回最后100个事件。这意味着IOT基金会在10:23和11:45之间有事件,但在指定结束参数时没有返回它们。

    $ node test_hist.js -s -e
    DEBUG: start=1446000368159 : Wed Oct 28 2015 11:46:08 GMT+0900 (JST)
    DEBUG: end  =1446086768159 : Thu Oct 29 2015 11:46:08 GMT+0900 (JST)
    DEBUG: path=/api/v0002/historian/types/HARemoteControl/devices/HARemoteControl001
    DEBUG: Thu Oct 29 2015 10:07:06 GMT+0900 (JST) ... Thu Oct 29 2015 11:46:03 GMT+0900 (JST) events.length=100
    $
    
  • 以上3个执行结果都是Bluemix VM(Ubuntu 14.4)的结果,在正常和异常结果之间,我大约在上午10:22在本地Windows PC上运行了相同的代码(test_hist.js)。因此,在我看来,这个API在某些情况下会记住开始/结束参数,并不断用所记住的值替换后续API调用的开始/结束参数


我遇到了类似的问题,返回的数据被截断、过期/时间顺序,并且可能丢失了数据。您可以查看下面的页面,我从2015-01-01到2015-12-31按照IoTF提供的顺序将数据从以下AJAX查询转储到Google表中:

/api/v0002/historian/types/6c84fb90-12c4-11e1-840d-7b25c5ee775a/devices/SX.084.045.224.012?evt_类型=报告:1&开始=1420070400000&结束=1451520000000


结果:

我遇到了类似的问题,返回的数据被截断且过时/时间顺序,并且可能丢失了数据。您可以查看下面的页面,我从2015-01-01到2015-12-31按照IoTF提供的顺序将数据从以下AJAX查询转储到Google表中:

/api/v0002/historian/types/6c84fb90-12c4-11e1-840d-7b25c5ee775a/devices/SX.084.045.224.012?evt_类型=报告:1&开始=1420070400000&结束=1451520000000


结果:

我们正在调查并将很快提供更新。我们仍在研究并已打开ReST API V0002的缺陷我们正在调查并将很快提供更新。我们仍在研究并已打开ReST API V0002的缺陷似乎还有另一个问题,但最初的问题是Bluemix historianAPI不支持已解析的开始/结束参数,根据:。我用上面的测试代码(test_hist.js)确认了此修复。看起来可能还有另一个问题,但原始问题是Bluemix historian API不支持开始/结束参数,根据:。我用上面的测试代码(test_hist.js)确认了这个修复。
    $ node test_hist.js 
    DEBUG: start=1446000327271 : Wed Oct 28 2015 11:45:27 GMT+0900 (JST)
    DEBUG: end  =1446086727271 : Thu Oct 29 2015 11:45:27 GMT+0900 (JST)
    DEBUG: path=/api/v0002/historian/types/HARemoteControl/devices/HARemoteControl001?start=1446000327271&end=1446086727271
    DEBUG: bookmark=1:iotHistorianSessionId=vbazIN0SDWrJTaep06zTipWS1TqbPMv/9m8EEumw5uuL6Gj6FiWl5z9POLeB5xLv; HttpOnly
    DEBUG: Thu Oct 29 2015 08:43:03 GMT+0900 (JST) ... Thu Oct 29 2015 10:22:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 07:03:03 GMT+0900 (JST) ... Thu Oct 29 2015 08:42:13 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 05:23:05 GMT+0900 (JST) ... Thu Oct 29 2015 07:02:06 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 03:43:08 GMT+0900 (JST) ... Thu Oct 29 2015 05:22:05 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 02:03:08 GMT+0900 (JST) ... Thu Oct 29 2015 03:42:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Thu Oct 29 2015 00:23:03 GMT+0900 (JST) ... Thu Oct 29 2015 02:02:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 22:43:03 GMT+0900 (JST) ... Thu Oct 29 2015 00:22:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 21:13:08 GMT+0900 (JST) ... Wed Oct 28 2015 22:42:13 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 19:33:03 GMT+0900 (JST) ... Wed Oct 28 2015 21:12:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 17:53:03 GMT+0900 (JST) ... Wed Oct 28 2015 19:32:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 16:13:02 GMT+0900 (JST) ... Wed Oct 28 2015 17:52:03 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 14:33:02 GMT+0900 (JST) ... Wed Oct 28 2015 16:12:05 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 12:56:02 GMT+0900 (JST) ... Wed Oct 28 2015 14:32:02 GMT+0900 (JST) events.length=100 more...
    DEBUG: Wed Oct 28 2015 11:16:02 GMT+0900 (JST) ... Wed Oct 28 2015 12:55:02 GMT+0900 (JST) events.length=100 more...
    $
$ node test_hist.js -s -e
DEBUG: start=1446000368159 : Wed Oct 28 2015 11:46:08 GMT+0900 (JST)
DEBUG: end  =1446086768159 : Thu Oct 29 2015 11:46:08 GMT+0900 (JST)
DEBUG: path=/api/v0002/historian/types/HARemoteControl/devices/HARemoteControl001
DEBUG: Thu Oct 29 2015 10:07:06 GMT+0900 (JST) ... Thu Oct 29 2015 11:46:03 GMT+0900 (JST) events.length=100
$