基于ExecutionTime属性搭建Seq日志仪表盘的查询配置咨询
Seq日志仪表盘查询方案
核心查询语句
要筛选特定事件并展示耗时,同时标记超时事件,使用以下查询:
select Timestamp '时间戳', EventType '事件类型', ExecutionTime '耗时(ms)', case when ExecutionTime > 2 then '⚠️ 超时' else '' end '状态' from stream where exists(ExecutionTime) -- 替换为你需要监控的具体事件类型,多个事件用逗号分隔 and EventType in ('PaymentProcessed', 'OrderCreated') order by ExecutionTime desc
仪表盘高亮配置
在Seq仪表盘内为耗时超2ms的事件设置高亮:
- 新建表格面板,绑定上述查询语句
- 找到「耗时(ms)」列,打开列设置 → 条件格式
- 添加规则:当值 > 2时,将单元格背景设为红色、字体设为白色,快速识别超时事件
扩展统计查询
如果需要查看各事件的耗时分布情况,可使用聚合查询搭建统计面板:
select EventType '事件类型', avg(ExecutionTime) '平均耗时(ms)', max(ExecutionTime) '最大耗时(ms)', count(*) '事件总数' from stream where exists(ExecutionTime) and EventType in ('PaymentProcessed', 'OrderCreated') group by EventType order by avg(ExecutionTime) desc
内容的提问来源于stack exchange,提问作者tRuEsAtM
相关产品推荐
相关产品推荐

