connstate

package
v1.141.0 Latest Latest
Warning

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

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

Documentation

Overview

Package connstate holds each connection's state as the calls that used it last found it: healthy, unreachable, or auth_failed (#1898). It is fed by the places that see an upstream's answer -- the outbound HTTP chain for the api, graphql and mcp kinds, the Trino and S3 toolkits' telemetry -- and read when mcp_platform_connections is sampled. Nothing here sends a request: a connection nobody has called has no state, and is reported as configured.

The state is per process. Each replica reports the connections it has called, so the gauge is read with max by (kind, state) across replicas.

Index

Constants

View Source
const (
	Healthy     = "healthy"
	Unreachable = "unreachable"
	AuthFailed  = "auth_failed"
)

The states a call can leave a connection in.

Variables

This section is empty.

Functions

func FromHTTP

func FromHTTP(status int, err error) string

FromHTTP is the state an HTTP answer leaves a connection in: 401 and 407 are a refused credential; a transport error, a timeout, or a 502, 503 or 504 is an upstream that could not be reached or could not answer; any other status is an upstream that answered, which is healthy whatever it said about the request itself. A caller that canceled the request says nothing about the upstream, and records nothing.

func FromResultText

func FromResultText(text string, credential ...string) string

FromResultText is the state a failed tool result leaves a connection in when the result is all a caller has: its text names a refused credential (one of credential, the client's own stable error texts or codes), a lost network (Go's net error texts), or an upstream that answered and refused the request, which is healthy.

func Observe

func Observe(kind, connection, s string)

Observe records the state a call found kind's connection in. A call with no connection name (a platform-wide client) and a state that is not one of Healthy, Unreachable and AuthFailed -- "" for an outcome that says nothing about the upstream -- are ignored, so the gauge's state label stays the set this package defines.

func State

func State(kind, connection string) (string, bool)

State returns the state the last call found kind's connection in, and false when no call has used it in this process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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