Skip to main content
Version: v4.6

Metrics Service overview

What the Metrics Service does#

The Metrics Service records information on important system events happening across a range of back-end services. It is a powerful tool which allows you to monitor what is happening in your Twinit apps. The Metrics Service provides insights into metrics such as the number of user groups, disk space, and the usage of various system resources.

This feature was introduced in Platform version 4.4 and more metrics were added in version 4.5.

Supported Services#

In Platform version 4.4, the Metrics Service currently records system events occurring in the following back-end services:

Note: Metrics for more services will be introduced in future releases of the Platform.

How the Metrics Service works#

Back-end services supported by the Metrics Service, emit events when system resources are created, updated or deleted. These events are then stored in the Metrics Service data store.

The Metrics Service uses a MongoDB database, chosen due to its schema-less nature and suitability for handling time-series data. This metrics data is made available to other apps via an API server and a set of REST API endpoints.

Metrics collection#

In the Metrics Service database, the data is stored in a collection called metrics.

The metrics collection contains data records (referred to as documents in MongoDB) similar to the example shown below.

 {  "timestamp": {    "$date": "2024-07-04T06:00:00.000Z"  },  "metadata": {    "dimensions": {      "namespace": "bernietest_Tc19RRFT"    },    "metricName": "dtplatform.passportsvc.WorkspaceCount"  },  "_id": {    "$oid": "66863add428f517627ffe4b0"  },  "_class": "com.invicara.metrics.mongodb.model.MetricDocument",  "value": {    "$numberLong": "8"  }}

The data parameters used in the metrics collection are summarized below.

ParameterDescription
timestampThe time field of the time series data
metadataInformation describing the dimensions of the metric (see notes below)
metricNameName of metric
_idThe ID assigned by the data store
_classThe class attributes of the metric

Notes on Dimensions#

Metrics have a dimension field which is used to specify the scope of a metrics query. You can use dimensions to provide useful information which could not otherwise be easily determined.

All metrics in the Platform have at least one dimension - the namespace dimension. For most metrics, this namespace is a workspace namespace, which is contained within a larger application namespace.

For example, in the Passport Service, you can use the namespace dimension of the WorkspaceCount metric to determine information such as the number of workspaces within that particular namespace.

A metric can have more than one dimension. For example, with Named User Collection Version Size metrics, you can avail of three dimensions and create metrics queries based on namespace, collection, and version information.

How to use the Metrics Service#

Using the REST API#

Use the Metrics Service by making API calls to the relevant endpoints. For more information on using the REST API, refer to the Metrics Service API overview page.

List of available metrics#

For a full list of the metrics currently available, refer to the List of Metrics page.