Metric
Manage Metrics.
Fetch
Fetch device and service metrics from a device cloud.
Endpoint
HTTP
POST /metric/fetchAuthorized User Role
userRequest Body
| Field | Type | Required | Notes |
|---|---|---|---|
| items | array | yes | Array of metric requests. |
Item Object
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| accumulate | boolean | Accumulate result into a single result. | ||
| cloudId | string | Device Cloud ID. | ||
| dimensions | object | Dimensions for metric. | ||
| field | string | Database model field name. | ||
| limit | number | Number of items to fetch. | ||
| metric | string | Metric name. | ||
| model | string | Database model name. | ||
| multiple | boolean | Multiple dimensions requested. | ||
| namespace | string | yes | Must be set to Embedthis/Device. | |
| period | number | 300 | Metric timespan period. | |
| start | number | Metric range start. | ||
| statistic | string | yes | avg | Metric statistic. Select from: avg, min, max, count, sum. |
Response
Paged response.
| Field | Type | Notes |
|---|---|---|
| data | array | An array of metrics each containing an array of metric with the following properties. |
| next | string | Paged cursor to use for the next page of items. |
| prev | string | Pages cursor to use for the previous page of items. |
Metric
| Field | Type | Notes |
|---|---|---|
| dimensions | object | Dimensions for the metric. |
| metric | string | Metric name. |
| namespace | string | Always set to Embedthis/Device. |
| owner | string | The service owning the metric. |
| period | number | Metric timespan period. |
| points | array | Array of data points. |
| samples | number | Number of data points in the period. |
| * | any |
Dimensions
Dimensions for the metric.
| Field | Type |
|---|---|
| * | any |
Points
| Field | Type | Notes |
|---|---|---|
| value | number | Metric value. |
| timestamp | number | Last update to the metric value in milli-seconds since Jan 1, 1970. |
| count | number | Number of data values contributing to the metric value. |
GetMetricList
Get a list of metrics available for a device cloud.
Endpoint
HTTP
POST /metric/getMetricListAuthorized User Role
userRequest Body
| Field | Type |
|---|---|
| cloudId | string |
| namespace | string |
| metric | string |
Query String Options
| Field | Type | Default | Notes |
|---|---|---|---|
| index | string | Index name: primary or gs1. | |
| limit | number | Limit number of results. | |
| next | object | Token for next page. | |
| prev | object | Token for previous page. |
Response
Object Record.
| Field | Type | Notes |
|---|---|---|
| namespaces | array | Returns the requested namespace. If not provided, returns a list of available namespaces. |
| metrics | array | If a namespace is provided, returns a list of available metrics. |
| dimensions | array | If a namespace and metric are provided, returns a list of available metric dimensions. |
GetDeviceSchema
Get the device data schema for a device cloud.
Endpoint
HTTP
POST /metric/getDeviceSchemaAuthorized User Role
userRequest Body
| Field | Type | Notes |
|---|---|---|
| cloudId | string | Cloud ID. |
Response
Device schema object.
