Query and analyze data using Observable MCP

更新时间:
复制 MD 格式

MCP (Model Context Protocol) defines a standardized interface for context exchange between large models and development environments, enabling models to securely access real-time domain knowledge. Observable MCP Server provides full observability for AI interactions, supporting the analysis of multimodal data through natural language. It seamlessly integrates with Cursor, Cline, Windsurf, and various agent frameworks, enabling enterprise users to use observable data more efficiently and reliably.

Important

This project has been refactored in Go for single-binary deployment and no runtime dependencies. To use the original Python version, visit V1.

Key benefits

  1. Unified data access: Connect once to query data from multiple observability products, including Log Service (SLS), Application Real-Time Monitoring Service (ARMS), CloudMonitor, and Prometheus. This unifies logs, metrics, and traces into a single view.

  2. Natural language queries: Query logs, traces, and metrics with natural language, eliminating the need for complex query statements. The service returns structured answers.

  3. Enterprise-grade security: Relying on the Alibaba Cloud AccessKey authentication mechanism, the server-side component does not collect additional data and strictly validates the input and output for each tool, ensuring your data stays secure and within your control.

  4. Single-binary deployment: The service is a single executable file compiled from Go, eliminating the need to install a runtime environment. It supports Linux, macOS, and Windows.

  5. High reliability: Built-in mechanisms, such as retry with exponential backoff, circuit breakers, and graceful shutdown, ensure the service's reliability for production environments.

Paid features

Some AI-powered tools in Observable MCP Server call the APIs of Alibaba Cloud STAROps on the backend. Using these tools incurs charges.

Paid tools

Each call to the following AI-powered tools creates a STAROps AI conversation session and incurs charges:

Tool name

Feature

Description

sls_text_to_sql

Natural language to SQL query

Converts a user's natural language question into an executable SLS SQL statement.

sls_text_to_spl

Natural language to SPL query

Converts a user's natural language question into an SPL statement and executes it.

sls_sop

Log Service intelligent O&M assistant

Provides O&M suggestions for Log Service based on an AI conversation.

cms_natural_language_query

natural language data query

Directly queries observability data in natural language by using DataAgent.

Billing

  • Alibaba Cloud STAROps bills you for these paid tools. For details, see the billing description.

  • If you do not need AI-powered capabilities, you can edit the config.yaml file under the enabled_tools key to include only free tools and avoid unexpected charges.

    toolkit:
      scope: all
      enabled_tools:
        - sls_list_projects
        - sls_list_logstores
        - sls_execute_sql
        - sls_execute_spl
        - cms_execute_promql
        # ... Add other free tools as needed

Get started

Step 1: Configure permissions

  1. Follow the instructions in Create an AccessKey to get the required Alibaba Cloud AccessKey ID and AccessKey Secret.

  2. If you use a RAM user, note the following:

    • You must grant the RAM user or role associated with your AccessKey the required permissions to access relevant cloud services.

    • Follow the principle of least privilege: To minimize security risks, grant only the permissions required for the MCP tools you use.

    Permission policies

    For more granular control, you can grant permissions for each service based on the toolset (toolkit.scope) you use.

    • Log Service (SLS) permissions — Required for the sls_* series of tools.

      You can attach the system policy AliyunLogReadOnlyAccess or create a custom policy:

      {
        "Version": "1",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": [
              "log:ListProject",
              "log:ListLogStores",
              "log:ListMetricStores",
              "log:GetLogStoreLogs",
              "log:GetContextLogs"
            ],
            "Resource": [
              "acs:log:*:*:project/*"
            ]
          }
        ]
      }
      
      To scope access to a specific project, replace project/* with project/<YOUR-PROJECT-NAME>.
    • CloudMonitor (CMS) 2.0 permissions — Required for the cms_* series of tools, list_workspace, list_domains, and AI conversion tools.

      CMS 2.0 is the core service for Observable MCP Server. The cms_* tools, shared tools (list_workspace and list_domains), and AI conversion tools (sls_text_to_sql, sls_text_to_promql, and sls_text_to_spl) all use CMS 2.0 APIs. Create the following custom policy:

      {
        "Version": "1",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": [
              "cms:ListWorkspaces",
              "cms:GetEntityStoreData"
            ],
            "Resource": ["*"]
          }
        ]
      }
      
      If you use AI conversion tools such as sls_text_to_sql, sls_text_to_promql, and sls_text_to_spl, or the cms_natural_language_query tool, you must also grant the following permissions. Note: CreateThread and CreateChat are write operations that create AI conversation sessions to convert natural language into query statements. If you do not need this AI conversion capability, you do not need to grant these two permissions.
    • Application Real-Time Monitoring Service (ARMS) permissions — Required for the umodel_* series of PaaS tools.

      The umodel_* series of tools accesses ARMS data through the unified data model of CMS 2.0. The CMS 2.0 backend may need to call ARMS APIs on your behalf when executing queries. You can attach the system policy AliyunARMSReadOnlyAccess or create a custom policy:

      {
        "Version": "1",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": [
              "arms:GetTraceApp",
              "arms:ListTraceApps",
              "arms:SearchTraces",
              "arms:GetTrace",
              "arms:GetStack",
              "arms:QueryMetric",
              "arms:SearchAlertRules"
            ],
            "Resource": ["*"]
          }
        ]
      }
      
      Note: MCP Server does not call ARMS APIs directly. Instead, it accesses ARMS data through the GetEntityStoreData interface of CMS 2.0. These ARMS permissions allow the CMS 2.0 backend to make proxy calls. If the backend uses a server-side identity for access, you do not need to grant these permissions. We recommend that you grant these permissions during initial configuration and remove them later if you confirm they are not required.
    Important

    During runtime, Observable MCP Server uses the AccessKey you provide to call Alibaba Cloud OpenAPI. However, it does not store your AccessKey in any form or use it for any purpose other than its designed functionality.

Step 2: Install the MCP server

Choose the installation method that fits your needs. We strongly recommend deploying the MCP Server in an internal network or trusted environment, such as a VPC, to avoid direct exposure to the public internet. For network-level isolation and security, we recommend deploying with Alibaba Cloud Function Compute (FC) and configuring it for VPC-only access.

Pre-compiled binaries

Download the binary file for your platform from the Releases page:

# Linux amd64
wget https://github.com/aliyun/alibabacloud-observability-mcp-server/releases/latest/download/alibabacloud-observability-mcp-server-linux-amd64.tar.gz
tar -xzf alibabacloud-observability-mcp-server-linux-amd64.tar.gz
# macOS arm64 (M1/M2)
wget https://github.com/aliyun/alibabacloud-observability-mcp-server/releases/latest/download/alibabacloud-observability-mcp-server-darwin-arm64.tar.gz
tar -xzf alibabacloud-observability-mcp-server-darwin-arm64.tar.gz

The extracted package contains:

  • alibabacloud-observability-mcp-server: The executable file

  • config.yaml: The default configuration file

After configuring your credentials, you can start the server:

# Set your Alibaba Cloud AccessKey credentials
export ALIBABA_CLOUD_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<YOUR_ACCESS_KEY_SECRET>
# Start in stdio mode (for local integrations like Cursor, Kiro, and Cline)
./alibabacloud-observability-mcp-server start --stdio
# Start in SSE or streamable-http mode (determined by server.transport in config.yaml)
./alibabacloud-observability-mcp-server start --config config.yaml

Build from source

Go 1.22 or later is required.

# Clone the source code
git clone https://github.com/aliyun/alibabacloud-observability-mcp-server.git
# Go to the source code directory
cd alibabacloud-observability-mcp-server
# Build for the current platform
make build
# Start the server in stdio mode
./bin/alibabacloud-observability-mcp-server start --stdio
# Start the server in SSE/streamable-http mode (requires config.yaml)
./bin/alibabacloud-observability-mcp-server start --config config.yaml

To build binary files for all platforms, run the following command:

# Build for all platforms (Linux, macOS, and Windows)
make build-all

The generated binary files are located in the bin/ directory.

Configuration

The configuration is structured in two layers:

  1. config.yaml: For server configuration, including transport mode, logging, networking, and toolsets.

  2. .env file or environment variables: For credentials and runtime parameters, such as sensitive AccessKey information.

config.yaml structure

The server searches for config.yaml first in the current directory, and then in the ./config/ directory. In stdio mode, if config.yaml is not found, the server uses built-in default settings.

# Server configuration
server:
  transport: streamable-http  # stdio, sse, streamable-http
  host: "0.0.0.0"
  port: 8180
# Logging configuration
logging:
  level: info                 # debug, info, warn, error
  debug_mode: false
# Toolkit configuration
toolkit:
  scope: all                  # all, paas, iaas
# Fine-grained tool selection (optional)
# When enabled_tools is not empty, only the tools in the list are registered (scope still determines which toolkits are loaded).
# Uncomment the tools you need to enable them. Keep the others commented out.
# enabled_tools:
#   ## ── Shared Tools (General) ──
#   - introduction              # Get service introduction information
#   - list_workspace            # List available workspaces
#   - list_domains              # List entity domains in a workspace
# Network configuration
network:
  max_retry: 1
  retry_wait_seconds: 1
  read_timeout_ms: 610000
  connect_timeout_ms: 30000
# Localization configuration
locale:
  timezone: Asia/Shanghai
  language: zh-CN
# Endpoint override configuration (optional, for intranet access or custom endpoints)
# endpoints:
#   sls:
#     cn-hangzhou: "cn-hangzhou-intranet.log.aliyuncs.com"
#   cms:
#     cn-hangzhou: "cms.cn-hangzhou.aliyuncs.com"

Parameters

Parameter

Description

Options

server.transport

The transport mode.

Possible values are stdio, sse, and streamable-http. The default value is stdio. - streamable-http: Use cases include production environments and Web applications (Recommended). - Advantages: A modern HTTP streaming protocol with excellent performance and production-grade stability. The endpoint path is /streamhttp. - Limitations: Requires network configuration and a config.yaml file. - stdio: Use cases include local development and command-line tools. - Advantages: The simplest integration method. No network configuration is required. Supports direct inter-process communication. - Limitations: For local use only. Does not support simultaneous access from multiple clients. - sse (Server-Sent Events): Use cases include Web applications, remote access, and special scenarios. - Advantages: Supports remote connections and multiple clients based on the standard HTTP protocol. The endpoint path is /sse. - Limitations: Requires maintaining a long-lived connection. Performance is slightly lower than that of streamable-http. You must be responsible for the access control and security of this service access point.

server.host

The listen address (for sse and streamable-http modes only).

Default: 0.0.0.0.

server.port

The listen port (for sse and streamable-http modes only).

Default: 8180.

logging.level

The log level.

Valid values: debug, info, warn, and error. Default: info.

logging.debug_mode

When enabled, outputs full requests and responses.

Default: false.

toolkit.scope

Specifies the tools to enable.

Valid values: all, paas, and iaas. Default: all.

toolkit.enabled_tools

An optional list for fine-grained tool selection. If specified, only the tools in this list are registered. The scope parameter still controls which toolkits are loaded.

The default value is empty, which registers all tools within the scope. The value is a list of tool names, such as ["sls_list_projects", "umodel_get_metrics"].

network.max_retry

The maximum number of retries.

Default: 1.

network.read_timeout_ms

The read timeout period in milliseconds.

Default: 610000.

network.connect_timeout_ms

The connection timeout period in milliseconds.

Default: 30000.

locale.timezone

The time zone for time parsing.

Default: Asia/Shanghai.

locale.language

The language for error messages and other output.

Default: zh-CN.

.env file and environment variables

The server reads credentials from the .env file first. If the file is not found, it reads the credentials from shell environment variables.

Environment variable

Description

Required

ALIBABA_CLOUD_ACCESS_KEY_ID

Your Alibaba Cloud AccessKey ID.

Yes

ALIBABA_CLOUD_ACCESS_KEY_SECRET

Your Alibaba Cloud AccessKey Secret.

Yes

ALIBABA_CLOUD_SECURITY_TOKEN

The STS token for temporary credentials (optional).

No

ALIBABA_CLOUD_REGION

The default region.

No

ALIBABA_CLOUD_WORKSPACE

The default workspace (required for PaaS tools).

No

Important

Warning: To prevent significant security risks, never expose an MCP Server SSE/HTTP endpoint with your AccessKey configured to the public internet without proper authentication and access control.

If an AccessKey ID and AccessKey Secret are not provided during initialization, the server searches for access credentials in the following order:

  1. If the ALIBABA_CLOUD_SECURITY_TOKEN environment variable is set, the server uses the STS token as the default credentials.

  2. If the ALIBABA_CLOUD_SECURITY_TOKEN environment variable is not set, the server checks if both ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set and non-empty. If so, it uses them as the default credentials.

CLI commands

Command

Description

Parameters

start

Starts the MCP server.

--config: Specifies the path to the configuration file (the default is to search automatically). --stdio: Forces the use of the stdio transport mode (overrides the settings in config.yaml).

version

Displays version information.

None.

tools

Lists all registered MCP tools.

None.

MCP service examples

Your projects

  1. After running the MCP service, ask the large model in natural language to list your projects.

  2. MCP Server performs this query by calling the sls_list_projects tool, which correlates data from multiple sources.

    The query returns a total of 52 SLS projects in the China (Hangzhou) region (cn-hangzhou). The AI assistant then categorizes them by purpose into groups: CMS workspace-associated projects, ARMS/XTrace tracing projects, Kubernetes log projects, and other projects.

Available cloud monitor metrics

  1. Ask the large model a question in natural language, such as "List the available metrics under the CloudMonitor namespace". The model queries data by calling tools provided by the MCP Server, such as cms_list_metrics and cms_list_namespaces, to return a list of available monitoring metrics for the specified namespace. When you enter "List the available metrics under the CloudMonitor namespace." in the dialog box, the AI assistant sequentially calls tools such as cms_list_namespaces, list_workspace, cms_natural_language_query, list_domains, umodel_search_entity_set, and umodel_list_data_set. This process retrieves and displays the available monitoring metrics for an ECS instance, organized into categories such as CPU-related metrics, memory-related metrics, and disk I/O-related metrics.

Query entity instance data

  1. Ask the large model a natural language question, such as "I want to query specific entity instance data," to retrieve detailed information about entity instances. The AI assistant does this by calling tools provided by the MCP Server, such as umodel_get_entities, umodel_get_metrics, and umodel_list_data_set. In the AI assistant chat interface, the AI assistant calls a sequence of three APIs—umodel_search_entity_set, umodel_get_entities, and umodel_search_entities—to find a total of 10 APM service entity instances in the current workspace. The AI assistant displays the results in a table with columns such as Service name, Language, Source, Resource group ID, and Last observed time. These services cover multiple languages, including Java, Python, Node.js, Ruby, Rust, Go, and WebJS, and form a microservices architecture.

AI tool integration

Cursor / Kiro / Cline (streamable-http mode)

  1. In config.yaml, set server.transport: streamable-http.

  2. Start the service: ./alibabacloud-observability-mcp-server start --config config.yaml.

  3. Configure mcp.json in your AI tool:

{
  "mcpServers": {
    "alibaba_cloud_observability": {
      "url": "http://localhost:8180/streamhttp"
    }
  }
}

Cursor / Kiro / Cline (stdio mode)

Configure mcp.json in your AI tool:

{
  "mcpServers": {
    "alibaba_cloud_observability": {
      "command": "./bin/alibabacloud-observability-mcp-server",
      "args": ["start", "--stdio"],
      "env": {
        "ALIBABA_CLOUD_ACCESS_KEY_ID": "<YOUR_ACCESS_KEY_ID>",
        "ALIBABA_CLOUD_ACCESS_KEY_SECRET": "<YOUR_ACCESS_KEY_SECRET>"
      }
    }
  }
}
In stdio mode, if config.yaml does not exist, the server will use its built-in defaults.

Related references

Supported tools

Note

The list of MCP tools is updated frequently. You can view all registered tools by running the ./alibabacloud-observability-mcp-server tools command.

PaaS tools (CloudMonitor 2.0)

These tools are based on a unified data model, and their names are prefixed with umodel_.

Natural language data query (DataAgent)

Core purpose: Use the platform's built-in AI agent to query observability data in natural language. This supports data queries for various cloud products, APM applications, and custom-integrated entities.

Tool name

Purpose

Key parameters

Best practices

cms_natural_language_query

Natural language data query

query: Natural language query (required) workspace: workspace name (required) regionId: Alibaba Cloud region ID (required)

  • Query data directly using natural language.

  • Supports the time_range parameter.

  • Data retrieval using this tool typically has a latency of 15 to 60 seconds, depending on the task's complexity.

UModel metadata query tools

Core purpose: Retrieve UModel metadata from the system.

Tool name

Purpose

Key parameters

Best practices

umodel_list_data_set

List datasets of a specified type

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) data_set_types: dataset types (optional) regionId: Alibaba Cloud region ID (required)

  • Discover available datasets.

  • Understand data structures and fields.

umodel_search_entity_set

Search for entity sets

workspace: workspace name (required) search_text: search keyword (required) regionId: Alibaba Cloud region ID (required)

  • Discover entity sets by keyword.

  • Supports fuzzy search.

umodel_get_entity_set

Get the schema definition of an entity set

domain: entity domain (required) entity_set_name: entity set name (required) workspace: workspace name (required) regionId: Alibaba Cloud region ID (required) detail: specifies whether to return the full schema (optional)

  • Understand entity structures and available fields.

  • Use to identify fields for filter-based queries.

umodel_list_related_entity_set

List related entity sets

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) regionId: Alibaba Cloud region ID (required)

  • Understand the relationships between entity sets.

  • Explore data dependencies.

Entity query tools

Core purpose: Retrieve data for entities, as well as their upstream and downstream related entities.

Tool name

Purpose

Key parameters

Best practices

umodel_get_entities

List entities in a specified entity set

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) regionId: Alibaba Cloud region ID (required)

  • Explore available entity resources.

  • Supports precise queries for specific entities.

umodel_get_neighbor_entities

Get the neighbors of an entity

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) entity_ids: list of entity IDs (required) regionId: Alibaba Cloud region ID (required)

  • Explore service dependencies.

  • Build a topology map.

umodel_search_entities

Search for entities that match specified conditions

workspace: workspace name (required) search_text: search keyword (required) regionId: Alibaba Cloud region ID (required)

  • Supports complex query conditions.

  • Enables flexible entity discovery.

Data query tools

Core purpose: Query various types of observability data associated with an entity and its neighboring entities.

Tool name

Purpose

Key parameters

Best practices

umodel_get_metrics

Get time-series metric data for an entity

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) metric_domain_name: metric domain name (required) metric: metric name (required) regionId: Alibaba Cloud region ID (required)

  • Supports range and instant queries with specifiable time ranges and aggregation methods.

  • Supports analysis_mode (basic, cluster, forecast, or anomaly_detection).

  • Supports time-series comparison using offset.

umodel_get_golden_metrics

Get golden metrics data

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) regionId: Alibaba Cloud region ID (required)

  • Quickly retrieve key performance indicators.

  • Includes latency, throughput, error rate, etc.

  • Supports time-series comparison using offset.

umodel_get_relation_metrics

Get metrics for relationships between entities

workspace: workspace name (required) src_domain: source entity domain (required) src_entity_set_name: source entity set name (required) src_entity_ids: list of source entity IDs (required) relation_type: relation type (required) direction: relation direction (required) regionId: Alibaba Cloud region ID (required)

  • Analyze microservice interactions.

  • Supports service dependency analysis.

umodel_get_logs

Get log data related to an entity

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) log_set_name: log set name (required) log_set_domain: log set domain (required) regionId: Alibaba Cloud region ID (required)

  • Use for fault diagnosis.

  • Supports performance analysis.

umodel_get_events

Get event data for an entity

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) event_set_domain: event set domain (required) event_set_name: event set name (required) regionId: Alibaba Cloud region ID (required)

  • Use for anomaly event analysis.

  • Supports alert event tracking.

umodel_get_traces

Get detailed data for a specific trace ID

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) trace_set_domain: trace set domain (required) trace_set_name: trace set name (required) trace_ids: list of trace IDs (required) regionId: Alibaba Cloud region ID (required)

  • Perform in-depth analysis of a trace.

  • Includes complete span information.

umodel_search_traces

Search for traces based on conditions

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) trace_set_domain: trace set domain (required) trace_set_name: trace set name (required) regionId: Alibaba Cloud region ID (required)

  • Supports filtering by duration and error status.

  • Returns trace summary information.

umodel_get_profiles

Get performance profiling data

workspace: workspace name (required) domain: entity domain (required) entity_set_name: entity set name (required) profile_set_domain: profile set domain (required) profile_set_name: profile set name (required) entity_ids: list of entity IDs (required) regionId: Alibaba Cloud region ID (required)

  • Use for performance bottleneck analysis.

  • Includes CPU and memory usage data.

IaaS tools (SLS and CMS)

These tools directly access the underlying APIs, and their names are prefixed with sls_ or cms_.

Log Service tools

Tool name

Purpose

Key parameters

Best practices

sls_list_projects

List projects

regionId (required)

Discover available Log Service projects.

sls_list_logstores

List Logstores

project, regionId (required)

Discover Logstores within a project.

sls_text_to_sql

Natural language to SQL

text, project, logStore, regionId (required)

Requires the sls:CallAiTools permission.

sls_text_to_promql

Natural language to PromQL

text, project, metricStore, regionId (required)

Requires the sls:CallAiTools permission.

sls_text_to_spl

Natural language to SPL

text, project, logStore, data_sample, regionId (required)

Requires the sls:CallAiTools permission.

sls_execute_sql

Execute an SQL query

project, logStore, query, regionId (required); from_time, to_time, limit, offset, reverse (optional)

Directly execute SQL queries.

sls_execute_spl

Execute a native SPL query

query, workspace, regionId (required); from_time, to_time (optional)

Directly execute SPL queries.

sls_get_context_logs

Get log context

project, logStore, pack_id, pack_meta, regionId (required); back_lines, forward_lines (optional)

View the context surrounding a log entry.

sls_log_explore

Log exploration analysis

project, logStore, regionId (required); query, from_time, to_time, max_patterns, sample_size (optional)

Automatically discover log patterns.

sls_log_compare

Log comparison

project, logStore, regionId (required); current_from_time, current_to_time, baseline_from_time, baseline_to_time (optional)

Compare logs from different time periods.

sls_sop

Log Service O&M Assistant

text, regionId (required)

Provides O&M recommendations.

CloudMonitor tools

Tool name

Purpose

Key parameters

Best practices

cms_execute_promql

Execute a PromQL query

project, metricStore, query, regionId (required); from_time, to_time (optional)

Query CloudMonitor metrics using PromQL.

Shared tools

Workspace and domain management

Tool name

Purpose

Key parameters

Best practices

list_workspace

List available workspaces

regionId: Alibaba Cloud region ID (required)

  • List the available workspaces before using other tools.

  • Supports cross-region workspace queries.

list_domains

List all entity domains in a workspace

workspace: workspace name (required) regionId: Alibaba Cloud region ID (required)

  • Identify available domains before querying entities.

  • Understand how data is classified.

introduction

Get an overview of the service

None

Provides an overview of the MCP Server's capabilities.

Time expressions

All data query tools support flexible time range formats:

Format

Example

Relative preset

last_5m, last_1h, last_3d, last_1w, last_1M, last_1y

Relative time

now()-1h, now-30m, now()-7d

Grafana style

now-15m~now-5m, now/d, now-1d/d

Keyword

today, yesterday

Absolute timestamp

1718451045 (seconds), 1718451045000 (milliseconds)

Datetime string

2024-01-01 00:00:00, 2024-01-01T00:00:00Z

Advanced features

Time-series comparison analysis

The umodel_get_metrics and umodel_get_golden_metrics tools support time-series comparison using the offset parameter:

# Compare the last hour with the same window one day ago
umodel_get_metrics(
    domain="apm", entity_set_name="apm.service",
    metric_domain_name="apm.metric.apm.service", metric="request_count",
    time_range="last_1h", offset="1d"
)

The response contains the following information:

  • current: Statistics for the current time period (max, min, avg, count)

  • compare: Statistics for the comparison time period

  • diff: Change analysis (trend, avg_change, avg_change_percent)

  • diff_score: A score from 0 to 1, where a higher value indicates a greater difference.

Advanced analysis modes

The umodel_get_metrics tool supports four analysis modes:

Mode

Description

Output fields

basic

Raw time-series data (default)

__ts__, __value__, __labels__

cluster

K-Means time-series clustering

__cluster_index__, __entities__, __sample_value__

forecast

Time-series forecasting (requires 1 to 5 days of historical data)

__forecast_ts__, __forecast_value__, __forecast_lower/upper_value__

anomaly_detection

Anomaly detection (requires 1 to 3 days of data)

__anomaly_list__, __anomaly_msg__, __value_min/max/avg__