Write time series data

更新时间:
复制 MD 格式

Time series data consists of metadata that identifies and describes each series and data points that record timestamps and values. You can write time series data using the console, an SDK, or the CLI.

Overview

Write time series data using the Tablestore console, an SDK, or the CLI. If a row already exists, Tablestore overwrites it.

You must specify metadata and data for each time series. If the time series does not exist, Tablestore automatically creates it from the metadata in your request.

Usage notes

Plan your table design and monitor the total number of time series. Short-lived time series with few data points increase metadata storage costs because Tablestore indexes each series with a minimum allocation of 4 KB per index.

Procedure

Use the Tablestore console to predefine a time series and write data to a time series table.

  1. Navigate to the Instance Management page.

    1. Log on to the Tablestore console.

    2. In the top navigation bar, select a resource group and a region.

    3. On the Overview page, click the instance alias or click Manage Instance in the Actions column for the instance.

  2. On the Instance Details tab, click the Time Series Tables tab.

  3. On the Time Series Tables tab, click the name of a time series table and then click the Query Data tab. Alternatively, find the time series table and click Manage Data in the Actions column.

  4. (Optional) Create a time series.

    1. On the Query Data tab, click Add Time Series.

    2. In the Add Time Series dialog box, add the time series metadata.

      Set the Metric name (for example, cpu) and Data source (for example, host_001). Under Tags, add key-value pairs such as region = hangzhou and os = Ubuntu. Under Properties, add entries such as cpu_user = 10, cpu_sys = 5, and cpu_io = 2. Click Add.

      The following table describes the parameters.

      Parameter

      Description

      Metric Name

      The measurement metric. Examples: cpu for CPU utilization, net for network throughput.

      Data Source

      The data source identifier.

      Tag

      Custom string-based key-value pairs used to identify the time series.

      Property

      Additional time series attributes, stored as property columns.

    3. Click Add.

      A new time series is typically queryable about one minute after its creation.

  5. Insert data.

    1. Click Insert Data.

    2. In the Insert Data dialog box, set the time and attribute columns.

      In this example, set the Metric name to cpu and the Data source to host_001. Add the tags os = Ubuntu and region = hangzhou. For the Attribute columns, add three rows: cpu_user (integer, value: 20), cpu_sys (integer, value: 5), and cpu_io (integer, value: 2). Then, click OK.

    3. Click OK.

SDK and CLI integration

Write time series data using an SDK or the CLI.

Billing

Metering and billing for the time series model.

FAQ

Related documents

To batch write time series data, write to multiple tables, or collect write status statistics, use the time series Writer. Use the time series Writer to write time series data.