monitoring

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package monitoring owns process-local, client-facing bridge telemetry. The snapshot wire contract is shared with proxy/internal/monitoring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Establish

func Establish(ctx context.Context, role string)

func Ignore

func Ignore(ctx context.Context)

Ignore removes a forwarding hop without treating it as another attempt.

func Listen

func Listen(ctx context.Context, r *Registry, addr, token string) error

Listen binds synchronously so misconfiguration fails at startup.

func PrivateHandler

func PrivateHandler(r *Registry, token string) http.Handler

PrivateHandler requires a dedicated shared token even when workspace auth is disabled.

func WithSession

func WithSession(ctx context.Context, s *Session) context.Context

Types

type Connection

type Connection struct {
	Metadata
	ID            string     `json:"id"`
	State         string     `json:"state"`
	StartedAt     time.Time  `json:"started_at"`
	ConnectedAt   *time.Time `json:"connected_at,omitempty"`
	LastActivity  *time.Time `json:"last_activity,omitempty"`
	ToWorkspace   uint64     `json:"to_workspace_bytes"`
	ToClient      uint64     `json:"to_client_bytes"`
	MediaObserved bool       `json:"media_observed"`
	GuestAdmitted bool       `json:"guest_admitted"`
}

type Metadata

type Metadata struct {
	WorkspaceUID  string `json:"workspace_uid"`
	Namespace     string `json:"namespace"`
	Name          string `json:"name"`
	WorkspaceType string `json:"workspace_type"`
	Category      string `json:"category"`
	Transport     string `json:"transport"`
	Tier          string `json:"tier,omitempty"`
	Role          string `json:"role,omitempty"`
	User          string `json:"user,omitempty"`
	ByteLayer     string `json:"byte_layer"`
}

type Registry

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

func New

func New(component string) *Registry

func (*Registry) Close

func (r *Registry) Close()

func (*Registry) ServeMetrics

func (r *Registry) ServeMetrics(w http.ResponseWriter, _ *http.Request)

func (*Registry) ServeSnapshot

func (r *Registry) ServeSnapshot(w http.ResponseWriter, _ *http.Request)

func (*Registry) Snapshot

func (r *Registry) Snapshot() Snapshot

func (*Registry) Start

func (r *Registry) Start(m Metadata) *Session

type Session

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

func FromContext

func FromContext(ctx context.Context) *Session

func (*Session) Add

func (s *Session) Add(in bool, n int)

func (*Session) BindClose

func (s *Session) BindClose(close func() error)

func (*Session) End

func (s *Session) End()

func (*Session) Establish

func (s *Session) Establish(role string)

type Snapshot

type Snapshot struct {
	SetupFailures uint64       `json:"setup_failures"`
	Protocol      int          `json:"protocol"`
	Component     string       `json:"component"`
	Owner         string       `json:"owner"`
	BootID        string       `json:"boot_id"`
	ObservedAt    time.Time    `json:"observed_at"`
	Connections   []Connection `json:"connections"`
	Traffic       []Traffic    `json:"traffic"`
}

type Traffic

type Traffic struct {
	Metadata
	ToWorkspace uint64 `json:"to_workspace_bytes"`
	ToClient    uint64 `json:"to_client_bytes"`
}

type Writer

type Writer struct {
	http.ResponseWriter
	Session     *Session
	AutoUpgrade bool
	// contains filtered or unexported fields
}

Writer preserves upgrades and streaming. Hijacked traffic is WebSocket stream bytes (including framing/control frames), not TCP packets or media payload.

func (*Writer) Flush

func (w *Writer) Flush()

func (*Writer) Hijack

func (w *Writer) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*Writer) Unwrap

func (w *Writer) Unwrap() http.ResponseWriter

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(status int)

Jump to

Keyboard shortcuts

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