All Products
Search
Document Center

Cloud Monitor:Phase 1 Table pattern

Last Updated:Sep 26, 2025

Overview

The Phase 1 Table pattern provides direct access to various UModel datasets. It lets you use a unified Structured Process Language (SPL) syntax to query underlying data directly. The pattern also automatically handles complex operations such as storage routing and field mapping.

Core features

  • Direct data access: Provides direct access to a dataset and returns an executable SPL query.

  • Full control: Provides full control over the query logic and data processing flow.

  • Storage transparency: Automatically handles differences between storage classes, such as MetricStore and LogStore.

  • Field mapping: Automatically applies the field mapping rules defined in the dataset.

Scenarios

  • You need precise control over query logic.

  • You do not need high-level abstractions of entity relationships.

  • You require high-performance data access.

  • You have specific data processing and data analytics needs.

Prerequisites

Before you use the Phase 1 Table pattern, ensure that the following prerequisites are met:

  1. A dataset is created.

  2. The dataset is associated with storage.

  3. The associated storage contains relevant data.

MetricSet queries

MetricSet queries support two data source types: metrics and labels. They also support two query modes: Prometheus Query Language (PromQL) and SPL.

Get metrics data

Description

You can query metric data in a MetricSet. This feature supports range queries, instant queries, and data aggregation.

SPL syntax

.metric_set with(
    domain='domain_name', 
    name='dataset_name', 
    source='metrics', 
    metric='metric_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the MetricSet belongs.

‘apm’

name

string

Yes

The name of the MetricSet.

‘apm.metric.apm.operation’

source

string

Yes

Fixed as 'metrics'.

‘metrics’

metric

string

Yes

The name of the metric to query.

‘request_count’

query_type

string

No

The query type. Valid values are 'range' (default) and 'instant'.

‘range’

step

string

No

The time step size. If you leave this parameter empty, an automatic step size is used.

‘1m’, ‘5m’

aggregate

boolean

No

Specifies whether to aggregate data.

true/false

aggregate_labels

array

No

A list of dimensions for aggregation.

[‘host’, ‘service’]

query

string

No

The filter condition. For more information, see SPL syntax.

service_id = "xxx" and status =~ "400|500"

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_name

string

No

The specified storage name.

‘metricstore-apm’

storage_kind

string

No

The specified storage class.

‘sls_metricstore’

Examples

  • Query the api_request_duration metric. Do not aggregate the data and return all metrics directly. The step size is set to Auto.

.metric_set with(
    domain='rum', 
    name='rum.metric.api', 
    source='metrics', 
    metric='api_request_duration',
    aggregate=false
)
  • Query the request_count metric. Aggregate the data by the service and operation dimensions. The filter condition is service_id = "hwx28v3j7p@9949e3dbf79e9a082105c". The query step size is 1 minute.

.metric_set with(
    domain='apm', 
    name='apm.metric.apm.operation', 
    source='metrics', 
    metric='request_count',
    query_type='range',
    step='1m',
    aggregate=true,
    aggregate_labels=['service', 'operation'],
    query='service_id = "hwx28v3j7p@9949e3dbf79e9a082105c"'
)
  • Query the error_rate metric. Perform a unified aggregation and call the anomaly detection SPL for further analysis.

.metric_set with(
    domain='apm',
    name='apm.metric.apm.service',
    source='metrics',
    metric='error_rate',
    step='1m',
    aggregate='true'
  )
| extend slice_index = find_first_index(__ts__, x -> x > 1756904640000000000)
| extend len = cardinality(__ts__)
| extend ret = series_cnn_anomalies(__value__)
| extend anomalies_score_series = ret.anomalies_score_series, anomalies_type_series = ret.anomalies_type_series, error_msg = ret.error_msg
| project __labels__, __name__, __ts__, __value__, anomalies_score_series, anomalies_type_series, error_msg,len,slice_index
| extend __ts__ = slice(__ts__, slice_index, len - slice_index), __value__ = slice(__value__, slice_index, len - slice_index), anomalies_score_series = slice(anomalies_score_series, slice_index, len - slice_index), anomalies_type_series = slice(anomalies_type_series, slice_index, len - slice_index)
| extend anomay_cnt = CARDINALITY(FILTER(anomalies_score_series, x -> x > 0.5)), anomaly_sorce = array_sum(FILTER(anomalies_score_series, x -> x > 0.5))
| extend sort_score = anomaly_sorce / cast(anomay_cnt as double) 
| sort sort_score desc , anomay_cnt desc

Get label values (labels)

Description

You can query all possible values of a specific label in a MetricSet. You can use these values to dynamically build query conditions or provide selection options.

SPL syntax

.metric_set with(
    domain='domain_name', 
    name='dataset_name', 
    source='labels', 
    label='label_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the MetricSet belongs.

‘apm’

name

string

Yes

The name of the MetricSet.

‘apm.metric.apm.operation’

source

string

Yes

Fixed as 'labels'.

‘labels’

label

string

No

The name of the label to query. An empty string indicates all labels.

‘rpc’

query

string

No

The filter condition. For more information, see SPL syntax.

‘service_id = “xxx”’

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_kind

string

No

The specified storage class.

‘sls_metricstore’

storage_name

string

No

The specified storage name.

‘metricstore-apm’

Example

  • Query all possible values of the rpc label. The filter condition is service_id = "hwx28v3j7p@9949e3dbf79e9a082105c".

.metric_set with(
    domain='apm', 
    name='apm.metric.apm.operation', 
    source='labels', 
    label='rpc',
    query='service_id = "hwx28v3j7p@9949e3dbf79e9a082105c"'
)

LogSet queries

Description

You can query log data in a LogSet. This feature supports full-text index, field filtering, and structured queries.

SPL syntax

.log_set with(
    domain='domain_name', 
    name='dataset_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the LogSet belongs.

‘apm’

name

string

Yes

The name of the LogSet.

‘apm.log.app’

query

string

No

The filter condition. For more information, see SPL syntax.

‘level = “ERROR”’

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_kind

string

No

The specified storage class.

‘sls_logstore’

storage_name

string

No

The specified storage name.

‘logstore-apm’

Query example

  • Query logs where level = "ERROR" and service = "order-service".

.log_set with(
    domain='apm', 
    name='apm.log.app',
    query='level = "ERROR" and service = "order-service"'
)

TraceSet queries

Description

You can query distributed tracing data in a TraceSet. This feature supports trace analysis, Span retrieval, and App Performance Analytics.

SPL syntax

.trace_set with(
    domain='domain_name', 
    name='dataset_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the TraceSet belongs.

‘apm’

name

string

Yes

The name of the TraceSet.

‘apm.trace.span’

query

string

No

The filter condition. For more information, see SPL syntax.

‘service = “order-service” and duration > 1000’

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_name

string

No

The specified storage name.

‘trace-apm’

storage_kind

string

No

The specified storage class.

‘sls_logstore’

Query example

  • Query traces where service = "order-service" and duration > 1000.

.trace_set with(
    domain='apm', 
    name='apm.trace.span',
    query='service = "order-service" and duration > 1000'
)

EventSet queries

Description

You can query event data in an EventSet. This feature supports the retrieval of alert events, status change events, and business events.

SPL syntax

.event_set with(
    domain='domain_name', 
    name='dataset_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the EventSet belongs.

‘apm’

name

string

Yes

The name of the EventSet.

‘apm.event.alert’

query

string

No

The filter condition. For more information, see SPL syntax.

‘severity = “P1” and status = “firing”’

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_name

string

No

The specified storage name.

‘event-common’

storage_kind

string

No

The specified storage class.

‘sls_logstore’

Query example

  • Query events where severity = "P1" and status = "firing".

.event_set with(
    domain='apm', 
    name='apm.event.alert',
    query='severity = "P1" and status = "firing"'
)

ProfileSet queries

Description

You can query performance profiling data in a ProfileSet. This feature supports CPU profiling, memory profiling, and custom performance data analytics.

SPL syntax

.profile_set with(
    domain='domain_name', 
    name='dataset_name', 
    [other_optional_parameters]
)

Parameters

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain to which the ProfileSet belongs.

‘apm’

name

string

Yes

The name of the ProfileSet.

‘apm.profile.cpu’

query

string

No

The filter condition. For more information, see SPL syntax.

‘service_id = “xxx” and profile_type = “cpu”’

storage_domain

string

No

The specified storage domain name.

‘apm’

storage_name

string

No

The specified storage name.

‘profilestore-apm’

storage_kind

string

No

The specified storage class.

‘sls_logstore’

Query example

  • Query performance profiling data where service_id = "order-service" and profile_type = "cpu".

.profile_set with(
    domain='apm', 
    name='apm.profile.cpu',
    query='service_id = "order-service" and profile_type = "cpu"'
)

General features

Automatic storage routing

The Phase 1 Table pattern automatically routes storage based on UModel definitions:

  1. Storage class detection: Automatically detects storage classes such as MetricStore and LogStore.

  2. Connection parameters: Automatically obtains connection parameters such as region and project.

  3. Query transformation: Transforms UModel queries into the query syntax of the corresponding storage.

Field mapping mechanism

The system automatically applies the field mappings defined in DataLink and StorageLink:

# Example: Field mapping configuration
fields_mapping:
  'service_id': 'acs_arms_service_id'  # UModel field -> Storage field
  'operation': 'rpc'
  'region': 'acs_arms_region_id'

Query optimization

  • Index utilization: Automatically uses the index attributes of the storage to optimize queries.

  • Concurrency control: Supports high-concurrency query requests.

  • Result caching: Caches frequently used query results to improve response speed.

Error handling

  • Parameter verification: Strictly verifies the validity of input parameters.

  • Storage exceptions: Gracefully handles storage connection and query exceptions.

  • Format validation: Validates the correctness of the returned data format.