Documentation
¶
Index ¶
- func RedactSecret(value string) string
- type Event
- type Level
- type Logger
- func (l *Logger) Error(event, message string, fields map[string]any)
- func (l *Logger) Info(event, message string, fields map[string]any)
- func (l *Logger) IsJSON() bool
- func (l *Logger) Log(level Level, event, message string, fields map[string]any)
- func (l *Logger) Warn(event, message string, fields map[string]any)
- type Metrics
- func (m *Metrics) Handler() http.Handler
- func (m *Metrics) ObserveDispatchLatency(command string, duration time.Duration)
- func (m *Metrics) ObserveExecutionTerminal(resourceClass, phase string, duration time.Duration)
- func (m *Metrics) ObserveInboundEnvelope(bytes int)
- func (m *Metrics) ObserveLeaseEviction()
- func (m *Metrics) ObserveOffer(resourceClass string)
- func (m *Metrics) ObserveOutboundEnvelope(bytes int)
- func (m *Metrics) ObserveRejection(reason string)
- func (m *Metrics) ObserveRequest(resourceClass string)
- func (m *Metrics) Registry() *prometheus.Registry
- func (m *Metrics) SetActiveExecutions(class string, count int)
- func (m *Metrics) UpdateCapacity(class string, total, available uint32)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedactSecret ¶
RedactSecret sanitizes strings containing potential tokens or sensitive key material.
Types ¶
type Event ¶
type Event struct {
Timestamp string `json:"time"`
Level Level `json:"level"`
Event string `json:"event"`
Message string `json:"message,omitempty"`
Fields map[string]any `json:"fields,omitempty"`
}
Event is a structured log entry emitted by r1s daemon or client. Secret fields (keys, tokens, identities) are strictly redacted before emission.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger formats and outputs structured events in JSON or logfmt-style lines.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics manages the Prometheus registry and metric collectors for an r1s allocator. Label values are strictly bounded to prevent cardinality explosion:
- resource_class: operator-configured resource classes (e.g. "default", "gpu") plus the allocator's fixed "__unconfigured__" fallback
- phase: protocol execution phases (e.g. "running", "completed", "failed")
- reason: categorical rejection/error codes (e.g. "CAPACITY", "INCOMPATIBLE", "ADMISSION", "UNAUTHORIZED", "NOT_FOUND", "EXPIRED", "CONFLICT")
Dynamic runtime IDs, message IDs, hashes, join tokens, and container output are NEVER used as labels.
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics constructs and registers allocator metrics on a dedicated Prometheus registry.
func (*Metrics) Handler ¶
Handler returns an http.Handler that serves the registered metrics in Prometheus exposition format.
func (*Metrics) ObserveDispatchLatency ¶
ObserveDispatchLatency records the duration of command dispatch handling.
func (*Metrics) ObserveExecutionTerminal ¶
ObserveExecutionTerminal records an execution transitioning to a terminal phase.
func (*Metrics) ObserveInboundEnvelope ¶
ObserveInboundEnvelope records an inbound RNS envelope and payload size.
func (*Metrics) ObserveLeaseEviction ¶
func (m *Metrics) ObserveLeaseEviction()
ObserveLeaseEviction records an execution evicted due to lease expiry.
func (*Metrics) ObserveOffer ¶
ObserveOffer records an issued offer for a resource class.
func (*Metrics) ObserveOutboundEnvelope ¶
ObserveOutboundEnvelope records an outbound RNS envelope and payload size.
func (*Metrics) ObserveRejection ¶
ObserveRejection records a command rejection categorized by reason code.
func (*Metrics) ObserveRequest ¶
ObserveRequest records an incoming execution request for a resource class.
func (*Metrics) Registry ¶
func (m *Metrics) Registry() *prometheus.Registry
Registry returns the underlying prometheus Registry.
func (*Metrics) SetActiveExecutions ¶
SetActiveExecutions updates the current number of non-terminal executions for a class.
func (*Metrics) UpdateCapacity ¶
UpdateCapacity gauges sets the configured total and available slots per class.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves Prometheus metrics over HTTP. Failure or disconnection of this server never impacts allocator operation or workload execution.
func StartServer ¶
StartServer starts an HTTP metrics exporter on address listening at /metrics. An empty address disables the metrics server and returns nil.