Documentation
¶
Overview ¶
Package clientkit defines the protocol-neutral contracts shared by production-oriented outbound clients.
The package provides stable client identity, including a bounded protocol category, readiness policy, cached health, failure classification, backend-neutral observation, and registry integration. Protocol packages such as httpclient and tcpclient build on these contracts to perform network operations.
Registry status and readiness evaluation are passive: they read cached health and never contact dependencies. Registry.CheckAll is the explicit boundary for active health checks. Registration captures names, protocol categories, readiness policies, and health-check enablement once so later operation and inspection do not depend on mutable implementations.
A nil Observer passed directly to New becomes a no-op observer. Protocol constructors may install their documented default observer before creating the shared Client. Applications can replace or compose observers without changing protocol execution.
Index ¶
- Constants
- func ValidateClientName(name string) error
- func ValidateClientProtocol(protocol string) error
- type AttemptEvent
- type Client
- type ClientSnapshot
- type Config
- type FailureClass
- type Health
- type HealthAssessment
- type HealthCheckConfigurable
- type HealthChecker
- type HealthEvent
- type HealthSanitizer
- type HealthState
- type IdleConnectionCloser
- type NopObserver
- func (NopObserver) ObserveAttempt(context.Context, AttemptEvent)
- func (NopObserver) ObserveHealth(context.Context, HealthEvent)
- func (NopObserver) ObserveRetry(context.Context, RetryEvent)
- func (NopObserver) StartOperation(ctx context.Context, _ OperationStartEvent) (context.Context, OperationObservation)
- type NopOperationObservation
- type Observer
- type OperationEndEvent
- type OperationKind
- type OperationObservation
- type OperationObservationFunc
- type OperationStartEvent
- type ReadinessPolicy
- type RegisteredClient
- type Registry
- func (r *Registry) CheckAll(ctx context.Context) opskit.CheckSummary
- func (r *Registry) CloseIdleConnections()
- func (r *Registry) ComponentInfo() opskit.ComponentInfo
- func (r *Registry) Get(name string) (RegisteredClient, bool)
- func (r *Registry) Inspect(ctx context.Context) (opskit.Inspection, error)
- func (r *Registry) MustRegister(client RegisteredClient)
- func (r *Registry) MustRegisterAll(clients ...RegisteredClient)
- func (r *Registry) Readiness(context.Context) opskit.Readiness
- func (r *Registry) Register(client RegisteredClient) error
- func (r *Registry) RegisterAll(clients ...RegisteredClient) error
- func (r *Registry) Snapshot() RegistrySnapshot
- func (r *Registry) Status(context.Context) opskit.Status
- type RegistryConfig
- type RegistrySnapshot
- type RetryEvent
Constants ¶
const ( // DefaultMaxConcurrentChecks is the production concurrency bound used by // Registry.CheckAll. DefaultMaxConcurrentChecks = 4 )
const DefaultMaxHealthMessageBytes = 256
DefaultMaxHealthMessageBytes is the byte limit applied to health text by DefaultHealthSanitizer.
const MaxClientNameBytes = 64
MaxClientNameBytes is the maximum byte length accepted by ValidateClientName.
const MaxClientProtocolBytes = 32
MaxClientProtocolBytes is the maximum byte length accepted by ValidateClientProtocol.
Variables ¶
This section is empty.
Functions ¶
func ValidateClientName ¶
ValidateClientName verifies a stable, path-safe, telemetry-safe logical client identifier. Names must contain 1 through MaxClientNameBytes lowercase ASCII letters, digits, periods, underscores, or hyphens; must begin and end with a letter or digit; and must not contain consecutive periods.
func ValidateClientProtocol ¶
ValidateClientProtocol verifies a stable, low-cardinality, telemetry-safe client-family category. Protocols must contain 1 through MaxClientProtocolBytes lowercase ASCII letters, digits, periods, underscores, or hyphens; must begin and end with a letter or digit; and must not contain consecutive periods.
A protocol identifies the concrete client family, such as "http" or "tcp". It must not contain an endpoint, URL, address, connection string, tenant, or other sensitive or high-cardinality configuration.
Types ¶
type AttemptEvent ¶
type AttemptEvent struct {
// Client is the stable configured client name.
Client string
// Protocol identifies the client protocol.
Protocol string
// Operation identifies the bounded operation type.
Operation string
// Number is the one-based attempt number.
Number int
// StartedAt is the UTC attempt start time.
StartedAt time.Time
// EndedAt is the UTC attempt completion time.
EndedAt time.Time
// Duration is the attempt duration.
Duration time.Duration
// Outcome is the protocol implementation's bounded attempt outcome.
Outcome string
// Succeeded is the protocol implementation's authoritative decision that the
// attempt met its configured acceptance criteria. A true value requires a nil
// Err and FailureNone; adapters treat contradictory events as failures.
Succeeded bool
// FailureClass is the protocol implementation's stable classified failure.
// It supplements Outcome and Err and is empty on success.
FailureClass FailureClass
// Err is the original attempt error and must not be used as a metric label.
Err error
// Attributes contains bounded, production-safe attempt details.
Attributes []opskit.Attribute
}
AttemptEvent describes one actual protocol execution attempt. Err may be recorded by error-aware telemetry but must never be used directly as a metric label.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client stores immutable shared client policy and concurrency-safe cached health. It must be constructed with New. Protocol implementations may compose it to implement RegisteredClient and manage health-recording lifecycle. It is protocol-neutral and therefore is not itself a complete RegisteredClient.
func New ¶
New validates and constructs a protocol-neutral Client without performing network I/O. Protocol users will normally call a protocol package's New function instead.
func (*Client) Health ¶
Health returns the most recently cached health value without performing I/O.
func (*Client) ReadinessPolicy ¶
func (c *Client) ReadinessPolicy() ReadinessPolicy
ReadinessPolicy returns the immutable normalized readiness policy.
func (*Client) UpdateHealth ¶
UpdateHealth applies the configured sanitization policy, caches the resulting health, and returns the cached value. Callers emitting health through telemetry should use the returned value.
type ClientSnapshot ¶
type ClientSnapshot struct {
// Name is the client's stable registered identity.
Name string `json:"name"`
// Protocol is the client-family category captured during registration.
Protocol string `json:"protocol"`
// ReadinessPolicy is the policy captured during registration.
ReadinessPolicy ReadinessPolicy `json:"readiness_policy"`
// Health is the producer's effective health at snapshot time. Registry
// snapshots may project a newer Registry-synthesized check failure over the
// client-owned cache.
Health Health `json:"health"`
}
ClientSnapshot is one immutable registry-facing view of a client's identity, readiness policy, and effective cached health.
type Config ¶
type Config struct {
// Name is the stable, telemetry-safe logical name of the outbound client.
Name string
// ReadinessPolicy controls how the client contributes to aggregate
// readiness. Its zero value is ReadinessOptional.
ReadinessPolicy ReadinessPolicy
// Observer completely replaces any protocol-client default observer when it
// is non-nil. A nil observer lets built-in protocol clients install their
// default OpenTelemetry observer; clientkit.New itself uses a no-op observer.
// Use NopObserver to disable observation or MultiObserver to compose observers
// explicitly.
Observer Observer
// HealthSanitizer completely replaces DefaultHealthSanitizer for cached
// health and health telemetry emitted by built-in protocol clients.
HealthSanitizer HealthSanitizer
// DisableHealthSanitizer disables client-level health sanitization. It cannot
// be combined with HealthSanitizer. The caller then owns validation,
// cardinality, redaction, and message-size safety.
DisableHealthSanitizer bool
}
Config defines the protocol-neutral identity, readiness, observation, and health-sanitization policy included by Clientkit protocol configurations.
type FailureClass ¶
type FailureClass string
FailureClass is a stable, low-cardinality classification that supplements protocol outcomes and original errors. Consumers may use it for metrics, policy decisions, inspection, and alert grouping. Platform error wrapping can prevent some failures from receiving their most specific class; FailureTransport is the safe fallback. Raw errors must never be used as telemetry labels.
const ( // FailureNone indicates that no classified failure occurred. It is the empty // string so successful and unclassified zero values require no special setup. FailureNone FailureClass = "" // FailureConfiguration indicates missing or unusable client configuration. FailureConfiguration FailureClass = "configuration" // FailurePolicy indicates rejection by a Clientkit execution policy. FailurePolicy FailureClass = "policy" // FailureRequest indicates invalid request or operation preparation. FailureRequest FailureClass = "request" // FailureCanceled indicates caller or parent-context cancellation. FailureCanceled FailureClass = "canceled" // FailureTimeout indicates deadline expiry or another recognized timeout. FailureTimeout FailureClass = "timeout" // FailureNameResolution indicates a DNS or name-resolution failure. FailureNameResolution FailureClass = "name_resolution" // FailureConnectionRefused indicates that the destination refused a connection. FailureConnectionRefused FailureClass = "connection_refused" // FailureConnectionReset indicates that a connection was reset. FailureConnectionReset FailureClass = "connection_reset" // FailureConnectionClosed indicates a recognized closed-connection condition. FailureConnectionClosed FailureClass = "connection_closed" // FailureTLS indicates a non-timeout TLS or certificate failure. FailureTLS FailureClass = "tls" // FailureRemoteResponse indicates an unacceptable completed remote response. FailureRemoteResponse FailureClass = "remote_response" // FailureTransport indicates another network or transport failure. FailureTransport FailureClass = "transport" )
type Health ¶
type Health struct {
// State is the bounded health decision.
State HealthState `json:"state"`
// FailureClass is the stable classified cause of a non-healthy result. It
// supplements health state and never contains a raw error.
FailureClass FailureClass `json:"failure_class,omitempty"`
// CheckedAt is the UTC completion time of the active assessment.
CheckedAt time.Time `json:"checked_at,omitempty"`
// Duration is the complete assessment duration.
Duration time.Duration `json:"duration,omitempty"`
// Message is bounded operational context and must not contain secrets.
Message string `json:"message,omitempty"`
}
Health is one dependency-health observation suitable for caching and operational inspection.
func DefaultHealthSanitizer ¶
DefaultHealthSanitizer enforces valid states, UTC timestamps, non-negative durations, and bounded single-line operational text. Control and Unicode formatting characters are removed. It cannot detect secrets; custom clients remain responsible for not returning sensitive text.
func (Health) IsReady ¶
func (h Health) IsReady(policy ReadinessPolicy) bool
IsReady reports whether this health state satisfies policy. Informational policy is always satisfied; Registry omits informational clients from readiness entirely.
type HealthAssessment ¶
type HealthAssessment struct {
// State is the protocol-level health decision.
State HealthState `json:"state"`
// FailureClass is the stable cause when the assessment represents failure.
FailureClass FailureClass `json:"failure_class,omitempty"`
// Message is protocol-supplied operational context and must not contain
// secrets.
Message string `json:"message,omitempty"`
}
HealthAssessment is a protocol-level health decision without lifecycle metadata. Clientkit owns check timestamps, durations, sanitization, caching, and telemetry around the assessment.
type HealthCheckConfigurable ¶
type HealthCheckConfigurable interface {
// HealthCheckEnabled reports whether Check is configured for active use.
HealthCheckEnabled() bool
}
HealthCheckConfigurable optionally reports whether a registered client's active health check is enabled. Registry captures this immutable configuration once during registration. The method must return quickly without performing I/O. HealthChecker implementations that do not implement this interface are treated as enabled.
type HealthChecker ¶
type HealthChecker interface {
RegisteredClient
// Check actively assesses the dependency and updates cached health.
Check(context.Context) Health
}
HealthChecker actively refreshes client health. Implementations must be safe for concurrent calls and honor context cancellation cooperatively. For an enabled check, Check must make its returned assessment subsequently visible through Health before it returns. Registry may retain a newer synthetic failure for its own passive projections when Check panics or Registry rejects a result; it does not mutate the client-owned cache.
type HealthEvent ¶
type HealthEvent struct {
// Client is the stable configured client name.
Client string
// Protocol identifies the client protocol.
Protocol string
// State is the final health state.
State HealthState
// FailureClass is the stable classified health-check failure and is empty
// when no execution failure caused the health state.
FailureClass FailureClass
// CheckedAt is the UTC health-check completion time.
CheckedAt time.Time
// Duration is the complete health-check duration.
Duration time.Duration
// Message is the bounded health result message.
Message string
// Attributes contains bounded, production-safe health details.
Attributes []opskit.Attribute
}
HealthEvent describes a completed client health check.
type HealthSanitizer ¶
HealthSanitizer transforms client health before it reaches telemetry, registry checks, readiness, status, or inspection surfaces. Custom implementations are synchronous: they must be concurrency-safe, return quickly without performing I/O, and produce bounded, non-sensitive output. Clientkit contains sanitizer panics as unknown policy failures.
type HealthState ¶
type HealthState string
HealthState is the bounded operational state of an outbound dependency.
const ( // HealthUnknown means no current, trustworthy assessment is available. HealthUnknown HealthState = "unknown" // HealthHealthy means the dependency satisfies its configured health policy. HealthHealthy HealthState = "healthy" // HealthDegraded means the dependency is usable with reduced capability. HealthDegraded HealthState = "degraded" // HealthUnhealthy means the dependency does not satisfy its health policy. HealthUnhealthy HealthState = "unhealthy" )
type IdleConnectionCloser ¶
type IdleConnectionCloser interface {
// CloseIdleConnections releases idle resources without closing the client.
CloseIdleConnections()
}
IdleConnectionCloser releases currently idle reusable connections without canceling or waiting for active operations. It does not permanently close a client: implementations may remain usable, and future operations may create new connections. Calls are explicit, synchronous, and may be made concurrently.
Applications using this capability during shutdown remain responsible for stopping new work and draining active work first. The capability is optional and pool-oriented; tcpclient does not implement it because successful raw TCP connections are caller-owned rather than tracked by Clientkit.
type NopObserver ¶
type NopObserver struct{}
NopObserver is an Observer that performs no work. Supplying it in a protocol client configuration explicitly disables the protocol's default observer.
func (NopObserver) ObserveAttempt ¶
func (NopObserver) ObserveAttempt(context.Context, AttemptEvent)
ObserveAttempt performs no work.
func (NopObserver) ObserveHealth ¶
func (NopObserver) ObserveHealth(context.Context, HealthEvent)
ObserveHealth performs no work.
func (NopObserver) ObserveRetry ¶
func (NopObserver) ObserveRetry(context.Context, RetryEvent)
ObserveRetry performs no work.
func (NopObserver) StartOperation ¶
func (NopObserver) StartOperation(ctx context.Context, _ OperationStartEvent) (context.Context, OperationObservation)
StartOperation returns the incoming context and a no-op observation.
type NopOperationObservation ¶
type NopOperationObservation struct{}
NopOperationObservation is an OperationObservation that performs no work.
func (NopOperationObservation) End ¶
func (NopOperationObservation) End(context.Context, OperationEndEvent)
End performs no work.
type Observer ¶
type Observer interface {
// StartOperation observes an operation start and may return a derived context
// used by the operation and its later observer callbacks.
StartOperation(context.Context, OperationStartEvent) (context.Context, OperationObservation)
// ObserveAttempt observes one completed execution attempt.
ObserveAttempt(context.Context, AttemptEvent)
// ObserveRetry observes one retry that has been scheduled.
ObserveRetry(context.Context, RetryEvent)
// ObserveHealth observes one completed health check.
ObserveHealth(context.Context, HealthEvent)
}
Observer receives backend-neutral client lifecycle events. Implementations must be safe for concurrent use. Callbacks are synchronous and should return quickly. Event attributes must remain bounded and safe for production telemetry.
func MultiObserver ¶
MultiObserver explicitly composes non-nil observers in registration order. Derived operation contexts are chained in the same order, callback panics are contained independently, and operation observations end in reverse order to support stacked spans and cleanup.
func SafeObserver ¶
SafeObserver wraps an observer so telemetry panics cannot affect client execution. Event attribute slices are cloned before callbacks, a panic from StartOperation preserves the incoming context, and a nil observer becomes NopObserver.
type OperationEndEvent ¶
type OperationEndEvent struct {
// Client is the stable configured client name.
Client string
// Protocol identifies the client protocol.
Protocol string
// Operation identifies the bounded operation type.
Operation string
// StartedAt is the UTC operation start time.
StartedAt time.Time
// EndedAt is the UTC operation completion time.
EndedAt time.Time
// Duration is the complete operation duration.
Duration time.Duration
// Attempts is the number of actual execution attempts.
Attempts int
// Outcome is the protocol implementation's bounded final outcome.
Outcome string
// Succeeded is the protocol implementation's authoritative decision that the
// operation met its configured acceptance criteria. A true value requires a
// nil Err and FailureNone; adapters treat contradictory events as failures.
Succeeded bool
// FailureClass is the protocol implementation's stable classified failure.
// It supplements Outcome and Err and is empty on success.
FailureClass FailureClass
// Err is the original terminal error and must not be used as a metric label.
Err error
// Attributes contains bounded, production-safe operation details.
Attributes []opskit.Attribute
}
OperationEndEvent describes the completion of a client operation. Err may be recorded by error-aware telemetry but must never be used directly as a metric label.
type OperationKind ¶
type OperationKind uint8
OperationKind describes whether an observed operation coordinates logical client policy or directly represents one remote interaction.
const ( // OperationKindLogical identifies an operation that may coordinate retries, // backoff, classification, or multiple remote interactions. OperationKindLogical OperationKind = iota // OperationKindRemote identifies an operation that directly represents one // remote interaction. OperationKindRemote )
type OperationObservation ¶
type OperationObservation interface {
// End observes the final operation outcome exactly once.
End(context.Context, OperationEndEvent)
}
OperationObservation completes an observation started by Observer.
type OperationObservationFunc ¶
type OperationObservationFunc func(context.Context, OperationEndEvent)
OperationObservationFunc adapts a function into an OperationObservation.
func (OperationObservationFunc) End ¶
func (fn OperationObservationFunc) End(ctx context.Context, event OperationEndEvent)
End invokes fn when it is non-nil.
type OperationStartEvent ¶
type OperationStartEvent struct {
// Kind identifies the operation boundary for tracing adapters.
Kind OperationKind
// Client is the stable configured client name.
Client string
// Protocol identifies the client protocol.
Protocol string
// Operation identifies the bounded operation type.
Operation string
// StartedAt is the UTC operation start time.
StartedAt time.Time
// Attributes contains bounded, production-safe operation details.
Attributes []opskit.Attribute
}
OperationStartEvent describes the beginning of a client operation. The zero Kind is OperationKindLogical for compatibility with ordinary event literals.
type ReadinessPolicy ¶
type ReadinessPolicy string
ReadinessPolicy describes how one outbound client affects the Clientkit registry's aggregate readiness. It is deliberately separate from Opskit's component-registration policy: this policy belongs to the client domain.
const ( // ReadinessRequired requires healthy client state. ReadinessRequired ReadinessPolicy = "required" // ReadinessOptional includes the client as an optional readiness component // without allowing it to block aggregate readiness. It is the production-safe // zero-value default. ReadinessOptional ReadinessPolicy = "optional" // ReadinessDegradedAllowed accepts healthy or degraded client state, but not // unknown or unhealthy state. ReadinessDegradedAllowed ReadinessPolicy = "degraded_allowed" // ReadinessInformational keeps client health visible through status, checks, // snapshots, and inspection, but omits the client from readiness items // and aggregate readiness decisions. ReadinessInformational ReadinessPolicy = "informational" )
func (ReadinessPolicy) BlocksReadiness ¶
func (policy ReadinessPolicy) BlocksReadiness() bool
BlocksReadiness reports whether unsatisfied client health prevents aggregate readiness and therefore requires an active health strategy when used by a built-in protocol client.
type RegisteredClient ¶
type RegisteredClient interface {
// Name returns a stable name accepted by ValidateClientName.
Name() string
// Protocol returns a stable, low-cardinality client-family category accepted
// by ValidateClientProtocol. It must not contain an endpoint or other
// sensitive configuration.
Protocol() string
// ReadinessPolicy returns stable policy metadata.
ReadinessPolicy() ReadinessPolicy
// Health returns cached health without performing dependency I/O.
Health() Health
}
RegisteredClient exposes the passive operational state required by Registry.
RegisteredClient should normally be implemented by a pointer or value type. Registry registration rejects nil interfaces and typed-nil pointers. The registry captures Name, Protocol, and ReadinessPolicy once during registration, and implementations must keep that metadata stable. After registration, implementations must remain safe for concurrent operational use.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores clients and executes enabled health checks with an immutable concurrency bound. Its zero value is ready to use and applies the production default bound.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry constructs a registry using DefaultRegistryConfig.
func NewRegistryWithConfig ¶
func NewRegistryWithConfig(cfg RegistryConfig) (*Registry, error)
NewRegistryWithConfig validates cfg and constructs a registry with immutable bounded health-check concurrency. Zero uses the production default; one restores sequential checking.
func (*Registry) CheckAll ¶
func (r *Registry) CheckAll(ctx context.Context) opskit.CheckSummary
CheckAll concurrently executes enabled client checks with bounded concurrency and returns results in deterministic name order. The configured concurrency bound applies across overlapping CheckAll calls, and checks for the same registered client are serialized. Checkers must honor context cancellation cooperatively; a checker panic becomes a stable unhealthy result rather than escaping the worker goroutine. After checker and sanitizer callbacks return, results that crossed a cancellation or deadline boundary are rejected with the corresponding stable failure classification. Client-specific failures synthesized by Registry remain visible to passive registry projections until a later client-owned assessment supersedes them.
func (*Registry) CloseIdleConnections ¶
func (r *Registry) CloseIdleConnections()
CloseIdleConnections synchronously asks every capable registered client to release its currently idle reusable connections in deterministic registered name order. It snapshots membership under the registry read lock, releases the lock before invoking clients, and contains panics from external implementations so later clients are still invoked. Active operations are not canceled or awaited, clients remain registered and reusable, and future requests may establish new connections.
Applications remain responsible for stopping new work and draining active operations before cleanup when required. Typical shutdown composition is:
clients := clientkit.NewRegistry() clients.MustRegister(payments) clients.MustRegister(catalog) // Stop accepting new work and wait for active operations first. clients.CloseIdleConnections()
func (*Registry) ComponentInfo ¶
func (r *Registry) ComponentInfo() opskit.ComponentInfo
ComponentInfo returns the registry's immutable Opskit identity. The returned value is cloned so callers cannot mutate registry configuration.
func (*Registry) Get ¶
func (r *Registry) Get(name string) (RegisteredClient, bool)
Get returns the registered client identified by name. The returned client remains owned by its creator and may be used concurrently according to its contract.
func (*Registry) Inspect ¶
Inspect returns a passive registry snapshot and honors cancellation before and after collecting external client health.
func (*Registry) MustRegister ¶
func (r *Registry) MustRegister(client RegisteredClient)
MustRegister registers one client or panics with the exact registration error returned by Register. It is intended for deterministic application composition during startup.
func (*Registry) MustRegisterAll ¶
func (r *Registry) MustRegisterAll(clients ...RegisteredClient)
MustRegisterAll atomically registers clients or panics with the exact registration error returned by RegisterAll. It is intended for static application composition during startup.
func (*Registry) Readiness ¶
Readiness projects passive cached health and Clientkit readiness policies into Opskit readiness items. Informational clients are omitted.
func (*Registry) Register ¶
func (r *Registry) Register(client RegisteredClient) error
Register validates and adds one client to the registry. Nil interfaces and typed-nil pointers are rejected. Registration captures the client's stable name, protocol, readiness policy, and health-check enablement once and returns any validation or duplicate error. The registry supports static composition; clients cannot be replaced or unregistered.
func (*Registry) RegisterAll ¶
func (r *Registry) RegisterAll(clients ...RegisteredClient) error
RegisterAll validates and atomically registers clients in argument order. Nil interfaces and typed-nil pointers are rejected. Registration metadata is captured once per client, including health-check enablement, and validation or duplicate errors register none of the batch. The registry supports static composition; clients cannot be replaced or unregistered.
func (*Registry) Snapshot ¶
func (r *Registry) Snapshot() RegistrySnapshot
Snapshot returns registered clients in deterministic name order using passive health reads and the registry's sanitization policy. A newer client-specific failure synthesized by CheckAll is projected over older client-owned health until a later assessment supersedes it. Snapshot never executes health checks.
type RegistryConfig ¶
type RegistryConfig struct {
// MaxConcurrentChecks bounds simultaneous enabled health checks. Zero uses
// DefaultMaxConcurrentChecks, and one restores sequential execution.
MaxConcurrentChecks int
// ComponentInfo overrides the registry's Opskit identity. Empty fields use
// Clientkit defaults. The stable kit=clientkit label is always preserved.
ComponentInfo opskit.ComponentInfo
// HealthSanitizer completely replaces DefaultHealthSanitizer for registry
// checks, snapshots, status, readiness, and inspection output.
HealthSanitizer HealthSanitizer
// DisableHealthSanitizer disables registry-level health sanitization. It
// cannot be combined with HealthSanitizer. Registered clients must then
// provide valid, bounded, non-sensitive health values.
DisableHealthSanitizer bool
}
RegistryConfig configures immutable registry execution behavior.
func DefaultRegistryConfig ¶
func DefaultRegistryConfig() RegistryConfig
DefaultRegistryConfig returns the production registry configuration.
type RegistrySnapshot ¶
type RegistrySnapshot struct {
// Clients is sorted by client name.
Clients []ClientSnapshot `json:"clients"`
}
RegistrySnapshot is a deterministic point-in-time view of registered clients.
type RetryEvent ¶
type RetryEvent struct {
// Client is the stable configured client name.
Client string
// Protocol identifies the client protocol.
Protocol string
// Operation identifies the bounded operation type.
Operation string
// AfterAttempt is the completed attempt that caused the retry.
AfterAttempt int
// At is the UTC time at which the retry was scheduled.
At time.Time
// Delay is the exact selected retry delay.
Delay time.Duration
// Cause is the bounded outcome that caused the retry.
Cause string
// FailureClass is the stable classified failure that caused the retry.
FailureClass FailureClass
// Attributes contains bounded, production-safe retry details.
Attributes []opskit.Attribute
}
RetryEvent describes one retry that has been scheduled.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
http-basic
command
|
|
|
http-retry-and-classification
command
|
|
|
tcp-tls
command
|
|
|
Package httpclient provides production-oriented outbound HTTP clients with bounded execution, retries, propagation, observability, and optional cached dependency health.
|
Package httpclient provides production-oriented outbound HTTP clients with bounded execution, retries, propagation, observability, and optional cached dependency health. |
|
otel
Package otel provides Clientkit's OpenTelemetry HTTP propagation and per-RoundTrip transport instrumentation.
|
Package otel provides Clientkit's OpenTelemetry HTTP propagation and per-RoundTrip transport instrumentation. |
|
internal
|
|
|
configvalue
Package configvalue centralizes shared configuration-value normalization.
|
Package configvalue centralizes shared configuration-value normalization. |
|
failure
Package failure provides internal standard-library network failure classification shared by protocol implementations.
|
Package failure provides internal standard-library network failure classification shared by protocol implementations. |
|
healthrecord
Package healthrecord owns the shared protocol health-recording lifecycle.
|
Package healthrecord owns the shared protocol health-recording lifecycle. |
|
Package otel adapts Clientkit observer events to OpenTelemetry traces and metrics.
|
Package otel adapts Clientkit observer events to OpenTelemetry traces and metrics. |
|
Package slogobserver adapts Clientkit observer events to synchronous structured log/slog records.
|
Package slogobserver adapts Clientkit observer events to synchronous structured log/slog records. |
|
Package tcpclient establishes ordinary plaintext or TLS-over-TCP connections while preserving Clientkit identity, readiness, cached health, and observability.
|
Package tcpclient establishes ordinary plaintext or TLS-over-TCP connections while preserving Clientkit identity, readiness, cached health, and observability. |