traceui

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package traceui serves a read-only HTTP projection of a trace store: the appended records as JSON, and - when an effect bus is attached - a live server-sent-events stream of the same events the Supervisor observes.

It is the server half of the trace visualizer. The client half is a separate repository and consumes this contract:

GET /api/health
    {"status":"ok","bus":true,"facts":42}

GET /api/records?path=<ownerPathPrefix>&through=<ordinal>&mode=<both|captures|declarations>
    Returns the records under an owner path subtree: the path itself
    and its ":"-delimited descendants; an empty path spans every
    owner. A record retained on several owner paths appears once per
    path, with each path's own owner, ordinal, and kind label. through
    is an inclusive per-owner ordinal cutoff (absent means no cutoff);
    mode defaults to both. Records carry id, digest, schema, mode,
    kind, owner, ordinal, context ref, witness ref, causal parents,
    and - under the trusted read this service uses - the retained
    payload. causal_edges carries the slice's graph. Arrays are never
    null: caused_by is [] for a root record, and the top-level arrays
    are [] when empty.

GET /api/events
    Server-sent events, one "event: effect" per appended record while
    the stream is open. Requires a bus (embedded mode); a standalone
    viewer without a bus answers 503 and the client should poll
    /api/records instead. Events carry the persisted record metadata:
    kind_label is the label the store retained, and causal_parents is
    [] for a root effect. The bus is non-blocking: a stalled client
    drops events and repairs by re-reading /api/records, whose
    content-addressed ids make the merge trivial.

Cross-origin browser clients: OPTIONS preflight requests are answered with the access-control headers, and responses carry Vary: Origin when origins are configured (see Config.AllowedOrigins).

Reads use the trusted internal context, so the payload visibility here is full: mount this behind whatever boundary your payloads deserve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Store is the trace store to project. Required.
	Store *trace.SQLiteTraceStore

	// Bus, when set, enables the live /api/events stream. It must be the
	// same bus the store publishes through (Store.WithBus), which happens
	// naturally in embedded mode: construct the store, attach the bus, and
	// hand both to the service.
	Bus *trace.EffectBus

	// AllowedOrigins restricts cross-origin use (the client may live in
	// another repo and serve from another port in development). nil allows
	// every origin, which is the dev-tool default; the endpoints are
	// unauthenticated reads, so a restrictive list adds no protection -
	// restrict with a reverse proxy if the port is reachable.
	AllowedOrigins []string
}

Config builds a Service.

type Service

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

Service is the read-only HTTP projection of a trace store.

func New

func New(cfg Config) (*Service, error)

New validates the configuration and returns the service.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler returns the service's routes.

Jump to

Keyboard shortcuts

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