Documentation
¶
Overview ¶
Package monitoring contains backend reachability and protocol health-check logic.
Index ¶
- func ResolveServiceName(tracingServiceName string, instanceName string, fallbackName string) string
- type AuthCapabilities
- func NewAuthCapabilities(source string) AuthCapabilities
- func ParseIMAPAuthCapabilities(lines []string) AuthCapabilities
- func ParsePOP3AuthCapabilities(lines []string) AuthCapabilities
- func ParseSMTPAuthCapabilities(lines []string) AuthCapabilities
- func ParseSieveAuthCapabilities(lines []string) AuthCapabilities
- type AuthMechanismUnavailableError
- type AuthSelection
- type AuthSelector
- type BackendCheckPhase
- type ConnMonitor
- type HealthAuthMechanism
- type Monitor
- type Telemetry
- type TelemetryConfigProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveServiceName ¶
ResolveServiceName determines the OpenTelemetry service name.
Priority:
- explicit tracing service name (if set and not an IP)
- configured instance name (if set and not an IP)
- hostname (if available and not an IP)
- fallbackName
Types ¶
type AuthCapabilities ¶
type AuthCapabilities struct {
Mechanisms map[HealthAuthMechanism]struct{}
InitialResponses map[HealthAuthMechanism]struct{}
NativeMechanisms map[HealthAuthMechanism]struct{}
Raw []string
Source string
SASLIR bool
SupportsCapabilities bool
SupportsMechanisms bool
}
AuthCapabilities is the protocol-neutral capability model consumed by AuthSelector.
func NewAuthCapabilities ¶
func NewAuthCapabilities(source string) AuthCapabilities
NewAuthCapabilities creates an empty capability set for one protocol adapter.
func ParseIMAPAuthCapabilities ¶
func ParseIMAPAuthCapabilities(lines []string) AuthCapabilities
ParseIMAPAuthCapabilities normalizes IMAP CAPABILITY authentication tokens.
func ParsePOP3AuthCapabilities ¶
func ParsePOP3AuthCapabilities(lines []string) AuthCapabilities
ParsePOP3AuthCapabilities normalizes POP3 CAPA authentication tokens.
func ParseSMTPAuthCapabilities ¶
func ParseSMTPAuthCapabilities(lines []string) AuthCapabilities
ParseSMTPAuthCapabilities normalizes SMTP and LMTP AUTH capability forms.
func ParseSieveAuthCapabilities ¶
func ParseSieveAuthCapabilities(lines []string) AuthCapabilities
ParseSieveAuthCapabilities normalizes ManageSieve greeting and CAPABILITY auth tokens.
func (*AuthCapabilities) AddMechanism ¶
func (c *AuthCapabilities) AddMechanism(mechanism HealthAuthMechanism, initialResponse bool, native bool)
AddMechanism records one executable mechanism and its protocol-specific execution traits.
func (*AuthCapabilities) HasMechanism ¶
func (c *AuthCapabilities) HasMechanism(mechanism HealthAuthMechanism) bool
HasMechanism reports whether the adapter advertised one executable mechanism.
type AuthMechanismUnavailableError ¶
type AuthMechanismUnavailableError struct {
}
AuthMechanismUnavailableError reports that the selected target mechanism cannot be used.
func (*AuthMechanismUnavailableError) Error ¶
func (e *AuthMechanismUnavailableError) Error() string
Error formats the mechanism mismatch for callers while leaving sensitive payloads out.
type AuthSelection ¶
type AuthSelection struct {
Mechanism HealthAuthMechanism
InitialResponse bool
Native bool
}
AuthSelection is the selector result executed by a protocol session.
type AuthSelector ¶
type AuthSelector struct {
// contains filtered or unexported fields
}
AuthSelector applies target configuration to protocol-neutral auth capabilities.
func NewAuthSelector ¶
func NewAuthSelector(logger *slog.Logger, server *config.BackendServer, phase BackendCheckPhase) *AuthSelector
NewAuthSelector returns a selector for one backend target and health-check phase.
func (*AuthSelector) Select ¶
func (s *AuthSelector) Select(capabilities AuthCapabilities) (AuthSelection, error)
Select validates the configured mechanism and returns the concrete exchange form to execute.
type BackendCheckPhase ¶
type BackendCheckPhase string
BackendCheckPhase identifies which part of a backend health check is being executed.
const ( // BackendCheckPhaseConnect verifies TCP, HAProxy-v2 preface, and TLS reachability only. BackendCheckPhaseConnect BackendCheckPhase = "connect" // BackendCheckPhaseDeep verifies the protocol-level deep check when enabled for a target. BackendCheckPhaseDeep BackendCheckPhase = "deep" )
type ConnMonitor ¶
type ConnMonitor struct {
// contains filtered or unexported fields
}
ConnMonitor is a struct that implements monitoring of backend server connections by checking their availability.
func (*ConnMonitor) CheckBackendConnection ¶
func (cm *ConnMonitor) CheckBackendConnection(server *config.BackendServer) error
CheckBackendConnection attempts to establish a connection to a backend server to verify its availability. It returns an error if the connection cannot be established, using the specified configuration parameters.
func (*ConnMonitor) CheckBackendConnectionPhase ¶
func (cm *ConnMonitor) CheckBackendConnectionPhase(server *config.BackendServer, phase BackendCheckPhase) error
CheckBackendConnectionPhase checks one backend health-check phase.
type HealthAuthMechanism ¶
type HealthAuthMechanism string
HealthAuthMechanism identifies one authentication mechanism executable by backend health checks.
const ( // HealthAuthMechanismAuto requests automatic health-check mechanism selection. HealthAuthMechanismAuto HealthAuthMechanism = config.BackendAuthMechanismAuto // HealthAuthMechanismPlain selects SASL PLAIN. HealthAuthMechanismPlain HealthAuthMechanism = config.BackendAuthMechanismPlain // HealthAuthMechanismLogin selects SASL LOGIN. HealthAuthMechanismLogin HealthAuthMechanism = config.BackendAuthMechanismLogin // HealthAuthMechanismUserPass selects POP3 USER/PASS. HealthAuthMechanismUserPass HealthAuthMechanism = config.BackendAuthMechanismUserPass // HealthAuthMechanismBasic selects HTTP Basic authentication. HealthAuthMechanismBasic HealthAuthMechanism = config.BackendAuthMechanismBasic )
type Monitor ¶
type Monitor interface {
// CheckBackendConnection checks the backend connection of a server based on the provided Host address, port number, whether the server runs with HAProxy V2 protocol, and whether TLS should be used. It returns an error if the connection fails.
CheckBackendConnection(server *config.BackendServer) error
// CheckBackendConnectionPhase checks one backend health-check phase.
CheckBackendConnectionPhase(server *config.BackendServer, phase BackendCheckPhase) error
}
Monitor defines an interface for monitoring and checking backend server connections. It provides a method to verify connectivity using specified configurations.
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
Telemetry provides lifecycle management for OpenTelemetry tracing.
func (*Telemetry) SetProvider ¶
func (t *Telemetry) SetProvider(p TelemetryConfigProvider)
SetProvider allows injecting a custom configuration provider (primarily for tests). In production the default provider is used, which reads from the global config.
type TelemetryConfigProvider ¶
TelemetryConfigProvider abstracts access to configuration used by telemetry. This allows unit tests to inject a lightweight mock without depending on the full global config.File implementation.