遥测聚合数据查询
本地
本地
GET
http://127.0.0.1:9999/api/v1/telemetry/datas/statistic
遥测数据
部分参数说明:
*time_range [时间范围]
- 支持的参数:custom,last_5m,last_15m,last_30m,last_1h,last_3h,last_6h,last_12h,last_24h,last_3d,last_7d,last_15d,last_30d,last_60d,last_90d,last_6m,last_1y
- 当选择自定义时,要送start_time和end_time
- 如果time_range>=3小时,则aggregate_window不能是no_aggregate(不聚合)
*aggregate_window [聚合间隔]
- 支持的参数:"no_aggregate","30s","1m","2m","5m","10m","30m","1h","3h","6h","1d","7d","1mo"
- 不聚合
aggregate_function [聚合方法]
- avg 平均数
- max 最大值
- 当aggregate_window为no_aggregate的时候,前端不显示aggregate_function下拉,接口不送aggregate_function
- 当aggregate_window不为no_aggregate,aggregate_function必输,前端可默认平均值
前端筛选联动规则
页面初始化:
- time_range: "last_1h"
- aggregate_window: "no_aggregate"
- aggregate_function: 不送
time_range不为custom的选择:
-
3小时内的数据 (time_range: last_5m, last_15m, last_30m, last_1h):
- aggregate_window: 支持任何选项
-
最近3小时 (time_range: last_3h):
- aggregate_window: 不支持"no_aggregate",其他都支持
-
最近6小时 (time_range: last_6h):
- aggregate_window: 不支持小于等于"30s"的选项:不支持"no_aggregate", "30s",其他都支持
-
最近12小时 (time_range: last_12h):
- aggregate_window: 不支持小于等于"1m"的选项:不支持"no_aggregate", "30s", "1m",其他都支持
-
最近24小时 (time_range: last_24h):
- aggregate_window: 不支持小于等于"2m"的选项:
-
最近3天 (time_range: last_3d):
- aggregate_window: 不支持小于等于"5m"的选项:
-
最近7天 (time_range: last_7d):
- aggregate_window: 不支持小于等于"10m"的选项:
-
最近15天 (time_range: last_15d):
- aggregate_window: 不支持小于等于"30m"的选项:
-
最近30天 (time_range: last_30d):
- aggregate_window: 不支持小于等于"1h"的选项:
-
最近60天 (time_range: last_60d):
- aggregate_window: 不支持小于等于"3h"的选项:
-
最近90天 (time_range: last_90d):
- aggregate_window: 不支持小于等于"6h"的选项:
-
最近6个月 (time_range: last_6m):
- aggregate_window: 不支持小于等于"1d"的选项:
-
最近1年 (time_range: last_1y):
- aggregate_window: 不支持小于等于"7d"的选项:
当用户选择custom或手动设置时间区间的时候:
- time_range要变成"custom"
- 区间<3小时
- aggregate_window: 支持任何选项
- 区间>=3小时
- aggregate_window: 不支持小于等于"30s"的选项:不支持"no_aggregate", "30s",其他都支持
- 其他与上面类推
请求参数示例:
{
"device_id": "4a5b326c-ba99-9ea2-34a9-1c484d69a1ab",
"key": "temperature",
"start_time": 1711864176268,
"end_time": 1711864177268,
"aggregate_window": "no_aggregate",
"time_range": "custom"
}
{
"device_id": "4a5b326c-ba99-9ea2-34a9-1c484d69a1ab",
"key": "temperature",
"time_range": "last_1h"
"aggregate_window": "30s",
"aggregate_function":"max"
}
请求参数
Query 参数
aggregate_function
string
可选
aggregate_window
string
必需
示例值:
no_aggregate
device_id
string
设备ID
示例值:
f3625aae-1283-1afc-259e-f43a58ba7070
end_time
integer
可选
示例值:
1711864177268
key
string
必需
示例值:
temp
start_time
integer
可选
示例值:
1711864177268
time_range
string
必需
示例值:
custom
is_export
boolean
是否导出
示例值:
true
Header 参数
x-token
string
可选
默认值:
{{x-token}}
示例代码
返回响应
修改于 2025-03-25 01:57:48