ws

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      string `json:"type"`
	Timestamp int64  `json:"timestamp_ns"`
	Payload   any    `json:"payload"`
}

Event is the outer discriminated union sent over the WebSocket.

func NewForwarderEvent

func NewForwarderEvent(p *ForwarderPayload) *Event

func NewHeartbeatEvent added in v0.2.0

func NewHeartbeatEvent() *Event

NewHeartbeatEvent is a payload-less liveness beat the server sends on a timer. Clients use its arrival (and the silence when it stops) to track connectivity.

func NewIssueEvent

func NewIssueEvent(p *IssuePayload) *Event

func NewLogEvent

func NewLogEvent(p *LogPayload) *Event

func NewMetricEvent

func NewMetricEvent(p *MetricPayload) *Event

func NewSpanEvent

func NewSpanEvent(p *SpanPayload) *Event

func NewThroughputEvent

func NewThroughputEvent(p *ThroughputPayload) *Event

type ForwarderPayload

type ForwarderPayload struct {
	URL          string `json:"url"`
	Sent         int64  `json:"sent"`
	Errors       int64  `json:"errors"`
	LastErr      string `json:"lastError,omitempty"`
	PendingBytes int64  `json:"pendingBytes,omitempty"`
	DroppedSpool int64  `json:"droppedSpool,omitempty"`
}

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) Broadcast

func (h *Hub) Broadcast(ev *Event)

func (*Hub) ServeWS

func (h *Hub) ServeWS(w http.ResponseWriter, r *http.Request)

type IssuePayload

type IssuePayload struct {
	TraceID     string `json:"traceId"`
	Kind        string `json:"kind"`
	Fingerprint string `json:"fingerprint"`
	Count       int    `json:"count"`
	WastedNs    int64  `json:"wastedNs"`
}

type LogPayload

type LogPayload struct {
	TraceID     string `json:"traceId"`
	SpanID      string `json:"spanId"`
	Severity    int    `json:"severity"`
	Body        string `json:"body"`
	ServiceName string `json:"serviceName"`
	SessionID   string `json:"sessionId"`
}

type MetricPayload

type MetricPayload struct {
	Name        string  `json:"name"`
	ServiceName string  `json:"serviceName"`
	Value       float64 `json:"value"`
	Type        string  `json:"type"`
}

type SpanEvent

type SpanEvent = SpanPayload

SpanEvent is kept as a backward-compat alias for SpanPayload.

type SpanPayload

type SpanPayload struct {
	TraceID     string `json:"traceId"`
	SpanID      string `json:"spanId"`
	ServiceName string `json:"serviceName"`
	Name        string `json:"name"`
	DurationNs  int64  `json:"durationNs"`
	StatusCode  int    `json:"statusCode"`
}

type ThroughputPayload

type ThroughputPayload struct {
	SpansPerSec float64 `json:"spansPerSec"`
	LogsPerSec  float64 `json:"logsPerSec"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL