跳转至

指标多维归因分析下钻查询

接口描述

本接口用于用户能够对特定业务指标的变动原因进行细致入微的分析。

接口URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/metric/attribution/drill/report/query

anymetrics_host:anymetrics_port 获取方式请参考:调用方式

请求参数

公共请求参数(HEADERS)

参数 类型 是否必选 最大长度 描述
tenant-id String 32 租户ID,用于指标查询内容所在的租户
auth-type String 32 认证方式,用于设置身份认证方式 UID:使用 UID 进行身份认证TOKEN:使用 TOKEN 进行身份认证
auth-value String 32 UID或者TOKEN值,与auth-type 类型选择一致

公共参数获取方式

tenant-id 与 auth-value:在 Aloudata CAN 顶部导航栏选择指标应用,左边菜单栏选择 API 集成。在 API 集成界面获取取到tenant-id 与auth-value。

请求参数

参数 类型 是否必选 描述
attributionRange Map 更多详情请参考:attributionRange 参数说明
metric String 指标名称。用于归因分析的指标
dimension String 分析维度名称列表支持任意字符,长度150字符以内
filters List 筛选器

1. 当前下钻的维度的值;

2. 本身指标分析时的筛选;
orders List 查询的排序规则。默认按照contributionRate 倒排。排序列: currentValue、comparisonValue、growth、growthRate、contributionRate

<br> "orders": [<br> {<br> "column": "overallContributionRate",<br> "type": "DESC"<br> }<br> ]<br>
limit Integer 返回行数默认 200

attributionRange 参数说明

参数 类型 是否必选 描述
granularity String 时间粒度:DAY,WEEK,MONTH,QUARTER,YEAR
currentFilter String 当前时间
comparisonType String 对比类型:CUSTOM,DOD,YOY,MOM,QOQ,WOW
endDateTime String 当对比类型为 CUSTOM 时,需要指定startDateTime 和endDateTime
startDateTime String

响应参数

响应参数说明

参数 类型 是否必选 最大长度 描述
code String 32 接口响应码
message String 512 消息体
traceId String 128 traceId
data Object 具体参数说明参见:4.2data 参数说明

data 参数说明

参数 类型 是否必选 最大长度 描述
metric String 指标 code
table Object 具体参数说明参见:4.3table 参数说明

table 参数说明

参数 类型 是否必选 最大长度 描述
all Object 具体参数说明参见:4.4all 参数说明
dimension Object 具体参数说明参见:4.5dimensions 参数说明

all 参数说明

参数 类型 是否必选 最大长度 描述
currentValue Double 当前值
comparisonValue Double 这是用于比较的基准值,通常是来自之前时间段或不同条件下的数值。例如,上月的销售额。
growth Double 增长值:这是当前值与对比值之间的差异,通常用于表示实际增长或减少的量。例如,当前销售额减去上月销售额。
growthRate Double 增长率:这是增长值相对于对比值的百分比,表示增长的相对程度。计算公式通常是:(增长值 / 对比值) × 100%。
contributionRate Double 当前维度的对总体增长的贡献程度

dimensions 参数说明

参数 类型 是否必选 最大长度 描述
dimensionValue List 维度名称
currentValue List 当前值
comparisonValue List 对比值
growth List 增长值
growthRate List 增长率
contributionRate List 贡献率

示例

示例一:

  • 请求
{
    "metric": "total_Count",
    "dimension": 
        "brond_name"
    ,
    "attributionRange": {
        "granularity": "DAY",
        "comparisonType": "CUSTOM",
        "startDateTime": "2024-12-23 12:18:22",
        "endDateTime": "2024-12-23 12:18:22",
        "currentFilter": {
            "type": "EXPR",
            "expr": "DateTrunc([metric_time], \"DAY\")=\"2024-11-25\""
        }
    },
    "filters": [
        "IN(['province'],\"浙江\")"
    ],
     "orders": [
        {
            "column": "overallContributionRate",
            "type": "DESC"
        }
    ]

    "limit":100
}

请求说明:该查询旨在获取total_Count指标的数据,按brond_name维度进行每日粒度的分组分析。筛选条件限定为2024-11-25的数据,与2024-12-23 进行对比,并且进一步下钻筛选total_Count为浙江的数据。最终结果按品牌名称降序排列,并限制返回前100条记录

  • 响应
{
    "data": {
        "metric": null,
        "table": {
            "all": {
                "dimensionValue": null,
                "currentValue": 91.0,
                "comparisonValue": 0.0,
                "growth": 91.0,
                "growthRate": 9.1E7,
                "overallContributionRate": null,
                "relativeContributionRate": null
            },
            "dimensions": {
                "product_name": {
                    "dimensionValue": [
                        "aa"
                    ],
                    "currentValue": [
                        91.0
                    ],
                    "comparisonValue": [
                        0.0
                    ],
                    "growth": [
                        91.0
                    ],
                    "growthRate": [
                        9.1E7
                    ],
                    "overallContributionRate": [
                        1.0
                    ],
                    "relativeContributionRate": null
                }
            }
        }
    },
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "d6b9429207254f6883edddc1ad5ec14e.189.17355483517995045"
}