Storage modeling

更新时间:
复制 MD 格式

Overview

Storage is an abstraction layer in UModel that defines where and how dataset data is stored and accessed. Storage modeling connects UModel to various storage backends and provides a consistent data access experience.

Role and value of storage

Storage modeling serves the following purposes in UModel:

  • Storage abstraction: Unifies access interfaces across different storage systems and hides underlying implementation details.

  • Data location: Pinpoints the storage location and access parameters for a dataset.

  • Query optimization: Improves query performance through filter conditions and view configurations.

  • Cost control: Optimizes data access costs and efficiency through storage configurations.

Supported storage classes

UModel supports the following storage classes:

Storage class

Applicable data

Key attributes

Scenarios

sls_logstore

Log data

Real-time retrieval, full text search

Application logs, audit logs, event data

sls_metricstore

Metric data

Timing storage, aggregate query

Monitoring metrics, performance data, business metrics

sls_entitystore

Entity relational data

Graph storage, relational query, entity management

Service topology, resource relationships, dependency analysis

aliyun_prometheus

Prometheus metrics

Compatible with PromQL

Cloud-native monitoring, container metrics, cluster monitoring

Simple Log Service Logstore storage

Basic configuration

Simple Log Service (SLS) Logstore stores log data and provides high-performance log writing and retrieval.

Configuration parameters

Parameter

Type

Required

Description

Example

kind

string

Yes

The storage class identifier.

Static field: sls_logstore

region

string

Yes

The region of the SLS endpoint.

cn-hangzhou

project

string

Yes

The name of the SLS project.

my-project

store

string

Yes

The name of the Logstore.

app-logs

search_filter

string

No

The base filter condition, using SLS query syntax.

"*"

spl_view

string

No

The Structured Process Language (SPL) view definition.

| extend status = case(status >= 400, 'error', 'success') | where status = 'error'

Configuration example

kind: sls_logstore
schema:
  url: "umodel.aliyun.com"
  version: "v0.1.0"
metadata:
  name: "app.logs.storage"
  display_name:
    en_us: >
      Application Logs Storage
  description:
    en_us: >
      The application logs storage.
  domain: app
spec:
  region: "cn-hangzhou" # The region where the logstore is located.
  project: "my-observability-project" # The project name.
  store: "application-logs" # The store name
  search_filter: "level:ERROR OR level:WARN"

Advanced configuration

search_filter

Use search_filter to select a subset of Logstore data for the upstream dataset.

For more information about the search_filter syntax, see Query syntax and features.

# Basic keyword filtering
search_filter: "error OR exception"

# Field value filtering
search_filter: "service_name:user-service AND level:ERROR"

spl_view

Creates dynamic data views for complex data transformations. Typically used in dynamic entity and relationship scenarios.

For more information about the spl_view syntax, see SPL syntax.

spl_view: >
  | extend "resource.duration"=cast("resource.duration" as integer),
            "resource.fail"=case when cast("resource.success" as integer)=0 then 1 else 0 end,
            "resource.slow"=case when cast("resource.duration" as integer)>2000 then 1 else 0 end
  | stats
    "service_id" = arbitrary("app.id"),
    "service_type" = arbitrary("app.type"),
    "resource_domain" = arbitrary("resource.domain"),
    "api_name" = arbitrary("resource.name"),
    "resource_method" = arbitrary("resource.method"),
    "request_count" = count(*),
    "view_count" = count(DISTINCT "view.name"),
    "fail_count" = sum("resource.fail"),
    "slow_count" = sum("resource.slow"),
    "trace_count" = count("resource.trace_id"),
    "resource_duration"= avg("resource.duration"),
    "last_time" = max("timestamp")
    by "resource.domain", "resource.name", "resource.method"
  | extend
      last_time = cast("last_time" as varchar),
      request_count = cast("request_count" as varchar),
      view_count = cast("view_count" as varchar),
      fail_count = cast("fail_count" as varchar),
      slow_count = cast("slow_count" as varchar),
      trace_count = cast("trace_count" as varchar),
      resource_duration = cast("resource_duration" as varchar)
  | sort request_count desc

SLS MetricStore storage

Basic configuration

SLS MetricStore stores time-series metric data and provides efficient aggregation and query capabilities.

Configuration parameters

Parameter

Type

Required

Description

Example

kind

string

Yes

The storage class identifier.

Static field: sls_metricstore

region

string

Yes

The region of the SLS endpoint.

cn-hangzhou

project

string

Yes

The name of the SLS project.

my-project

store

string

Yes

The name of the Metricstore.

app-metrics

Configuration example

kind: sls_metricstore
schema:
  url: "umodel.aliyun.com"
  version: "v0.1.0"
metadata:
  name: "app.metrics.storage"
  display_name:
    en_us: >
      Application Metrics Storage
  description:
    en_us: >
      The application metrics storage.
  domain: app
spec:
  region: "cn-hangzhou" # The region where the metricstore is located.
  project: "monitoring-project" # The project name.
  store: "application-metrics" # The store name

Managed Service for Prometheus storage

Basic configuration

Managed Service for Prometheus storage integrates with the Prometheus service and supports standard PromQL queries.

Configuration parameters

Parameter

Type

Required

Description

Example

kind

string

Yes

The storage class identifier.

Static field: aliyun_prometheus

region

string

Yes

The region of the Prometheus instance.

cn-hangzhou

instance_id

string

Yes

The ID of the Prometheus instance.

c39a1048921e648ee89ba

sls_project

string

No

The associated SLS project.

k8s-monitoring-project

sls_metricstore

string

No

The associated SLS Metricstore.

prometheus-metrics

Configuration example

kind: aliyun_prometheus
schema:
  url: "umodel.aliyun.com"
  version: "v0.1.0"
metadata:
  name: "k8s.prometheus.storage"
  display_name:
    en_us: >
      Kubernetes Prometheus Storage
  description:
    en_us: >
      The Kubernetes cluster Prometheus monitoring storage.
  domain: k8s
spec:
  region: "cn-hangzhou" # The region where the prometheus instance is located.
  instance_id: "c39a1048921e648ee89ba" # The prometheus instance ID.
  sls_project: "k8s-monitoring-project" # The SLS project name.
  sls_metricstore: "prometheus-metrics" # The SLS metricstore name.

EntityStore storage

UModel creates an EntityStore by default to store EntitySet and EntitySetLink data. No manual configuration is required.