observe

package
v0.0.0-...-53bd38a Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigProvider

type ConfigProvider func() *config.Config

ConfigProvider returns the currently-active *config.Config per /config request. Used so the endpoint reflects a hot-reload swap performed by core/reloader; for setups without hot-reload the host just wraps a captured pointer (`func() *Config { return cfg }`).

type Option

type Option func(*statServerOpts)

Option configures a StatServer at construction time.

func WithExtraStats

func WithExtraStats(name string, fn func() map[string]uint64) Option

WithExtraStats adds one top-level key name to the /stats document, with fn's map as its value, read per request. Without it the document is the merged plugin stats alone.

func WithLoopbackOnly

func WithLoopbackOnly(enabled bool) Option

WithLoopbackOnly answers 403 on every route to a non-loopback Host or a request carrying Origin (httpx.LoopbackOnly). /config can hold a secret under a key name redact does not know, so a page doing DNS rebinding must not read it. The host enables it where the stats port is loopback-only (listener.bind_loopback_only).

func WithPprof

func WithPprof(enabled bool) Option

WithPprof mounts Go's net/http/pprof handlers under /debug/pprof/. Off unless asked for: the profiles expose the process's internals — allocation stack traces, argv (cmdline), and a caller's ability to start CPU profiling and tracing — so the host enables it only where the stats port is loopback-only (cmd/cortex reads listener.bind_loopback_only, the same gate as the session API's clear). The handlers also refuse a non-loopback Host and any request carrying Origin, the erase guards' browser defenses — pprofx.RegisterPprof's, the one guarded pprof surface shared with the agentop viewer.

Side effect of the import: net/http/pprof's init registers /debug/pprof/* on http.DefaultServeMux in every binary linking pprofx. Nothing in this tree serves that mux — an http.Server built with a nil Handler would, and would expose these ungated, so none may be.

func WithPricingTable

func WithPricingTable(h http.Handler) Option

WithPricingTable registers a /pricing/table handler (typically the Handler returned by a core/cost/pricing.Registry). Omit when pricing isn't wired up.

It answers what a config file cannot: the rates in effect come from the operator's `pricing:` section PLUS a table compiled into the binary PLUS any shipped gateway discount, so reading the config describes only the part the operator wrote.

func WithReloadStatus

func WithReloadStatus(h http.Handler) Option

WithReloadStatus registers a /reload/status handler (typically the Handler returned by a core/reloader.Reloader). Omit when hot- reload isn't wired up — the endpoint simply won't exist.

func WithTLSBridgeUnread

func WithTLSBridgeUnread(h http.Handler) Option

WithTLSBridgeUnread registers a /tls-bridge/unread handler (tlsbridge.Engine's UnreadHandler): which client programs the TLS bridge is passing through unread, and why. Omit when no bridge runs.

type StatServer

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

func NewStatServer

func NewStatServer(addr string, configProvider ConfigProvider, statsProvider StatsProvider, opts ...Option) *StatServer

NewStatServer builds the stat HTTP server. configProvider is invoked per /config request and statsProvider per /stats request, so both reflect current state rather than a snapshot captured at construction.

func (*StatServer) Close

func (s *StatServer) Close() error

Close stops the server at once: the listener closes and any request in flight is dropped. For a stop that frees the port immediately; Shutdown is the draining one.

func (*StatServer) Serve

func (s *StatServer) Serve(l net.Listener) error

Serve serves on an already-bound listener, letting the caller bind first (and handle a bind error synchronously) before the server starts accepting.

func (*StatServer) Shutdown

func (s *StatServer) Shutdown(ctx context.Context) error

type StatsProvider

type StatsProvider func() *auth.Stats

StatsProvider returns a fresh *auth.Stats per /stats request. The host typically implements this by calling auth.MergeStats over the per-plugin stats collected from each pipeline — see plugins.CollectStats. Called per HTTP request, so implementations should be cheap (a few map copies).

Directories

Path Synopsis
Package claude owns the Claude Code session-metadata contract: the shape agentop's harvester writes to ~/.cortex/session-metadata.json, the path it lives at, and the harvest that produces it.
Package claude owns the Claude Code session-metadata contract: the shape agentop's harvester writes to ~/.cortex/session-metadata.json, the path it lives at, and the harvest that produces it.

Jump to

Keyboard shortcuts

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