# DTM Data Service

Source: https://cumulocity.com/docs/dtm/dtm-data-service/
Sector: Application enablement & solutions
Release: Latest
Description: Learn what the DTM Data Service is, how it propagates measurements from devices to linked assets, and how to manage and troubleshoot it.

## Introduction

The **DTM Data Service** is the Cumulocity service that propagates measurements from devices to assets in the Digital Twin Manager (DTM) application.

When you [link a data point](https://cumulocity.com/docs/dtm/asset-hierarchy/#to-create-linked-datapoints) of an asset to a measurement series of a device in the DTM application, the service creates a measurement on each asset that has a data point linked to any series of an incoming device measurement. The service processes incoming device measurements only while it is enabled for your tenant. For details, see [Measurement propagation](https://cumulocity.com/docs/dtm/dtm-data-service/#measurement-propagation) and [Enabling and disabling the service](https://cumulocity.com/docs/dtm/dtm-data-service/#enabling-the-service).

### Enabling and disabling the service {#enabling-the-service}

The DTM Data Service is enabled automatically for your tenant when you link the first data point to a source device. You can also enable it using the REST API. For details and for disabling the service, see [To manage the DTM Data Service](https://cumulocity.com/docs/dtm/dtm-data-service/#enable-measurement-propagation).


> **Requirements:**
> * The DTM Data Service is subscribed to your tenant by default. If it is not, ask your platform operator.
> * The Data Points extension package must be installed to manage linked data points in the DTM application, see [Data points](https://cumulocity.com/docs/dtm/asset-hierarchy/#datapoints).




> **Related topics:**
> * [Data points](https://cumulocity.com/docs/dtm/asset-hierarchy/#datapoints) for creating and managing linked data points
> * [Service-level agreement for measurement propagation](https://cumulocity.com/docs/service-terms/service-level/#dtm-data-service-sla) for load, limits, delivery, and cost implications

## Measurement propagation

### How measurements are propagated

*Measurement propagation* means that for each new measurement of a source device, a measurement is created on every asset with a data point linked to it. The new measurement has the asset as source. The device measurement itself is not changed.

The DTM Data Service propagates measurements only while it is enabled for your tenant, see [To manage the DTM Data Service](https://cumulocity.com/docs/dtm/dtm-data-service/#enable-measurement-propagation).

For each incoming device measurement, one measurement is created for each linked asset:

- The source of the measurement is the asset.
- Time and type of the measurement are taken from the device measurement.
- The measurement contains the fragment `c8y_dtm_data_service`. The fragment identifies the measurement as propagated by the DTM Data Service.
- Each linked series is created with the fragment and series of the linked data point on the asset, and with the value and unit of the device measurement. If several data points of the same asset are linked to the same device measurement, they are combined into one asset measurement.
- Fragments and series of the device measurement which are not linked are not included in the asset measurement.

Device measurements are matched to linked data points by fragment and series only. The measurement type configured for a linked data point does not affect propagation.

Propagated asset measurements are regular measurements in Cumulocity. For details on load, limits, delivery and cost implications, see the [DTM Data Service Service-Level Agreement](https://cumulocity.com/docs/service-terms/service-level/#dtm-data-service-sla).

### Fan-out limit {#fan-out-limit}

The number of assets a single device measurement is propagated to is limited. If the limit is exceeded, measurements for further linked assets are not created and an alarm of type `c8y_DtmMeasurementFanOutLimitExceeded` is raised on the source device. For the default limit and how to request a different limit, see [Fan-out](https://cumulocity.com/docs/service-terms/service-level/#dtm-fan-out) in the DTM Data Service Service-Level Agreement.

## Managing the service

### To manage the DTM Data Service {#enable-measurement-propagation}

In the default mode `auto`, the first data point linked to a source device enables the service for your tenant. It stays enabled while your tenant has at least one data point linked to a source device, and turns off a few minutes after the last link is removed. You can disable or enable it at any time. The setting applies to all assets of your tenant.

To view or change the state of the DTM Data Service:

1. Select an asset from the hierarchy on the **Assets** page and switch to the **Data points** tab.
2. Click **Manage DTM Data Service** at the top right. The dialog shows whether the service is enabled for your tenant.
3. If the DTM Data Service is enabled, click **Disable for all assets** to stop measurement propagation. If it is disabled, click **Enable for all assets** to start it.

![Manage DTM Data Service](https://cumulocity.com/docs/images/dtm/data-points/asset-data-points-manage-data-service.png)

Disabling stops the propagation of new device measurements. Your data point links and the measurements already propagated are kept. Device measurements received while the service was disabled are not propagated afterwards.

If the DTM Data Service is not enabled, the **Data points** tab can show a notification that points you to **Manage DTM Data Service**.

The **Data points** tab shows the **Manage DTM Data Service** button if the service is enabled, or if it is disabled and your tenant has at least one linked data point. The button is not shown in the following cases:

- Your tenant is not subscribed to the dtm-dataservice-1fm.
- You do not have the permission to get the state of the service, see [To manage the DTM Data Service using the REST API](https://cumulocity.com/docs/dtm/dtm-data-service/#manage-rest-api).
- The platform operator has set the service for all tenants. In this case, you cannot change the setting for your tenant.

When you link the first data point of your tenant to a source device and the service is not enabled yet, the dialog opens automatically after you save the link, see [On creating the first linked data point](https://cumulocity.com/docs/dtm/asset-hierarchy/#first-link-dialog). If you disabled the service before, the dialog asks you to enable it. Click **Skip for now** to keep the service disabled. You can enable it later with **Manage DTM Data Service**. You can create data point links while the service is disabled, but no measurements are propagated until you enable it.

![Enable DTM Data Service](https://cumulocity.com/docs/images/dtm/data-points/asset-data-points-enable-data-service.png)


> **Info:**
> Only users with the ADMIN permission for the permission type "Digital twin" can enable or disable the service. For other users, the dialog only shows the state of the service and a **Close** button. If the service is disabled, contact your tenant administrator.



#### To manage the DTM Data Service using the REST API {#manage-rest-api}

You can also disable or enable the service using the following API:

```
PUT /service/dtmdata/enabled/measurements
Content-Type: application/json

{ "mode": "off" }
```

The following modes are available:

| <span style="display: inline-block; width: 100px;">Mode</span> | Description
| ---------- | -----------
| `auto` | Default. Measurements are propagated while the tenant has data points linked to a source device.
| `on` | Measurements are always propagated.
| `off` | Measurements are not propagated. Linked data points are kept, but no asset measurements are created.

In the **Manage DTM Data Service** dialog, **Disable for all assets** sets the mode `off`. **Enable for all assets** sets the mode `auto`, or the mode `on` if the mode is already `auto`.

To get the current state of the service, use `GET /service/dtmdata/enabled`.

Changing the mode requires the ADMIN permission for "Digital twin", as described above. Getting the current state also works with the CREATE, UPDATE, or ADMIN permission for the permission type "Digital twin assets" or "Digital twin linking".

## Troubleshooting

### Troubleshooting measurement propagation {#troubleshooting-measurement-propagation}

1. **No measurements are propagated to the asset**
   - Check the status of the linked data point. Only linked data points with the status **Linked** propagate measurements, see [Understanding states](https://cumulocity.com/docs/dtm/asset-hierarchy/#understanding-states) and [Source warnings and errors](https://cumulocity.com/docs/dtm/asset-hierarchy/#source-warnings-and-errors).
   - Check that the DTM Data Service is enabled for your tenant. Click **Manage DTM Data Service** in the **Data points** tab, or use `GET /service/dtmdata/enabled`. The response contains `measurements.enabled` and `measurements.mode`. If the DTM Data Service is disabled, enable it, see [To manage the DTM Data Service](https://cumulocity.com/docs/dtm/dtm-data-service/#enable-measurement-propagation).
   - Do not use the **Latest value** column to check propagation. If the asset has no measurement yet, it shows the latest value of the source device, see [Understanding the columns](https://cumulocity.com/docs/dtm/asset-hierarchy/#understanding-the-columns-in-the-datapoints-list).
   - Check that the source of the linked data point is a device. Measurements with an asset as source are not propagated.
   - Check that the source device sends measurements with exactly the fragment and series configured as source of the linked data point, including upper and lower case. This applies in particular to custom data points.
   - Check that the measurements were received after the data point was linked or its source was changed, and allow up to about a minute for a new or changed link to become active. See [Limitations and constraints](https://cumulocity.com/docs/service-terms/service-level/#dtm-limitations-and-constraints) in the service-level agreement for measurement propagation.
2. **Measurements are propagated to some of the linked assets only**
   - Check the source device for an alarm of type `c8y_DtmMeasurementFanOutLimitExceeded`. If the alarm exists, the device measurement is linked to more assets than allowed, see [Fan-out limit](https://cumulocity.com/docs/dtm/dtm-data-service/#fan-out-limit).
3. **The status of a linked data point is empty**
   - The DTM Data Service did not create the latest measurement of the asset, see [Understanding states](https://cumulocity.com/docs/dtm/asset-hierarchy/#understanding-states). Propagated measurements contain the fragment `c8y_dtm_data_service`.
4. **Propagated measurements are not shown for the expected time range**
   - Propagated asset measurements have the time of the device measurement. If a device sends measurements with a time in the past, for example after reconnecting or because of a wrong device clock, the asset measurements are shown at that time as well. Check the time of the measurements of the source device.
