Files
goclaw/internal/tracing/collector_test_helpers.go
viettranx 1ac08155b0 feat(trace): reliable stop/abort with ctx-aware streams and 2-phase router
Makes the Stop button on the traces page actually stop running traces.
Seven-phase implementation across provider HTTP, agent router, trace
persistence, WS events, tool exec, i18n, and integration tests.

- Provider HTTP+SSE ctx-aware: close socket on cancel via CtxBody wrapper
- Router 2-phase abort: CAS state machine, 3s grace, force-mark fallback
- Trace retry: 3 inline retries + 10-max retry queue, stale recovery 10min
- trace.status WS event: real-time UI updates (invalidates query on receive)
- Tool exec: process-group kill (SIGTERM→3s→SIGKILL), Rod page ctx watch
- i18n: 6 abort toast variants in en/vi/zh
- Integration: 9 scenarios, -race clean

Fixes tenant-ctx loss in forceMarkTraceAborted and retry worker broadcast
(caught by code-reviewer: C1/C2). Stale threshold intentionally 10min
because start_time-based; last_span_at migration is a follow-up.
2026-04-14 18:28:31 +07:00

17 lines
488 B
Go

//go:build integration
package tracing
// RetryQueueLen returns the current length of the retry queue.
// Used only in integration tests to verify failed updates are enqueued.
func (c *Collector) RetryQueueLen() int {
return len(c.retryCh)
}
// RecoverStaleNow manually triggers the stale recovery process once.
// Used in integration tests to verify stale trace recovery without waiting
// for the periodic 30s ticker.
func (c *Collector) RecoverStaleNow() {
c.recoverStaleOnce()
}