Difference between revisions of "Measurement"

From Senfi Docs
Jump to: navigation, search
(Marked this version for translation)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
<translate>
 +
<!--T:1-->
 
A '''measurement''' is used to represent time-series data that can originate from a device or a complex system.
 
A '''measurement''' is used to represent time-series data that can originate from a device or a complex system.
  
 +
<!--T:2-->
 
A measurement has a ''name'' (for display) and ''code'' (for integration), and is made up of
 
A measurement has a ''name'' (for display) and ''code'' (for integration), and is made up of
 
* Timestamp
 
* Timestamp
Line 6: Line 9:
 
* Metrics
 
* Metrics
  
=== Measurement Code ===
+
=== Measurement Code === <!--T:3-->
 
A measurement code is a unique identifier of this measurement. You can use a combination of lowercase alphanumeric characters and underscore.
 
A measurement code is a unique identifier of this measurement. You can use a combination of lowercase alphanumeric characters and underscore.
 
* The naming convention of a measurement code is as follows: <tt><vendor>_<system>_<version></tt>
 
* The naming convention of a measurement code is as follows: <tt><vendor>_<system>_<version></tt>
* For example: <tt>nest_thermostat_v1</tt>. If you need to make changes to the measurement (eg. adding or removing metrics), you should create a new measurement with an incremented version, eg. <tt>nest_thermostat_v2</tt>.
+
* For example: <tt><tvar|nest_thermostat_v1>nest_thermostat_v1</></tt>. If you need to make changes to the measurement (eg. adding or removing metrics), you should create a new measurement with an incremented version, eg. <tt><tvar|nest_thermostat_v2>nest_thermostat_v2</></tt>.
 
+
</translate>
<div class="important">A measurement code cannot be changed after creation</div>
+
<div class="important"><translate><!--T:4--> A measurement code cannot be changed after creation</translate></div>
 
+
<translate>
=== Timestamp ===
+
=== Timestamp === <!--T:5-->
When sending a measurement to Senfi, timestamp is represented as <tt>tm_source</tt>, milliseconds since epoch.
+
When sending a measurement to Senfi, timestamp is represented as <tt><tvar|tm_source>tm_source</></tt>, milliseconds since epoch.
  
 +
<!--T:6-->
 
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.
 
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 ===
+
=== Tags === <!--T:7-->
 
A tag is like an attribute of the measurement sample. There are 2 types of 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.
 
; 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.
 
; Non-required tags: Non-required tags act as a form of annotation, or label.
  
 +
<!--T:8-->
 
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'''.
 
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 ===
+
=== Metrics === <!--T:9-->
  
These can be raw values from the sensing device (eg. <tt>rain_level</tt>), or derived values (eg. <tt>is_flooding</tt>). You can decide to compute the derived values before sending, or send the raw values to Senfi and make use of [[Computed_measurement|computed measurement]] to calculate it.
+
<!--T:10-->
 +
These can be raw values from the sensing device (eg. <tt><tvar|rain_level>rain_level</></tt>), or derived values (eg. <tt><tvar|is_flooding>is_flooding</></tt>). You can decide to compute the derived values before sending, or send the raw values to Senfi and make use of [[Computed_measurement|computed measurement]] to calculate it.
  
 +
<!--T:11-->
 
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.
 
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'')
 
; Name: Any valid text (eg. ''Rain level'')
; Code: Combination of lowercase alphanumeric characters and underscore (eg. <tt>rain_level</tt>)
+
; Code: Combination of lowercase alphanumeric characters and underscore (eg. <tt><tvar|rain_level>rain_level</></tt>)
 
; Type: One of the following: boolean, float, integer, string
 
; Type: One of the following: boolean, float, integer, string
 +
</translate>
 +
<div class="important"><translate><!--T:12--> Metric type cannot be changed after creation</translate></div>
  
<div class="important">Metric type cannot be changed after creation</div>
+
<span class="right"><translate><!--T:13--> [[Rule|Next: Rule]]</translate></span>
 
 
<span class="right">[[Rule|Next: Rule]]</span>
 

Latest revision as of 14:41, 17 October 2019

A measurement is used to represent time-series data that can originate from a device or a complex system.

A measurement has a name (for display) and code (for integration), and is made up of

  • Timestamp
  • Tags
  • Metrics

Measurement Code

A measurement code is a unique identifier of this measurement. You can use a combination of lowercase alphanumeric characters and underscore.

  • The naming convention of a measurement code is as follows: <vendor>_<system>_<version>
  • For example: nest_thermostat_v1. If you need to make changes to the measurement (eg. adding or removing metrics), you should create a new measurement with an incremented version, eg. nest_thermostat_v2.
A measurement code cannot be changed after creation

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