This topic describes how to create, modify, and delete a metricstore in the Simple Log Service (SLS) console. This topic also describes how to delete metrics. Before deleting a metricstore, you must delete all related Logtail configurations. If you want to delete metrics, reduce the retention period for the metrics.
Term
A metricstore is used to collect, store, and query metrics in SLS. Each metricstore belongs to a project. You can create multiple metricstores in a project. For more information, see Metricstore.
Prerequisites
A project is created. For more information, see Manage a project.
Create a metricstore
Log on to the Simple Log Service console.
In the Projects section, click the one you want.

On the tab, click the + icon.
In the Create Metricstore panel, configure the following parameters and click OK.
Parameter
Description
Metricstore Name
The name of the metricstore. The name must be unique in the project to which the metricstore belongs. After the metricstore is created, you cannot change the name of the metricstore.
Data Retention Period
The retention period of the collected metrics in the metricstore.
If you select Specified Days for Data Retention Period, specify how many days you want to store metrics based on your business requirements. Valid values: 1 to 3000. Unit: days.
WarningAfter the retention period ends, metrics are automatically deleted.
If you shorten the data retention period, SLS deletes all expired metrics within 1 hour. The data volume that is displayed for Usage Details on the homepage of the SLS console is updated the next day. For example, if you change the data retention period from 5 days to 1 day, SLS deletes the metrics of the previous four days within 1 hour.
If you select Permanent Storage for Data Retention Period, SLS permanently stores the collected metrics in the metricstore.
NoteIf you query the data retention period by calling an SDK and the returned result is 3650, metrics are permanently stored.
Shards
The number of shards. SLS provides shards that allow you to read and write data. Each shard supports a write capacity of 5 MB/s and 500 writes/s and a read capacity of 10 MB/s and 100 reads/s. You can create up to 10 shards in each metricstore. You can create up to 200 shards in each project. For more information, see Shard.
Automatic Sharding
If you turn on Automatic Sharding, SLS increases the number of shards when the existing shards cannot accommodate the data that is written. For more information, see Manage shards.
Maximum Shards
If you turn on Automatic Sharding, you must configure this parameter to specify the maximum number of readwrite shards that can be created. Maximum value: 256.
Modify the configurations of a metricstore
On the tab, move the pointer over the metricstore whose configurations you want to modify and choose .
On the Metricstore Attribute page, click Modify.
Basic Information
Data Retention Period: For a description of the parameters, see Create a metricstore.
Automatic Sharding: Enable this feature to automatically split shards and increase write throughput. For more information, see Manage shards.
Maximum Shards: The maximum number of shards into which a single metricstore can be split. A metricstore can be automatically split into a maximum of 256 shards that are in the readwrite state.
Log Public IP: When you enable the Log Public IP switch, SLS automatically adds the following information to the Tag field of the log.
__client_ip__: The public IP address of the device where the log originates.
__receive_time__: The time when the log arrives at the server. This value is a UNIX timestamp that indicates the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970.
Shard Management
When a metricstore is created, two shards are created by default. Split or merge shards later as needed. For more information, see Manage shards.
Query Acceleration Settings
By default, the Prometheus Query compute engine does not cache execution results. Each query must read all data and re-run the calculation. The standard compute engine supports only single-coroutine calculations on a single node. This leads to poor performance in scenarios with many timelines, long query time ranges, or complex logic. To provide more efficient Prometheus Query Language (PromQL) calculations, the SLS timing compute engine introduces two enhancements: Global Caching and Concurrent Computing. For more information about the low-level design and configuration, see Query acceleration.
Write Settings
Metricstore organizes and stores metric data in chronological order. If a large amount of dirty data is written out of order, query performance can be severely degraded. Examples include continuously writing data from months ago to a real-time Metricstore, or generating invalid data due to machine clock issues.
Metricstore can filter monitoring data that has abnormal timestamps. On the write configuration page, configure left and right time windows, specified in seconds. The valid write time is based on when the data arrives at the SLS (SLS) service. The valid time range is [Data arrival time - Left interval, Data arrival time + Right interval]. Data outside this range is discarded. If the interval is [0,0], the time range rule is not applied.
NoteThis feature applies only to data written using the Prometheus Remote Write protocol. For more information about connection types, see Collect metric data from Prometheus by using the Remote Write Protocol.
Ingest Processor
The ingest processor lets you process data before it is written. This supports various scenarios, such as modifying fields, parsing fields, filtering data, and masking data. For more information, see Processing during ingestion (ingest processor).
Tag
You can add tags to a metricstore to group and manage your metricstores.
Click Save.
Delete a metricstore
Before deleting a metricstore, you must delete all Logtail configurations that are associated with the metricstore. For more information, see Delete a Logtail configuration.
If the data shipping feature is enabled for the metricstore, we recommend that you stop writing data to the metricstore and make sure that all data in the metricstore is shipped before you delete the metricstore.
If you delete all metricstores, you are still charged for data storage on the day that you delete the metricstores, but you are no longer charged from the following day. As a result, from the third day after you delete all metricstores, you no longer receive an SLS bill.
On the tab, move the pointer over the metricstore that you want to delete and choose .
WarningAfter you delete a metricstore, all metrics in the metricstore are deleted and cannot be restored. Proceed with caution.
In the message that appears, click OK.
Delete metrics
After the retention period of metrics ends, the metrics are automatically deleted. You can also modify Data Retention Period to delete metrics.
If you shorten the data retention period, SLS deletes all expired metrics within 1 hour. The data volume that is displayed for Usage Details on the homepage of the SLS console is updated the next day. For example, if you change the data retention period from 5 days to 1 day, SLS deletes the metrics of the previous four days within 1 hour.
> Modify