测量

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
测量码在创建后便无法更改。

Timestamp

When sending a measurement to Senfi, timestamp is represented as tm_source, milliseconds since epoch.

Take note that timestamp refers to when the reading or measurement is taken, not when it is sent. There can be cases where readings are taken first, and sent in a batch later. In this case, the timestamp of the measurement will be older than the time of sending.

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