测量

From Senfi Docs
Revision as of 12:18, 31 October 2019 by Huiyan (talk | contribs) (Created page with "请注意,时间戳是指进行读数或测量的时间,而不是指其发送的时间。在某些情况下,会先获取读数,然后再批量发送。在这种情况...")
Jump to: navigation, search

测量是用于表示可以源自设备或复杂系统的时间序列数据。

度量具有名称(用于显示)和代码(用于集成),并且由以下各项组成

  • 时间戳记
  • 标签
  • 参数

测量码

测量码是此测量的唯一标识符。您可以使用小写字母数字字符和下划线来组合测量码。

  • 测量码的命名约定如下: <vendor>_<system>_<version>
  • 例如: nest_thermostat_v1。如果您需要更改测量(例如,添加或删除参数),则应使用增量版本创建新测量,例如,nest_thermostat_v2
测量码在创建后便无法更改。

时间戳记

将测量结果发送到Senfi时,时间戳记表示为tm_source,距离纪元以来的毫秒数。

请注意,时间戳是指进行读数或测量的时间,而不是指其发送的时间。在某些情况下,会先获取读数,然后再批量发送。在这种情况下,测量的时间戳会早于发送时间。

Tags

A tag is like an attribute of the measurement sample. There are 2 types of tags:

Required tags
You can think of required tags as the "composite key" to a row in a database table. That is, the combination of required tags will help you to identify the sensor that produced the measurement.
Non-required tags
Non-required tags act as a form of annotation, or label.

Tag names can be a combination of lowercase alphanumeric characters and underscore. Tag values should be sent as strings. Tag values can be empty ("") but not null.

Metrics

These can be raw values from the sensing device (eg. rain_level), or derived values (eg. is_flooding). You can decide to compute the derived values before sending, or send the raw values to Senfi and make use of computed measurement to calculate it.

Similar to measurement, each metric has a name (for display), and a code (for integration). You should also specify a valid type for the metric.

Name
Any valid text (eg. Rain level)
Code
Combination of lowercase alphanumeric characters and underscore (eg. rain_level)
Type
One of the following: boolean, float, integer, string
Metric type cannot be changed after creation

Next: Rule