Honeycomb 是一个强大的数据分析平台,它能支持用户运行查询、分析数据并生成报告。下面将详细介绍该工具的使用方法。
若想使用 Honeycomb 工具,需先进行环境准备:
# 安装依赖项
npm install honeycomb-client
{
"环境": "生产",
"数据集": "api-requests",
"计算": [
{"字段": "duration_ms", "操作": "HEATMAP"},
{"字段": "duration_ms", "操作": "MAX"}
],
"过滤器": [
{"字段": "trace.parent_id", "操作": "does-not-exist"}
],
"分组": ["http.target", "name"],
"排序": [
{"字段": "duration_ms", "操作": "MAX", "顺序": "降序"}
]
}
{
"环境": "生产",
"数据集": "api-requests",
"计算": [
{"字段": "duration_ms", "操作": "HEATMAP"}
],
"过滤器": [
{"字段": "db.statement", "操作": "exists"}
],
"分组": ["db.statement"],
"时间范围": "过去一周"
}
{
"环境": "生产",
"数据集": "api-requests",
"计算": [
{"字段": "error_rate", "操作": "AVG"}
],
"过滤器": [
{"字段": "status_code", "操作": "in", "值": [400, 500]}
]
}
const Honeycomb = require('honeycomb-client');
// 初始化客户端
const client = new Honeycomb({
apikey: 'your_api_key',
dataset: 'api-requests'
});
// 执行查询
async function runQuery() {
try {
const result = await client.runQuery({
"计算": [
{ "字段": "duration_ms", "操作": "HEATMAP" }
],
"过滤器": [
{ "字段": "trace.parent_id", "操作": "does-not-exist" }
]
});
console.log(result);
} catch (error) {
console.error('查询失败:', error);
}
}
runQuery();
本项目遵循 Apache 2.0 许可证,更多详细信息请查看 LICENSE 文件。
| 错误代码 | 说明 |
|---|---|
| 401 | 未授权 |
| 500 | 服务器内部错误 |
| 400 | 请求格式有误 |