Metrics
6.15.0To improve the efficiency of your business processes, you often find the need to collect extensive data about the daily workflows and routines within your company. You want to see the specific actions your employees take and the choices they make when achieving outstanding results or when performing poorly, so that you can optimize your processes or tools. Metrics data is also useful for technical purposes like monitoring how well your hardware infrastructure handles the workload or to track the performance of your applications.
The Metrics API is accessible through the io.metrics object.
APIobject
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the system. |
||
| id | string | ID of the system in the format |
||
| metrics | Metric[] | Returns an array of metrics. |
||
| name | string | Returns the name of the system. |
||
| parent | System | Returns the parent system of the current system. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the system. |
||
| root | System | The root system in the repository. |
||
| subSystems | System[] | Returns an array of the subsystems. |
Methods
featureMetricmethod
Signature
(feature: string, action: string, value: string) => void
Description
The feature metric is under the subsystem with name "reporting".
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| feature | string | The main feature you want to gather information about. |
|
| action | string | The specific action you want to track. |
|
| value | string | The payload of the metric - the value(s) you are interested in. |
Example
io.metrics.featureMetric("export", "exportToExcel", "file.xls");
getAggregateStatemethod
Signature
() => SystemStateInfo[]
Description
Returns the aggregate system state represented as an array of the states of all subsystems.
getStatemethod
numberMetricmethod
Signature
(definition: string | MetricDefinition, value: number) => NumberMetric
Description
Creates a new Number Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | number | Metric value. |
objectMetricmethod
Signature
(definition: string | MetricDefinition, value: any) => ObjectMetric
Description
Creates a new Object Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | any | Metric value. |
setStatemethod
Signature
(state: number, description?: string) => void
Description
Updates the state of the system.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| state | number | Value for the state. |
|
| description | string | Description for the state. |
stringMetricmethod
Signature
(definition: string | MetricDefinition, value: string) => StringMetric
Description
Creates a new String Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | string | Metric value. |
subSystemmethod
Signature
(name: string, description?: string) => System
Description
Creates a new subsystem.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Name for the subsystem. |
|
| description | string | Description for the subsystem. |
timestampMetricmethod
Signature
(definition: string | MetricDefinition, value: any) => TimestampMetric
Description
Creates a new Timestamp Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | any | Metric value. |
CountMetricobject
Description
Count metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | number | Returns the value of the metric. |
Methods
decrementmethod
Signature
() => void
Description
Decrements the value of the metric by 1.
decrementBymethod
Signature
(num: number) => void
Description
Decrements the value of the metric by the specified number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| num | number | Number by which to decrement the metric. |
incrementmethod
Signature
() => void
Description
Increments the value of the metric by 1.
incrementBymethod
Signature
(num: number) => void
Description
Increments the value of the metric by the specified number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| num | number | Number by which to increment the metric. |
updatemethod
Signature
(value: number) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | number | Value with which to update the metric. |
Metricobject
Description
Basic metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | any | Returns the value of the metric. |
Methods
updatemethod
Signature
(value: any) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | any |
MetricDefinitionobject
Description
Metric definition.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Description for the metric. |
||
| name | string | Name of the metric. |
NumberMetricobject
Description
Number metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | number | Returns the value of the metric. |
Methods
decrementmethod
Signature
() => void
Description
Decrements the value of the metric by 1
decrementBymethod
Signature
(num: number) => void
Description
Decrements the value of the metric by the specified number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| num | number | Number by which to decrement the metric. |
incrementmethod
Signature
() => void
Description
Increments the value of the metric by 1.
incrementBymethod
Signature
(num: number) => void
Description
Increments the value of the metric by the specified number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| num | number | Number by which to increment the metric. |
updatemethod
Signature
(value: number) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | number | Value with which to update the metric. |
ObjectMetricobject
Description
Object metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | any | Returns the value of the metric. |
Methods
updatemethod
Signature
(value: any) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | any | Value with which to update the metric. |
Repositoryobject
Description
Metrics systems repository.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| root | System | Returns the root metrics system. |
Stateobject
Description
State of the metric system.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Description of the state. |
||
| state | number | Code number for the state. |
StringMetricobject
Description
String metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | string | Returns the value of the metric. |
Methods
updatemethod
Signature
(value: string) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | string | Value with which to update the metric. |
Systemobject
Description
A metrics system. A system can be created in another system as a subsystem.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the system. |
||
| id | string | ID of the system in the format |
||
| metrics | Metric[] | Returns an array of metrics. |
||
| name | string | Returns the name of the system. |
||
| parent | System | Returns the parent system of the current system. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the system. |
||
| root | System | The root system in the repository. |
||
| subSystems | System[] | Returns an array of the subsystems. |
Methods
getAggregateStatemethod
Signature
() => SystemStateInfo[]
Description
Returns the aggregate system state represented as an array of the states of all subsystems.
getStatemethod
numberMetricmethod
Signature
(definition: string | MetricDefinition, value: number) => NumberMetric
Description
Creates a new Number Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | number | Metric value. |
objectMetricmethod
Signature
(definition: string | MetricDefinition, value: any) => ObjectMetric
Description
Creates a new Object Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | any | Metric value. |
setStatemethod
Signature
(state: number, description?: string) => void
Description
Updates the state of the system.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| state | number | Value for the state. |
|
| description | string | Description for the state. |
stringMetricmethod
Signature
(definition: string | MetricDefinition, value: string) => StringMetric
Description
Creates a new String Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | string | Metric value. |
subSystemmethod
Signature
(name: string, description?: string) => System
Description
Creates a new subsystem.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Name for the subsystem. |
|
| description | string | Description for the subsystem. |
timestampMetricmethod
Signature
(definition: string | MetricDefinition, value: any) => TimestampMetric
Description
Creates a new Timestamp Metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | string | MetricDefinition | Metric definition. |
|
| value | any | Metric value. |
SystemStateInfoobject
Description
Aggregate system state.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Description of the state. |
||
| name | string | Name of the metrics system. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| state | number | Code number for the state. |
TimestampMetricobject
Description
Timestamp metric.
Properties
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| description | string | Returns the description of the metric. |
||
| id | string | Returns the ID of the metric. |
||
| name | string | Returns the name of the metric. |
||
| path | string[] | An array of parent system names, starting with the root system name. |
||
| repo | Repository | Returns the repository of the metric. |
||
| system | System | Returns the system of the metric. |
||
| type | number | Returns the type of the metric. |
||
| value | any | Returns the value of the metric. |
Methods
nowmethod
Signature
() => void
Description
Updates the metric with the current date and time.
updatemethod
Signature
(value: Date) => Promise<void>
Description
Updates the value of the metric.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | Date | Value with which to update the metric. |