查询分值分布
curl --request POST \
--url 'https://api.flashcat.cloud/rum/facet/count?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"end_time": 1712707200000,
"facet_key": "error_type",
"limit": 10,
"scope": "error",
"start_time": 1712620800000
}
'import requests
url = "https://api.flashcat.cloud/rum/facet/count?app_key="
payload = {
"end_time": 1712707200000,
"facet_key": "error_type",
"limit": 10,
"scope": "error",
"start_time": 1712620800000
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
end_time: 1712707200000,
facet_key: 'error_type',
limit: 10,
scope: 'error',
start_time: 1712620800000
})
};
fetch('https://api.flashcat.cloud/rum/facet/count?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/rum/facet/count?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_time' => 1712707200000,
'facet_key' => 'error_type',
'limit' => 10,
'scope' => 'error',
'start_time' => 1712620800000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/rum/facet/count?app_key="
payload := strings.NewReader("{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/rum/facet/count?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/rum/facet/count?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}"
response = http.request(request)
puts response.read_body{
"data": {
"items": [
{
"count": 1523,
"facet_value": "TypeError"
},
{
"count": 342,
"facet_value": "ReferenceError"
},
{
"count": 89,
"facet_value": "SyntaxError"
}
]
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "AccessDenied",
"message": "Access Denied."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}RUM 自定义字段
查询分值分布
按出现次数降序返回指定时间范围内某个分面字段的 Top N 值及其计数。
POST
/
rum
/
facet
/
count
查询分值分布
curl --request POST \
--url 'https://api.flashcat.cloud/rum/facet/count?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"end_time": 1712707200000,
"facet_key": "error_type",
"limit": 10,
"scope": "error",
"start_time": 1712620800000
}
'import requests
url = "https://api.flashcat.cloud/rum/facet/count?app_key="
payload = {
"end_time": 1712707200000,
"facet_key": "error_type",
"limit": 10,
"scope": "error",
"start_time": 1712620800000
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
end_time: 1712707200000,
facet_key: 'error_type',
limit: 10,
scope: 'error',
start_time: 1712620800000
})
};
fetch('https://api.flashcat.cloud/rum/facet/count?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/rum/facet/count?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_time' => 1712707200000,
'facet_key' => 'error_type',
'limit' => 10,
'scope' => 'error',
'start_time' => 1712620800000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/rum/facet/count?app_key="
payload := strings.NewReader("{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/rum/facet/count?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/rum/facet/count?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_time\": 1712707200000,\n \"facet_key\": \"error_type\",\n \"limit\": 10,\n \"scope\": \"error\",\n \"start_time\": 1712620800000\n}"
response = http.request(request)
puts response.read_body{
"data": {
"items": [
{
"count": 1523,
"facet_value": "TypeError"
},
{
"count": 342,
"facet_value": "ReferenceError"
},
{
"count": 89,
"facet_value": "SyntaxError"
}
]
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "AccessDenied",
"message": "Access Denied."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}{
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
},
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
}时间范围对齐与缓存
为便于重复查询复用缓存结果,起始时间向下、结束时间向上取整到max(1 分钟, 时间范围 ÷ 1226 向上取到下一个标准间隔档),例如 24 小时对齐到 2 分钟,7 天对齐到 10 分钟,30 天对齐到 1 小时。时间范围短于 100 个网格步长时不对齐、不缓存。起始端最多多出一个网格步长的数据;结束端取整到未来,该部分没有数据。最近时间的数据结果最多可能滞后 60 秒。
限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 300 次/分钟;100 次/秒 |
| 权限要求 | 无 —— 持有有效的 app_key 即可调用 |
使用说明
- 使用
POST /rum/field/list(传is_facet: true)发现每个 scope 下可用的facet_key。 facet_key必须是所请求scope下的分面字段(is_facet: true),且show_type为list、value_type不是数组类型,否则返回InvalidParameter。facet_key为null的事件不参与统计。传入facet_value时只统计取值等于它的事件,其 JSON 类型须与字段的value_type一致。- 传入
dql可在统计前过滤事件。sql只填WHERE条件本身;其中任意位置出现SELECT(不区分大小写)都会被拒绝。 - 调用者无权访问的私有应用的事件不参与统计,与
POST /rum/data/query一致。 limit默认 100,最大 100。start_time/end_time必填,为 Unix 毫秒时间戳,跨度不超过 31 天。scope为sourcemap时,用type和kind选择统计哪个符号文件库。
授权
请求体
application/json
分面值分布统计的请求参数。
符号文件存储的平台,仅在 scope 为 sourcemap 时使用。省略时默认为 browser;web、javascript 是 browser 的别名。
| 值 | 查询的存储 |
|---|---|
browser / web / javascript | JS Sourcemap(不含鸿蒙 ArkTS 与 React Native 行) |
android | Android ProGuard/R8 mapping;kind=native 时为 Android NDK .so 符号 |
ios | iOS dSYM 符号 |
miniprogram | 微信小程序 Sourcemap |
harmony | 鸿蒙 ArkTS Sourcemap;kind=native 时为鸿蒙 .so 符号 |
flutter | Flutter Dart AOT 符号 |
electron | Electron Breakpad 符号 |
react-native | React Native JS Sourcemap |
可用选项:
browser, web, javascript, android, ios, miniprogram, harmony, flutter, electron, react-native 此页面对您有帮助吗?