Help us shape the future of Go! Take the 2026 Go Developer Survey

traceserve

package
v0.1.60 Latest Latest
Warning

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

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

Documentation

Overview

Package traceserve serves a trace results store through query: the traces/<kind> result profiles, the sessions API over its captures (their exports and checkpoints) and the query app, as one handler a host mounts under a path of its own. gavel mounts it over a run's store; `query serve` opens its own store through the same Open.

Index

Constants

View Source
const (
	// Prefix names a store's result profiles, traces/<kind>, and its index
	// connection, connection://traces/traces.
	Prefix = "traces"
	// ProfilePrefix is the name of a kind's result profile less the kind.
	ProfilePrefix = tracing.ProfilePrefix
	// APIPrefix is where Handler serves the profile and sessions APIs, under
	// the path the host mounts it at.
	APIPrefix = "/api/v1"
)

Variables

This section is empty.

Functions

func Handler

func Handler(options Options) (http.Handler, error)

Handler serves options.Runtime's store, rooted at the path the host mounts it at (strip that prefix before it):

GET  /api/openapi.json                       the result profiles and session routes
GET  /api/v1/profile/traces%2F{kind}         a window of a stream (?stream, ?afterSeq, ?toSeq)
GET  /api/v1/traces/{kind}/export            a window downloaded (?stream, ?afterSeq, ?toSeq, ?format)
POST /api/v1/sessions/{id}/checkpoint        a running capture's reading, committed
     /api/v1/sessions...                     the sessions API over the captures
GET  /traces/{kind}                          the app's page for a window (?stream, ?afterSeq, ?toSeq)
GET  /...                                    the query app

func Open

func Open(options OpenOptions) (*tracing.Runtime, func() error, error)

Open opens the trace results store in options.Dir and returns the runtime that serves it and starts captures into it, with a session registry of its own a host may replace, and the close that stops using the store.

func ReadOnly

func ReadOnly(_ *http.Request, profile string, action sessions.Action) error

ReadOnly is an Authorize that serves a store's captures without letting a caller start, stop, extend or restart one; it may read them and have a running one checkpoint.

Types

type OpenOptions

type OpenOptions struct {
	// Dir is the store's directory; Open creates it when it does not exist.
	Dir string
	// Kinds declares the result types the store's streams hold.
	Kinds *tracing.Kinds
	// Retention is how long a stream is kept; an expired one is swept away.
	Retention time.Duration
}

OpenOptions say which store Open opens and what it serves.

type Options

type Options struct {
	// Runtime is the open store served, and the captures running into it.
	Runtime *tracing.Runtime
	// Authorize decides what a caller may do with a capture; ReadOnly serves
	// the store without letting a caller start or stop one. Nil allows all.
	Authorize sessions.AuthorizeFunc
}

Options configure Handler.

Jump to

Keyboard shortcuts

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