更新时间:2024-05-30 GMT+08:00
分享

查看复合指标详情

功能介绍

通过ID获取复合指标详情信息。

调用方法

请参见如何调用API

URI

GET /v2/{project_id}/design/compound-metrics/{id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参见项目ID和账号ID

id

String

实体ID,填写String类型替代Long类型。

表2 Query参数

参数

是否必选

参数类型

描述

latest

Boolean

是否查询最新的。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

IAM Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)

使用Token认证时必选。

workspace

String

工作空间ID,获取方法请参见实例ID和工作空间ID

X-Project-Id

String

项目ID,获取方法请参见项目ID和账号ID

多project场景采用AK/SK认证的接口请求,则该字段必选。

Content-Type

String

默认值:application/json;charset=UTF-8

可选,有Body体的情况下必选,没有Body体则无需填写和校验。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

data

data object

返回数据。

表5 data

参数

参数类型

描述

value

CompoundMetricVO object

返回的数据信息。

表6 CompoundMetricVO

参数

参数类型

描述

id

String

编码,填写String类型替代Long类型。

name_en

String

字段名。

name_ch

String

业务属性。

description

String

描述

dimension_group

String

颗粒度ID。

group_name

String

颗粒度名称,只读。

group_code

String

颗粒度编码,只读。

compound_type

String

复合指标类型。

枚举值:

  • EXPRESSION: 表达式

  • PERIODICITY_VALUED_COMPARISON: 环比

  • INTERVAL_VALUED_COMPARISON: 同比

comparison_type

String

比较类型。

枚举值:

  • YEAR_TO_YEAR: 年同比

  • MONTH_TO_MONTH: 月同比

  • WEEK_TO_WEEK: 周同比

metric_ids

Array of strings

指标信息,填写String类型替代Long类型。

metric_names

Array of strings

指标名称信息。

compound_metric_ids

Array of strings

复合指标信息,填写String类型替代Long类型。

compound_metric_names

Array of strings

复合指标名称信息

cal_fn_ids

Array of strings

引用函数ID,填写String类型替代Long类型。

cal_exp

String

计算表达式,形如${index_id} + ${compound#index_id},其中index_id代表引用的衍生指标ID,compound#index_id代表引用的复合指标ID。

l1_id

String

主题域分组ID,只读,填写String类型替代Long类型。

l2_id

String

主题域ID。

l3_id

String

业务对象ID,填写String类型替代Long类型。

data_type

String

字段类型。

create_by

String

创建人。

update_by

String

更新人。

status

String

实体的发布状态,只读,创建和更新时无需填写。

枚举值:

  • DRAFT: 草稿

  • PUBLISH_DEVELOPING: 发布待审核

  • PUBLISHED: 已发布

  • OFFLINE_DEVELOPING: 下线待审核

  • OFFLINE: 已下线

  • REJECT: 已驳回

create_time

String

创建时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

update_time

String

更新时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

approval_info

ApprovalVO object

审批信息,只读参数。业务对象最近一次的审批信息,包括审批的业务详情、审核人信息、审核时间等。

new_biz

BizVersionManageVO object

业务版本管理,只读。

monitor

MetricMonitorVO object

指标监控信息。

l1

String

主题域分组中文名,只读,创建和更新时无需填写。

l2

String

主题域中文名,只读,创建和更新时无需填写。

l3

String

业务对象中文名,只读,创建和更新时无需填写。

summary_table_id

String

汇总表ID,只读,填写String类型替代Long类型。

表7 ApprovalVO

参数

参数类型

描述

id

String

审批单ID,填写String类型替代Long类型。

tenant_id

String

项目ID,获取方式参考接口路径参数“project_id”。

name_ch

String

业务中文名。

name_en

String

业务英文名。

biz_id

String

业务ID,填写String类型替代Long类型。

biz_type

String

业务实体类型。

枚举值:

  • AGGREGATION_LOGIC_TABLE: 汇总表

  • ATOMIC_INDEX: 原子指标

  • ATOMIC_METRIC: 原子指标(新)

  • BIZ_CATALOG: 流程架构目录

  • BIZ_METRIC: 业务指标

  • CODE_TABLE: 码表

  • COMMON_CONDITION: 通用限定

  • COMPOSITE_METRIC: 复合指标(新)

  • COMPOUND_METRIC: 复合指标

  • CONDITION_GROUP: 限定分组

  • DEGENERATE_DIMENSION: 退化维度

  • DERIVATIVE_INDEX: 衍生指标

  • DERIVED_METRIC: 衍生指标(新)

  • DIMENSION: 维度

  • DIMENSION_ATTRIBUTE: 维度属性

  • DIMENSION_HIERARCHIES: 维度层级

  • DIMENSION_LOGIC_TABLE: 维度表

  • DIMENSION_TABLE_ATTRIBUTE: 维度属性

  • DIRECTORY: 目录

  • FACT_ATTRIBUTE: 事实表属性

  • FACT_DIMENSION: 事实表维度

  • FACT_LOGIC_TABLE: 事实表

  • FACT_MEASURE: 事实表度量

  • FUNCTION: 函数

  • INFO_ARCH: 信息架构(批量修改主题使用)

  • MODEL: 模型

  • QUALITY_RULE: 质量规则

  • SECRECY_LEVEL: 密级

  • STANDARD_ELEMENT: 数据标准

  • STANDARD_ELEMENT_TEMPLATE: 数据标准模板

  • SUBJECT: 主题

  • SUMMARY_DIMENSION_ATTRIBUTE: 汇总表维度属性

  • SUMMARY_INDEX: 汇总表指标属性

  • SUMMARY_TIME: 汇总表时间周期属性

  • TABLE_MODEL: 关系模型(逻辑模型/物理模型)

  • TABLE_MODEL_ATTRIBUTE: 关系模型属性(逻辑模型/物理模型)

  • TABLE_MODEL_LOGIC: 逻辑实体

  • TABLE_TYPE: 表类型

  • TAG: 标签

  • TIME_CONDITION: 时间限定

biz_info

String

序列化之后的业务详情,类型是string。

biz_info_obj

Object

业务详情,类型是object。

biz_version

Integer

业务版本。

biz_status

String

实体的发布状态,只读,创建和更新时无需填写。

枚举值:

  • DRAFT: 草稿

  • PUBLISH_DEVELOPING: 发布待审核

  • PUBLISHED: 已发布

  • OFFLINE_DEVELOPING: 下线待审核

  • OFFLINE: 已下线

  • REJECT: 已驳回

approval_status

String

业务审批状态,只读。

枚举值:

  • DEVELOPING: 审核中

  • APPROVED: 审核通过

  • REJECT: 审核驳回

  • WITHDREW: 审核撤销

approval_type

String

业务审核类型。

枚举值:

  • PUBLISH: 发布

  • OFFLINE: 下线

submit_time

String

提交时间。

create_by

String

创建者。

l1

String

主题域分组中文名,只读,创建和更新时无需填写。

l2

String

主题域中文名,只读,创建和更新时无需填写。

l3

String

业务对象中文名,只读,创建和更新时无需填写。

approval_time

String

审核时间。

approver

String

审核人。

email

String

审核人邮箱。

msg

String

审核信息。

directory_path

String

目录树。

表8 BizVersionManageVO

参数

参数类型

描述

id

String

ID信息,填写String类型替代Long类型。

biz_type

String

业务实体类型。

枚举值:

  • AGGREGATION_LOGIC_TABLE: 汇总表

  • ATOMIC_INDEX: 原子指标

  • ATOMIC_METRIC: 原子指标(新)

  • BIZ_CATALOG: 流程架构目录

  • BIZ_METRIC: 业务指标

  • CODE_TABLE: 码表

  • COMMON_CONDITION: 通用限定

  • COMPOSITE_METRIC: 复合指标(新)

  • COMPOUND_METRIC: 复合指标

  • CONDITION_GROUP: 限定分组

  • DEGENERATE_DIMENSION: 退化维度

  • DERIVATIVE_INDEX: 衍生指标

  • DERIVED_METRIC: 衍生指标(新)

  • DIMENSION: 维度

  • DIMENSION_ATTRIBUTE: 维度属性

  • DIMENSION_HIERARCHIES: 维度层级

  • DIMENSION_LOGIC_TABLE: 维度表

  • DIMENSION_TABLE_ATTRIBUTE: 维度属性

  • DIRECTORY: 目录

  • FACT_ATTRIBUTE: 事实表属性

  • FACT_DIMENSION: 事实表维度

  • FACT_LOGIC_TABLE: 事实表

  • FACT_MEASURE: 事实表度量

  • FUNCTION: 函数

  • INFO_ARCH: 信息架构(批量修改主题使用)

  • MODEL: 模型

  • QUALITY_RULE: 质量规则

  • SECRECY_LEVEL: 密级

  • STANDARD_ELEMENT: 数据标准

  • STANDARD_ELEMENT_TEMPLATE: 数据标准模板

  • SUBJECT: 主题

  • SUMMARY_DIMENSION_ATTRIBUTE: 汇总表维度属性

  • SUMMARY_INDEX: 汇总表指标属性

  • SUMMARY_TIME: 汇总表时间周期属性

  • TABLE_MODEL: 关系模型(逻辑模型/物理模型)

  • TABLE_MODEL_ATTRIBUTE: 关系模型属性(逻辑模型/物理模型)

  • TABLE_MODEL_LOGIC: 逻辑实体

  • TABLE_TYPE: 表类型

  • TAG: 标签

  • TIME_CONDITION: 时间限定

biz_id

String

业务ID,填写String类型替代Long类型。

biz_info

String

业务对象信息。

status

String

实体的发布状态,只读,创建和更新时无需填写。

枚举值:

  • DRAFT: 草稿

  • PUBLISH_DEVELOPING: 发布待审核

  • PUBLISHED: 已发布

  • OFFLINE_DEVELOPING: 下线待审核

  • OFFLINE: 已下线

  • REJECT: 已驳回

biz_version

Integer

业务版本,只读。

create_time

String

创建时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

update_time

String

更新时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

表9 MetricMonitorVO

参数

参数类型

描述

id

String

编码,填写String类型替代Long类型。

other_metric_ids

Array of strings

其他指标ID,填写String类型替代Long类型。

other_metric_names

Array of strings

其他指标名称,只读。

other_compound_metric_ids

Array of strings

其他复合指标ID。

other_compound_metric_names

Array of strings

其他复合指标名称。

expression

String

告警表达式。

metric_id

String

挂载指ID,填写String类型替代Long类型。

front_configs

String

前端表达式配置,用于前端数据恢复。

metric_type

String

挂载指标类型。

状态码: 400

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

状态码: 401

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

状态码: 403

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

请求示例

根据复合指标ID,查询复合指标详情。

GET https://{endpoint}/v2/{project_id}/design/compound-metrics/1170056628536553472

响应示例

状态码: 200

Success,返回data数据是CompoundMetricVO详情。

{
  "data" : {
    "value" : {
      "id" : "1170056628536553472",
      "name_en" : "com_compound_metric_test",
      "name_ch" : "复合指标测试",
      "description" : "",
      "dimension_group" : "1169322847009742848,1169329693619625984.1169329693695123460.1169327565677182976",
      "group_name" : "供应商,行程订单.下车时间",
      "group_code" : "dim_vendor,fact_stroke_order.dim_dropoff",
      "compound_type" : "EXPRESSION",
      "comparison_type" : null,
      "metric_ids" : [ "1170007051066355712" ],
      "metric_names" : [ "总车费(供应商,行程订单.下车时间)" ],
      "compound_metric_ids" : [ ],
      "compound_metric_names" : null,
      "cal_fn_ids" : null,
      "cal_exp" : "${1170007051066355712}/2",
      "l1_id" : "1169309252771299328",
      "l2_id" : "1169309374670356480,1169310587398889472",
      "l3_id" : null,
      "data_type" : "BIGINT",
      "create_by" : "ei_dayu_y00321344_01",
      "update_by" : "ei_dayu_y00321344_01",
      "status" : "PUBLISHED",
      "create_time" : "2023-11-03T17:47:19+08:00",
      "update_time" : "2023-11-03T17:55:12+08:00",
      "approval_info" : {
        "id" : "1170056629291528192",
        "tenant_id" : null,
        "name_ch" : null,
        "name_en" : null,
        "biz_id" : "1170056628536553472",
        "biz_type" : null,
        "biz_info" : null,
        "biz_info_obj" : null,
        "biz_version" : 0,
        "biz_status" : "PUBLISHED",
        "approval_status" : "APPROVED",
        "approval_type" : null,
        "submit_time" : "2023-11-03T17:47:19+08:00",
        "create_by" : null,
        "l1" : null,
        "l2" : null,
        "l3" : null,
        "approval_time" : "2023-11-03T17:55:12+08:00",
        "approver" : "ei_dayu_y00321344_01",
        "email" : null,
        "msg" : "Fast Approval OK.",
        "directory_path" : null
      },
      "new_biz" : null,
      "monitor" : {
        "id" : "1170056628612050944",
        "other_metric_ids" : [ "1170007051066355712" ],
        "other_metric_names" : [ "总车费(供应商,行程订单.下车时间)" ],
        "other_compound_metric_ids" : [ ],
        "other_compound_metric_names" : null,
        "expression" : "${1170007051066355712}/2 < 0",
        "metric_id" : "1170056628536553472",
        "front_configs" : null,
        "metric_type" : "COMPOUND_METRIC"
      },
      "l1" : "城市交通",
      "l2" : "行程记录/行程事实",
      "l3" : null,
      "summary_table_id" : "1170007052639219712"
    }
  }
}

状态码: 400

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user request is illegal."
}

状态码: 401

{
  "error_code" : "DS.60xx",
  "error_msg" : "User authentication failed."
}

状态码: 403

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user does not have permission to call this API."
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.dataartsstudio.v1.region.dataartsstudioRegion;
import com.huaweicloud.sdk.dataartsstudio.v1.*;
import com.huaweicloud.sdk.dataartsstudio.v1.model.*;


public class ShowCompoundMetricByIdSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        dataartsstudioClient client = dataartsstudioClient.newBuilder()
                .withCredential(auth)
                .withRegion(dataartsstudioRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowCompoundMetricByIdRequest request = new ShowCompoundMetricByIdRequest();
        request.withId("{id}");
        try {
            ShowCompoundMetricByIdResponse response = client.showCompoundMetricById(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import dataartsstudioRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdataartsstudio.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("CLOUD_SDK_SK")
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId) \

    client = dataartsstudioClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(dataartsstudioRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowCompoundMetricByIdRequest()
        request.id = "{id}"
        response = client.show_compound_metric_by_id(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dataartsstudio.NewdataartsstudioClient(
        dataartsstudio.dataartsstudioClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowCompoundMetricByIdRequest{}
	request.Id = "{id}"
	response, err := client.ShowCompoundMetricById(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Success,返回data数据是CompoundMetricVO详情。

400

BadRequest

401

Unauthorized

403

Forbidden

分享:

    相关文档

    相关产品