Documentation
¶
Index ¶
- Constants
- Variables
- func CreateApp(options Options) gen.ApplicationBehavior
- type Authorizer
- type Ceiling
- type ClusterInfo
- type ClusterLensOptions
- type ClusterNodeInfo
- type EnrollRequest
- type EnrollResponse
- type EnrollmentOptions
- type Identity
- type Listener
- type OfflineNode
- type Options
- type RequestClusterInfo
- type SurfaceAPI
- type SurfaceMCP
- type SurfaceUI
Constants ¶
const ( FeatureUI = "observer.ui" FeatureSSE = "observer.api.sse" FeatureActions = "observer.api.actions" FeatureStatelessActions = "observer.api.stateless_actions" FeatureEnroll = "observer.api.enroll" FeatureClusterLens = "observer.cluster.lens" FeatureMCP = "observer.mcp" )
const ( ErgoOriginSite = "https://ergo.observer" ErgoOrigin = "https://app.ergo.observer" ErgoOriginTenants = "https://*.app.ergo.observer" )
Page origins of the ergo.observer cloud UI, for Listener.AllowedOrigins. The per-tenant wildcard covers one label and not the parent, and is allowed only when it is named.
const CapDialRoute = "manage.dial_route"
const CapForceProducer = "manage.force_producer"
CapForceProducer is asked for on top of the lens capability when a subscription would wake a sleeping producer. Checked against the ceiling, never routed: the manage prefix puts it outside ReadOnly while the request still goes to system_inspect.
const (
DefaultPort uint16 = 9911
)
Variables ¶
var DefaultAllowedOrigins = []string{ "http://localhost:*", "http://127.0.0.1:*", "http://[::1]:*", ErgoOriginSite, ErgoOrigin, }
DefaultAllowedOrigins is added to the AllowedOrigins of every listener. Set it to nil before starting the application to allow nothing but what each listener names.
var Version = gen.Version{ Name: "Observer Application", Release: strings.TrimPrefix(strings.TrimSpace(version), "v"), License: gen.LicenseMIT, }
Functions ¶
func CreateApp ¶
func CreateApp(options Options) gen.ApplicationBehavior
Types ¶
type Authorizer ¶ added in v0.2.0
type Authorizer = access.Authorizer
The vocabulary of authorization lives in the access package so an authorizer can be a module of its own. These are the same types, spelled the short way.
type Ceiling ¶ added in v0.2.0
The vocabulary of authorization lives in the access package so an authorizer can be a module of its own. These are the same types, spelled the short way.
type ClusterInfo ¶ added in v0.2.0
type ClusterInfo struct {
Nodes []ClusterNodeInfo `json:"nodes"`
// Offline are the nodes without data: unreachable, or discovered beyond the watch limit.
Offline []OfflineNode `json:"offline"`
// Complete reports whether the map covers the whole cluster.
Complete bool `json:"complete"`
Note string `json:"note,omitempty"`
// Watched and Limit show how much of the map is actually being observed.
Watched int `json:"watched"`
Limit int `json:"limit"`
// WatchPeriod is how often a watched node is expected to report.
WatchPeriod time.Duration `json:"watch_period"`
}
ClusterInfo is the whole cluster map.
type ClusterLensOptions ¶ added in v0.2.0
type ClusterLensOptions struct {
// WatchLimit is the maximum number of nodes being watched. Nodes discovered
// beyond it stay on the map without data. Default: 5000
WatchLimit int
// Concurrency is the maximum number of nodes being connected at once.
// Default: 64
Concurrency int
// ReconcilePeriod is the interval between the passes that check the membership
// bookkeeping. Nodes are dropped as they run out of support, not on this timer,
// so it is a backstop and wants a large value. Default: 1m
ReconcilePeriod time.Duration
// GracePeriod is how long the last known peer list of an unreachable node
// still counts as evidence that its peers exist. Until it expires a network
// split does not erase the far side of the map. Default: 1m
GracePeriod time.Duration
// WatchPeriod is the interval between the snapshots a watched node publishes.
// Larger clusters want a larger value: every node sends one snapshot per
// period. Default: 3s
WatchPeriod time.Duration
// LastReadingPeriod is how long the last reading of an unreachable node stays
// on the map, marked stale. Default: GracePeriod
LastReadingPeriod time.Duration
}
ClusterLensOptions configures the cluster lens: the map of every discovered node and the watchers keeping it up to date.
type ClusterNodeInfo ¶ added in v0.2.0
type ClusterNodeInfo struct {
Info gen.NodeShortInfo
// Age is how long ago the observer received this reading, in milliseconds.
Age int64
// Status says whether the reading is fresh or the last one before the node went.
Status gen.Atom
// Reason is why the node became unreachable.
Reason string
}
ClusterNodeInfo is one node with a reading, and how old that reading is.
type EnrollRequest ¶ added in v0.2.0
type EnrollRequest struct {
Token string
}
EnrollRequest asks the manager to confirm that this observer holds the enrollment secret. The secret burns on the first success.
type EnrollResponse ¶ added in v0.2.0
EnrollResponse names the cluster on success. Burned says the secret was already spent.
type EnrollmentOptions ¶ added in v0.2.0
type EnrollmentOptions struct {
// Token is the secret. Empty means /api/enroll is not served at all.
Token string
// ClusterID is answered on success, so the caller knows which cluster it reached.
ClusterID string
}
EnrollmentOptions is the one-time secret the cloud presents to confirm that the endpoint it was given is this observer. The secret burns on the first success.
type Identity ¶ added in v0.2.0
The vocabulary of authorization lives in the access package so an authorizer can be a module of its own. These are the same types, spelled the short way.
type Listener ¶ added in v0.2.0
type Listener struct {
// Name goes into the start log and into inspect. Default: ":<port>"
Name string
// Host to bind. Default: "localhost"
Host string
// Port to bind. Required, and unique among the listeners.
Port uint16
// Path is the prefix this listener serves everything under -- the bundle, /sse and /api
// alike -- for a listener behind a proxy that passes the path through. Leading slash, no
// trailing one: "/observability". Empty means the root.
Path string
// CertManager serves this listener over TLS. Nil means plain HTTP.
CertManager gen.CertManager
// UI is the bundle built into the binary, served at /
UI SurfaceUI
// API is /sse and /api/*
API SurfaceAPI
// MCP is /mcp
MCP SurfaceMCP
// Authorizer identifies the caller. Without one the listener is open and everyone
// arriving here gets its Ceiling.
Authorizer Authorizer
// Ceiling narrows the deployment ceiling for everyone arriving here.
Ceiling Ceiling
// RateLimit is how many requests per second one caller may make here, counted by
// subject when there is an authorizer and by address otherwise. Zero means no limit.
// The static bundle is not metered.
RateLimit int
// MaxStreams is how many streams may be open here at once, /sse and /mcp together. Each
// holds a goroutine, an actor and a compressor for its whole life. Zero means the
// default, not "no limit". Default: 64
MaxStreams int
// MaxSubscriptions is how many live subscriptions one stream may hold. It also sizes
// the mailbox of a stream, which holds a few rounds of it. Zero means the default, not
// "no limit". Default: 128
MaxSubscriptions int
// AllowedOrigins lets browsers from these origins call this listener: a bundle served
// elsewhere reaches it only from an origin named here or in DefaultAllowedOrigins, which
// is added to every listener. Each entry is scheme://host[:port] with no path, a port of
// "*" matches any, and "*" alone means any origin without credentials. Anything else is
// refused at start. The page this listener served itself is always allowed.
AllowedOrigins []string
}
Listener is one endpoint of the observer, with its own authorization and ceiling.
type OfflineNode ¶ added in v0.2.0
type OfflineNode struct {
Node gen.Atom `json:"node"`
Status gen.Atom `json:"status"`
Reason string `json:"reason,omitempty"`
Since int64 `json:"since"`
LastSeen int64 `json:"last_seen,omitempty"`
Peers []gen.Atom `json:"peers,omitempty"`
}
OfflineNode is a node on the map that currently has no data.
type Options ¶
type Options struct {
// Host for HTTP listener. Default: "localhost". Refused at start when Listeners is set.
Host string
// Port for HTTP listener. Default: 9911. Refused at start when Listeners is set.
Port uint16
// Path is the prefix everything is served under: the bundle, /sse and /api. Empty
// means the root. Refused at start when Listeners is set.
Path string
// PoolSize is the number of POST request workers. Default: 25
PoolSize int
// Ceiling is the limit of the whole observer: a listener, and then a caller, can only
// be given less. Mutating actions outside it are refused and are not reported to the
// browser as available.
Ceiling Ceiling
// Authorizer identifies the caller on the single listener Host:Port. Without one the
// listener is open and everyone gets the Ceiling. Refused at start when Listeners is set.
Authorizer Authorizer
// RateLimit is how many requests per second one caller may make on the single
// listener. Zero means no limit. Refused at start when Listeners is set.
RateLimit int
// AllowedOrigins lets browsers from these origins call the single listener, on top of
// DefaultAllowedOrigins. Refused at start when Listeners is set.
AllowedOrigins []string
// Listeners runs one endpoint per entry, each with its own authorization and ceiling,
// instead of the single Host:Port one. Host and Port must be left unset.
Listeners []Listener
// Enrollment lets the cloud prove that a named endpoint is this observer. Empty
// disables /api/enroll.
Enrollment EnrollmentOptions
// JobMaxRetention is the longest a finished run may keep its result. A caller asks for
// what it needs and gets no more than this: the result sits in memory until it expires,
// and every read of a finished run pushes the expiry out again. Default: 5m
JobMaxRetention time.Duration
// JobLimit is how many runs the observer may hold at once, over every caller. A run
// holds a pool of workers for its whole life, so this bounds the work one agent can
// leave behind. Zero means the default, not "no limit". Default: 32
JobLimit int
// ClusterLens configures the cluster lens
ClusterLens ClusterLensOptions
// LogLevel for the observer processes
LogLevel gen.LogLevel
}
type RequestClusterInfo ¶ added in v0.2.0
type RequestClusterInfo struct{}
RequestClusterInfo asks for the whole cluster map at once.
type SurfaceAPI ¶ added in v0.2.0
type SurfaceAPI struct {
// Ceiling narrows the listener ceiling for this surface alone. Nil keeps it.
Ceiling *Ceiling
}
SurfaceAPI is /sse and /api/*, what the bundle calls. It has no switch of its own.
type SurfaceMCP ¶ added in v0.2.0
type SurfaceMCP struct {
Disable bool
// Ceiling narrows the listener ceiling for this surface alone. Nil keeps it.
// It separates surfaces, not callers: whoever reaches this listener reaches both,
// so narrow API as well or put the surfaces on listeners of their own.
Ceiling *Ceiling
// Instructions is what an agent is told about the cluster behind this surface
// before it asks anything: which node runs which part of the business, where a
// flow begins, what not to touch. It is added to the guidance every observer
// gives about itself, not put in its place, so navigating the surface stays
// described whatever is written here. Empty leaves that default alone.
Instructions string
// CacheTTL is how long a client may keep what this surface says about itself: the
// tool and resource listings, and the discovery answer. It says nothing about the
// data a tool or a resource returns: a reading is stale in a second either way.
//
// Inside one process none of it changes, so a long value costs nothing in a running
// deployment. It costs during development: a client outlives a restart, and until
// this expires it calls tools with the arguments of the binary it first met. Set it
// to a few seconds where the binary is rebuilt, and leave it alone otherwise.
//
// Zero means the default. Default: 5m
CacheTTL time.Duration
}
A surface is served unless it is disabled. The API surface has no switch of its own: /sse and /api/* are what a listener is for, and the bundle calls them from its own origin. A listener that serves neither the UI nor the API would be an MCP-only one, which becomes possible when the MCP application moves here.
type SurfaceUI ¶ added in v0.2.0
type SurfaceUI struct {
Disable bool
}
A surface is served unless it is disabled. The API surface has no switch of its own: /sse and /api/* are what a listener is for, and the bundle calls them from its own origin. A listener that serves neither the UI nor the API would be an MCP-only one, which becomes possible when the MCP application moves here.
Source Files
¶
- app.go
- capabilities.go
- cluster.go
- cluster_types.go
- cors.go
- guard.go
- helpers.go
- manager.go
- mcp_cluster.go
- mcp_fanout.go
- mcp_gate.go
- mcp_ident.go
- mcp_job.go
- mcp_keys.go
- mcp_listen.go
- mcp_mutate.go
- mcp_owner.go
- mcp_protocol.go
- mcp_render.go
- mcp_schema.go
- mcp_stream.go
- mcp_templates.go
- mcp_tools.go
- mcp_uri.go
- mcp_worker.go
- message.go
- options.go
- post_pool.go
- post_worker.go
- session.go
- session_pool.go
- sup.go
- version.go
- watcher.go
- web.go
- wire.go
- wire_application.go
- wire_cluster.go
- wire_event.go
- wire_log.go
- wire_mcp.go
- wire_mcp_application.go
- wire_mcp_capabilities.go
- wire_mcp_cluster.go
- wire_mcp_connection.go
- wire_mcp_event.go
- wire_mcp_heap.go
- wire_mcp_log.go
- wire_mcp_lookup.go
- wire_mcp_measured.go
- wire_mcp_meta.go
- wire_mcp_network.go
- wire_mcp_node.go
- wire_mcp_process.go
- wire_mcp_processes.go
- wire_mcp_registrar.go
- wire_mcp_state.go
- wire_mcp_tracing.go
- wire_mcp_types.go
- wire_network.go
- wire_node.go
- wire_process.go
- wire_profiler.go
- wire_tracing.go