Documentation
¶
Overview ¶
Package trace captures request-lifecycle events (start, end, downstream calls, logs) into an in-memory ring buffer and fans them out to subscribers such as the dashboard. It is the data plane under /__nexus/events.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(bus *Bus, service, endpoint, transport string) gin.HandlerFunc
Middleware emits request.start and request.end events bracketing the handler chain, and stashes a *Span and the bus in gin.Context so Record() can attach downstream events to the same trace.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is a bounded ring buffer + pub/sub. Slow subscribers drop events rather than block producers — the request path must never be held up by a stalled UI.
func BusFromCtx ¶
BusFromCtx returns the Bus from context, if the trace middleware stashed one.
type Event ¶
type Event struct {
ID int64 `json:"id"`
TraceID string `json:"traceId"`
Kind Kind `json:"kind"`
Service string `json:"service,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Transport string `json:"transport,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Status int `json:"status,omitempty"`
DurationMs int64 `json:"durationMs,omitempty"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
Meta map[string]any `json:"meta,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.