跳转至

指标多维归因分析查询

接口说明

本接口是针对指标以及维度进行多维归因结果的查询,返回不同对比日期的变化情况以及各个维度的贡献率。

接口URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/metric/attribution/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 指标名称。用于归因分析的指标
dimensions List 分析维度名称列表支持任意字符,长度150字符以内
filters List 筛选器。这里引用的是维度实体
orders List 查询的排序规则。默认按照contributionRate 倒排。排序列: currentValue、comparisonValue、growth、growthRate、contributionRate

`"orders": [
       {
            "column":            "overallContributionRate",
             "type": "DESC"
}
]
limit Intger 返回行数默认 200

attributionRange 参数说明

参数 类型 是否必选 描述
granularity String 时间粒度:DAY,WEEK,MONTH,QUARTER,YEAR
currentFilter String 当前时间:
"currentFilter":
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 数据结果。具体参数说明参见;4.2data 参数说明

data 参数说明

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

table 参数说明

参数 类型 是否必选 最大长度 描述
all array 具体参数说明参见:4.4all 参数说明
dimensions array 具体参数说明参见: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": "testtesttest",
    "dimensions": [
        "BWBDM"
    ],
    "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": [

    ]
}

响应示例

{
    "data": {
        "metric": "testtesttest",
        "table": {
            "all": {
                "dimensionValue": null,
                "currentValue": 90.0,
                "comparisonValue": 0.0,
                "growth": 90.0,
                "growthRate": 9.0E7,
                "overallContributionRate": null,
                "relativeContributionRate": null
            },
            "dimensions": {
                "BWBDM": {
                    "dimensionValue": [
                        "RMB"
                    ],
                    "currentValue": [
                        90.0
                    ],
                    "comparisonValue": [
                        0.0
                    ],
                    "growth": [
                        90.0
                    ],
                    "growthRate": [
                        9.0E7
                    ],
                    "overallContributionRate": [
                        1.0
                    ],
                    "relativeContributionRate": null
                }
            }
        }
    },
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "d6b9429207254f6883edddc1ad5ec14e.28656.17353825580631533"
}