monitor

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package monitor provides a real-time web dashboard for a DDS participant. It embeds a single-page HTML UI (Server-Sent Events) and exposes an HTTP server that streams DDS samples and participant metrics to any browser.

Usage:

p, _ := rtps.New(dds.Domain(0))
mon, _ := monitor.New(p, monitor.Options{Addr: ":8080"})
defer mon.Close()
// browse http://localhost:8080

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

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

Monitor wraps a dds.Participant and serves a real-time web dashboard.

func New

func New(p dds.Participant, opts Options) (*Monitor, error)

New creates a Monitor wrapping p and starts the HTTP server. The caller must call Close() to release the HTTP listener.

func (*Monitor) Addr

func (m *Monitor) Addr() string

Addr returns the address the HTTP server is listening on (useful when Addr was ":0" to let the OS pick a port).

func (*Monitor) Close

func (m *Monitor) Close() error

Close stops the HTTP server and all background goroutines.

func (*Monitor) Publish

func (m *Monitor) Publish(s dds.Sample)

Publish emits a sample event to all connected browser clients. Call this whenever a sample is written or received that should appear in the dashboard.

type Options

type Options struct {
	// Addr is the TCP listen address. Default: ":8080".
	Addr string
	// MetricsInterval controls how often metrics snapshots are pushed to the
	// browser. Default: 2s.
	MetricsInterval time.Duration
}

Options configures the monitor HTTP server.

Jump to

Keyboard shortcuts

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