You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use the data management service to capture data from [supported components and services](#supported-resources), then sync it to the cloud.
44
44
You can also sync data from arbitrary folders on your machine.
45
45
46
-
## Configure the data management service
46
+
## Overview
47
47
48
-
To start, configure the data management service to capture and sync data.
48
+
Data capture and sync in Viam involves two key pieces:
49
+
50
+
- A data management {{< glossary_tooltip term_id="service" text="service" >}} that writes captured data to local edge device storage and syncs that data with the cloud.
51
+
- Individual {{< glossary_tooltip term_id="resource" text="resource" >}} configurations that specify what data to capture and how often.
52
+
53
+
## How data capture and data sync works
54
+
55
+
- The data management service stores captured data locally in <file>~/.viam/capture<file> by default.
56
+
- Data is synced to the Viam cloud at a configured sync interval using encrypted gRPC calls and deleted from the disk once synced.
57
+
- You can capture and sync data independently, one can run without the other.
58
+
59
+
## Set up data capture and data sync
60
+
61
+
### Configure a data management service for your machine
62
+
63
+
The data management service is responsible for:
64
+
65
+
- Writing data from your configured Viam resources to local storage on your edge device
66
+
- Syncing data from the edge device to the cloud
49
67
50
68
{{< tabs >}}
51
69
{{% tab name="Config Builder" %}}
@@ -117,6 +135,8 @@ Click the **Save** button in the top right corner of the page to save your confi
117
135
118
136
The following attributes are available for the data management service:
119
137
138
+
{{< expand "Click to view data management attributes" >}}
139
+
120
140
<!-- prettier-ignore -->
121
141
| Name | Type | Required? | Description |`viam-micro-server` Support |
@@ -135,74 +155,16 @@ The following attributes are available for the data management service:
135
155
|`cache_size_kb`| float | Optional |`viam-micro-server` only. The maximum amount of storage bytes (in kilobytes) allocated to a data collector. <br> Default: `1` KB. | <pclass="center-text"><iclass="fas fa-check"title="yes"></i></p> |
136
156
|`file_last_modified_millis`| float | Optional | The amount of time to pass since arbitrary files were last modified until they are synced. Normal <file>.capture</file> files are synced as soon as they are able to be synced. <br> Default: `10000` milliseconds. | <pclass="center-text"><iclass="fas fa-times"title="no"></i></p> |
137
157
138
-
### Capture directly to MongoDB
139
-
140
-
Data capture supports capturing tabular data directly to MongoDB in addition to capturing to disk.
141
-
142
-
This feature is intended to support use cases like offline dashboards which don't require strong data delivery or consistency guarantees.
143
-
144
-
Here is a sample configuration that will capture fake sensor readings both to the configured MongoDB URI as well as to the `~/.viam/capture` directory on disk:
When `mongo_capture_config.uri` is configured, data capture will attempt to connect to the configured MongoDB server and write captured tabular data to the configured `mongo_capture_config.database` and `mongo_capture_config.collection` (or their defaults if unconfigured) after enqueuing that data to be written to disk.
187
-
188
-
If writes to MongoDB fail for any reason, data capture will log an error for each failed write and continue capturing.
189
-
190
-
Failing to write to MongoDB doesn't affect capturing and syncing data to cloud storage other than adding capture latency.
191
-
192
-
{{< alert title="Caution" color="caution" >}}
158
+
{{< /expand >}}
193
159
194
-
- Capturing directly to MongoDB may write data to MongoDB that later fails to be written to disk (and therefore never gets synced to cloud storage).
195
-
- Capturing directly to MongoDB does not retry failed writes to MongoDB. As a consequence, it is NOT guaranteed all data captured will be written to MongoDB.
196
-
This can happen in cases such as MongoDB being inaccessible to `viam-server` or writes timing out.
197
-
- Capturing directly to MongoDB may reduce the maximum frequency that data capture can capture data due to the added latency of writing to MongoDB.
198
-
If your use case needs to support very high capture rates, this feature may not be appropriate.
160
+
### Configure data capture for individual resources
199
161
200
-
{{< /alert >}}
162
+
You can capture data for any {{< glossary_tooltip term_id="resource" text="resource" >}} that supports it, including resources on {{< glossary_tooltip term_id="remote-part" text="remote parts" >}}.
201
163
202
-
## Configure data capture
164
+
Configure data capture for individual resources by:
203
165
204
-
You can capture data for any {{< glossary_tooltip term_id="resource" text="resource" >}} that supports it, including resources on {{< glossary_tooltip term_id="remote-part" text="remote parts" >}}.
205
-
Scroll to the resource card you wish to configure data capture and sync on.
166
+
- Selecting which resource methods to capture data fromm
167
+
- Setting the capture frequency for each method
206
168
207
169
{{< tabs >}}
208
170
{{% tab name="Regular" %}}
@@ -652,6 +614,8 @@ The following example of a configuration with a remote part captures data from t
652
614
653
615
The following attributes are available for data capture configuration:
654
616
617
+
{{< expand "Click to view data capture attributes" >}}
@@ -660,6 +624,8 @@ The following attributes are available for data capture configuration:
660
624
|`retention_policy`| object | Optional | Option to configure how long data collected by this component or service should remain stored in the Viam Cloud. You must set this in JSON mode. See the JSON example for a camera component. <br> **Options:**`"days": <int>`, `"binary_limit_gb": <int>`, `"tabular_limit_gb": <int>`. <br> Days are in UTC time. Setting a retention policy of 1 day means that data stored now will be deleted the following day **in UTC time**. You can set either or both of the size limit options and size is in gigabytes. |
661
625
|`additional_params`| depends | depends | Varies based on the method. For example, `ReadImage` requires a MIME type. |
662
626
627
+
{{< /expand >}}
628
+
663
629
Click the **Save** button in the top right corner of the page to save your config.
664
630
665
631
If cloud sync is enabled, the data management service deletes captured data once it has successfully synced to the cloud.
@@ -693,7 +659,8 @@ You can also control how local data is deleted if your machine's local storage b
693
659
694
660
## Stop data capture
695
661
696
-
If this is a test project, make sure you stop data capture to avoid charges for a large amount of unwanted data.
662
+
If you don't need to capture data, for instance in a test scenario, you can turn off data capture to reduce unnecessary storage.
663
+
Alternatively, see [advanced data capture and sync configurations](/data-ai/capture-data/capture-sync/#advanced-data-capture-and-sync-configurations) for other ways to control data usage, such as conditional sync or retention policies.
697
664
698
665
In the **Data capture** section of your resource's configuration card, toggle the switch to **Off**.
699
666
@@ -705,25 +672,109 @@ To view all the captured data you have access to, go to the [**DATA** tab](https
705
672
706
673
You can also access data from a resource or machine part menu.
707
674
708
-
## Supported resources
675
+
## Advanced data capture and sync configurations
709
676
710
-
The following components and services support data capture and cloud sync:
You can configure direct capture of tabular data to a MongoDB instance alongside disk storage on your edge device.
680
+
This can be useful for powering real-time dashboards before data is synced from the edge to the cloud.
681
+
682
+
Configure using `mongo_capture_config` attributes in your data manager service.
683
+
684
+
Here is a sample configuration that will capture fake sensor readings both to the configured MongoDB URI as well as to the `~/.viam/capture` directory on disk:
-**Capturing too much data**: You can [use filtering to collect and sync only certain images](/data-ai/capture-data/filter-before-sync/) to capture data selectively.
717
-
-**Retention policy**: Set a `retention_policy` attribute in your [data capture configuration](#configure-data-capture) to avoid keeping data stored in the Viam Cloud longer than a specified number of days.
718
-
-**Pausing sync**: You can pause cloud sync at any time by navigating to your machine's **CONFIGURE** tab and disabling **Syncing** for your data management service.
730
+
When `mongo_capture_config.uri` is configured, data capture will attempt to connect to the configured MongoDB server and write captured tabular data to the configured `mongo_capture_config.database` and `mongo_capture_config.collection` (or their defaults if unconfigured) after enqueuing that data to be written to disk.
719
731
720
-
If you have captured data that you do not want to sync, delete the data on the machine before resuming cloud sync.
721
-
To delete the data locally, `ssh` into your machine and delete the data in the directory where you capture data.
732
+
If writes to MongoDB fail for any reason, data capture will log an error for each failed write and continue capturing.
722
733
723
-
-**Sync data conditionally**: You can use a {{< glossary_tooltip term_id="module" text="module" >}} to sync data only when a certain logic condition is met, instead of at a regular time interval.
724
-
For example, if you rely on mobile data but have intermittent WiFi connection in certain locations or at certain times of the day, you may want to trigger sync to only occur when these conditions are met.
725
-
To set up triggers for syncing see [Conditional cloud sync](/data-ai/capture-data/conditional-sync/).
734
+
Failing to write to MongoDB doesn't affect capturing and syncing data to cloud storage other than adding capture latency.
726
735
727
-
## Next steps
736
+
{{< alert title="Caution" color="caution" >}}
737
+
738
+
- Capturing directly to MongoDB may write data to MongoDB that later fails to be written to disk (and therefore never gets synced to cloud storage).
739
+
- Capturing directly to MongoDB does not retry failed writes to MongoDB. As a consequence, it is NOT guaranteed all data captured will be written to MongoDB.
740
+
This can happen in cases such as MongoDB being inaccessible to `viam-server` or writes timing out.
741
+
- Capturing directly to MongoDB may reduce the maximum frequency that data capture can capture data due to the added latency of writing to MongoDB.
742
+
If your use case needs to support very high capture rates, this feature may not be appropriate.
728
743
729
-
Now that you have captured data, you could [create a dataset](/data-ai/ai/create-dataset/) and use this data to [train your own Machine Learning model](/data-ai/ai/train-tflite/) with the Viam platform.
744
+
{{< /alert >}}
745
+
746
+
### Conditional sync
747
+
748
+
Although data sync checks for new data at the configured interval, you can define additional conditions that must be met to trigger syncing.
749
+
For example:
750
+
751
+
- Only sync when on WiFi
752
+
- Sync when specific events are detected
753
+
- Sync during certain time windows
754
+
755
+
See [Conditional cloud sync](/data-ai/capture-data/conditional-sync/) for how to implement conditional syncs.
756
+
757
+
### Cloud data retention
758
+
759
+
Configure how long your synced data remains stored in the cloud:
760
+
761
+
-**Retain data up to a certain specific amount or for a specific length of time:** Set `retention_policies` at the resource level.
762
+
- See the `retention_policy` field in [data capture configuration attributes](/data-ai/capture-data/capture-sync/#click-to-view-data-capture-attributes).
763
+
-**Delete data captured by a machine when you delete the machine:** Control whether your cloud data is deleted when a machine or machine part is removed.
764
+
- See the `delete_data_on_part_deletion` field in the [data management service configuration attributes](/data-ai/capture-data/capture-sync/#click-to-view-data-management-attributes).
765
+
766
+
### Sync optimization
767
+
768
+
**Capture interval considerations:** Performance can vary based on hardware capabilities, so ensure your capture settings are not too aggressive if resources are limited.
769
+
770
+
**Configurable sync threads:** You can control how many concurrent sync operations occur by adjusting the `maximum_num_sync_threads` setting.
771
+
Higher values may improve throughput on more powerful hardware, but raising it too high may introduce instability on resource-constrained devices.
772
+
773
+
**Wait time before syncing arbitrary files:** If you choose to sync arbitrary files (beyond those captured by the data management service), the `file_last_modified_millis` configuration attribute specifies how long a file must remain unmodified before the data manager considers it for syncing.
774
+
The default is 10 seconds.
775
+
776
+
## Supported resources
777
+
778
+
The following components and services support data capture and cloud sync:
0 commit comments