feat: sample terminal business latency

This commit is contained in:
2026-09-19 16:30:20 +08:00
parent 8ce9f4e1fa
commit 5a49dd5644
14 changed files with 139 additions and 21 deletions

View File

@@ -25,6 +25,14 @@ type BusinessSnapshot struct {
Truncated bool
// RecentEvents 固定事件类别在最近窗口内的有界数量。
RecentEvents map[string]uint64
// TaskTerminalLatencySeconds 最近窗口终态任务创建到完成的平均耗时样本。
TaskTerminalLatencySeconds float64
// TaskTerminalLatencyMaxSeconds 最近窗口终态任务样本最大耗时。
TaskTerminalLatencyMaxSeconds float64
// WorkflowTerminalLatencySeconds 最近窗口终态流程创建到完成的平均耗时样本。
WorkflowTerminalLatencySeconds float64
// WorkflowTerminalLatencyMaxSeconds 最近窗口终态流程样本最大耗时。
WorkflowTerminalLatencyMaxSeconds float64
}
// RecordBusinessSnapshot records one bounded database sample. A failed sample
@@ -58,6 +66,10 @@ func (r *Registry) RecordBusinessSnapshot(snapshot BusinessSnapshot, started tim
for _, eventType := range eventTypes {
r.SetGauge("orbit_business_events_recent", float64(snapshot.RecentEvents[eventType]), Labels{"event": eventType})
}
r.SetGauge("orbit_pulse_task_terminal_latency_seconds", snapshot.TaskTerminalLatencySeconds, nil)
r.SetGauge("orbit_pulse_task_terminal_latency_max_seconds", snapshot.TaskTerminalLatencyMaxSeconds, nil)
r.SetGauge("orbit_weave_workflow_terminal_latency_seconds", snapshot.WorkflowTerminalLatencySeconds, nil)
r.SetGauge("orbit_weave_workflow_terminal_latency_max_seconds", snapshot.WorkflowTerminalLatencyMaxSeconds, nil)
r.SetGauge("orbit_pulse_tasks_oldest_age_seconds", snapshot.TaskOldestAgeSeconds, nil)
r.SetGauge("orbit_result_delivery_oldest_age_seconds", snapshot.DeliveryOldestAgeSeconds, nil)
r.SetGauge("orbit_weave_workflow_oldest_age_seconds", snapshot.WorkflowOldestAgeSeconds, nil)