dashboard

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dashboard provides a live HTTP dashboard that streams Pulse metrics to a browser in real time using Server-Sent Events (SSE).

Usage:

srv := dashboard.New()
go srv.ListenAndServe(ctx, ":9090")

// Wire into pulse.Config:
cfg.OnSnapshot = func(s pulse.Snapshot) { srv.Push(s) }
cfg.OnResult   = func(r pulse.Result, passed bool) { srv.Complete(r, passed) }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a lightweight HTTP server that serves a live metrics dashboard. Metrics are pushed to all connected browsers via SSE. It is safe to call Push and Complete from multiple goroutines.

func New

func New() *Server

New creates a new dashboard Server.

func (*Server) Complete

func (s *Server) Complete(result any, passed bool)

Complete sends the final result to all SSE clients and closes the stream.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context, addr string) error

ListenAndServe starts the HTTP server on addr and blocks until ctx is cancelled or an unrecoverable error occurs. The error returned is non-nil only if the server fails to bind or start; context cancellation is not treated as an error.

func (*Server) Push

func (s *Server) Push(snap any)

Push broadcasts a snapshot to all connected SSE clients. It must not block; clients that cannot receive within 100ms are skipped.

Jump to

Keyboard shortcuts

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