Documentation
¶
Overview ¶
Package diag provides request-scoped trace propagation, structured logging helpers, and minimal HTTP surfaces for health and B2BUA attempt diagnostics.
Trace and A-leg identifiers are carried on context.Context for use by the executor and (in later tasks) frontend encoders and plugins via diag.TraceID / diag.ALegID.
Query-style read seams (requirement 7.6) ¶
Read-only admin, diagnostics, and reporting flows should use narrow query ports and stable read DTOs from github.com/matdev83/go-llm-interactive-proxy/pkg/lipapi instead of repository-shaped write abstractions when that is simpler. For example, AttemptLoader exposes only attempt row reads for the attempts HTTP handler; HTTP framing and JSON encoding stay in this package while orchestration types remain outside the handler contract.
Index ¶
- Constants
- func ALegID(ctx context.Context) string
- func AppendIsolatedCrashStack(attrs []slog.Attr, pe *safety.PanicError) []slog.Attr
- func AppendLimited(values []string, value string, maxLen int) []string
- func AttemptsHandler(store AttemptLoader) (http.Handler, error)
- func Attrs(ctx context.Context, o AttrOpts) []slog.Attr
- func BoundedALegID(aLegID string) string
- func DebugTurnsEnabled() bool
- func EnsureCallDiag(ctx context.Context, traceID, aLegID string) context.Context
- func HealthHandler() http.Handler
- func InterleavedTransitionAttrs(t InterleavedTransition) []slog.Attr
- func InventoryHandler(cfg *config.Config, extras *InventoryExtras) (http.Handler, error)
- func IsolatedCrashAttrs(ctx context.Context, pe *safety.PanicError, o CrashAttrOpts) []slog.Attr
- func LogDecision(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, ...)
- func LogError(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, err error, ...)
- func LogInterleavedTransition(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, ...)
- func LogRouteOverrideMutation(ctx context.Context, log *slog.Logger, m RouteOverrideMutation)
- func LoggerOrDefault(log *slog.Logger) *slog.Logger
- func PprofHandler(prefix string) http.Handler
- func ReloadStatusHandler(src ReloadStatusSource) (http.Handler, error)
- func RouteSelectorDigest(raw string) string
- func RouteTraceHandler(buf *RouteTraceBuffer, log *slog.Logger) (http.Handler, error)
- func StableCallID(call *lipapi.Call) string
- func StableCallIDFromSum(explicitID string, sum [32]byte) string
- func StableCallSum(call *lipapi.Call) [32]byte
- func StableCallToken(call *lipapi.Call) string
- func StableCallTokenFromSum(sum [32]byte) string
- func StableCounts(counts map[string]int) []string
- func StableTime(call *lipapi.Call) time.Time
- func StableTimeFromSum(sum [32]byte) time.Time
- func StableUnix(call *lipapi.Call) int64
- func StableUnixFromSum(sum [32]byte) int64
- func TraceID(ctx context.Context) string
- func TruncErrDetail(err error, maxLen int) string
- func WithALeg(ctx context.Context, aLegID string) context.Context
- func WithCallDiag(ctx context.Context, traceID, aLegID string) context.Context
- func WithRouteTraceBuffer(ctx context.Context, buf *RouteTraceBuffer) context.Context
- func WithTraceID(ctx context.Context, traceID string) context.Context
- func WrapDiagnosticsProtect(secret string, next http.Handler) http.Handler
- func WrapDiagnosticsProtectHeaders(secret string, names []string, next http.Handler) http.Handler
- type AttemptLoader
- type AttrOpts
- type CompatibleBackendProjector
- type CompatibleBackendRow
- type CompatibleInventoryHealth
- type CompatibleInventoryModelSample
- type CrashAttrOpts
- type FeatureRegistry
- type HealthResponse
- type InstanceDiagnostic
- type InstanceDiagnosticProjector
- type InterleavedTransition
- type InventoryExtensionStage
- type InventoryExtensions
- type InventoryExtras
- type InventoryFeatureExtensions
- type InventoryGenericPorts
- type InventoryPrivileges
- type InventoryProjection
- type InventorySecretGuard
- type InventoryServerLimits
- type InventorySnapshot
- type InventoryStageOccupancy
- type PluginRow
- type ReloadStatusSource
- type RouteOverrideMutation
- type RouteTraceBuffer
- type RouteTraceCatalog
- type RouteTraceEntry
- type RouteTraceModelView
- type SafeField
- type SanitizedInstanceProjection
- type TraceIDGenerator
Constants ¶
const ( // RouteSelectorSourceClient is the bounded selector-source label when no admin override is active. RouteSelectorSourceClient = "client" // RouteSelectorSourceAdmin is the bounded selector-source label when an admin override was snapshotted. RouteSelectorSourceAdmin = "admin_override" // RouteOverrideMutationLogMsg is the structured mutation audit message. RouteOverrideMutationLogMsg = "route_override_mutation" )
const DefaultRouteTraceCapacity = 64
DefaultRouteTraceCapacity is the ring size used when diagnostics.route_trace_path is mounted.
const HeaderDiagnosticsSecret = lipsdk.HeaderDiagnosticsSecret
HeaderDiagnosticsSecret is the HTTP header clients must send when diagnostics.shared_secret is set.
Variables ¶
This section is empty.
Functions ¶
func AppendIsolatedCrashStack ¶
AppendIsolatedCrashStack appends a "panic_stack" attribute when pe has stack bytes. Intended for structured server logs only; do not add these attributes to client responses, metrics labels, or high-cardinality dimensions.
func AppendLimited ¶
AppendLimited appends a trimmed non-empty value until maxLen entries are present.
func AttemptsHandler ¶
func AttemptsHandler(store AttemptLoader) (http.Handler, error)
AttemptsHandler returns an http.Handler that GETs ?a_leg_id= and returns JSON attempt rows.
func Attrs ¶
Attrs builds stable slog attributes for orchestration and lineage logs (Req 13.2, 13.3).
func BoundedALegID ¶
BoundedALegID returns a hashed A-leg identifier suitable for ordinary logs.
func DebugTurnsEnabled ¶
func DebugTurnsEnabled() bool
DebugTurnsEnabled reports whether verbose per-turn diagnostics are enabled for this process. The environment is read once so debug wrappers agree on a single process-lifetime gate.
func EnsureCallDiag ¶
EnsureCallDiag re-exports lineage.EnsureCallDiag.
func HealthHandler ¶
HealthHandler returns an http.Handler that serves GET with JSON {"status":"ok"}.
func InterleavedTransitionAttrs ¶
func InterleavedTransitionAttrs(t InterleavedTransition) []slog.Attr
InterleavedTransitionAttrs builds stable slog attributes for interleaved state transitions.
func InventoryHandler ¶
InventoryHandler serves GET JSON describing enabled plugin rows from cfg. extras may be nil; when extras.Reg is set, extension occupancy is resolved from live factories.
func IsolatedCrashAttrs ¶
func IsolatedCrashAttrs(ctx context.Context, pe *safety.PanicError, o CrashAttrOpts) []slog.Attr
IsolatedCrashAttrs returns bounded slog attributes for an isolated application panic, merged with request/lineage context from ctx and AttrOpts. It never includes stack traces or raw panic text; use AppendIsolatedCrashStack to append a server-only stack field for loggers. When pe is nil, only correlation attributes from ctx and o are returned.
func LogDecision ¶
LogDecision emits a structured info log when log is non-nil (Req 13.3).
func LogError ¶
func LogError(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, err error, extra ...slog.Attr)
LogError emits a structured error log with lineage attrs from ctx when log and err are non-nil.
func LogInterleavedTransition ¶
func LogInterleavedTransition(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, t InterleavedTransition)
LogInterleavedTransition emits a bounded interleaved diagnostics log line.
func LogRouteOverrideMutation ¶
func LogRouteOverrideMutation(ctx context.Context, log *slog.Logger, m RouteOverrideMutation)
LogRouteOverrideMutation emits a structured mutation record without raw selector or raw A-leg id.
func LoggerOrDefault ¶
LoggerOrDefault returns log when present, otherwise slog.Default().
func PprofHandler ¶
PprofHandler serves standard library pprof endpoints under prefix (e.g. "/debug/pprof"). prefix must be non-empty after trimming; trailing slashes are stripped. Returns nil if prefix is empty.
Mount with mux.Handle(prefix+"/", h) so the index page resolves at prefix+"/".
func ReloadStatusHandler ¶
func ReloadStatusHandler(src ReloadStatusSource) (http.Handler, error)
ReloadStatusHandler serves GET JSON of bounded reload status with config/model generation correlation. Wrap with WrapDiagnosticsProtect at the mount site.
func RouteSelectorDigest ¶
RouteSelectorDigest returns a short hex SHA-256 prefix of the selector for logs.
func RouteTraceHandler ¶
RouteTraceHandler serves GET JSON of buffered route traces. log is the server logger (encode failures are logged at error level); nil falls back to slog.Default.
func StableCallID ¶
StableCallID returns the caller-provided ID when present, otherwise a deterministic call-derived identifier suitable for trace and wire fallback use.
func StableCallIDFromSum ¶
StableCallIDFromSum returns explicitID when present, otherwise a deterministic call-derived identifier derived from sum.
func StableCallSum ¶
StableCallSum returns the canonical SHA-256 identity digest for call.
func StableCallToken ¶
StableCallToken returns a deterministic fingerprint for a canonical call. The token is stable across process runs for the same call content.
func StableCallTokenFromSum ¶
StableCallTokenFromSum returns a deterministic fingerprint for an already-computed canonical call sum.
func StableCounts ¶
StableCounts formats count maps as sorted "key=value" strings for stable logs.
func StableTime ¶
StableTime returns a deterministic UTC timestamp derived from the call.
func StableTimeFromSum ¶
StableTimeFromSum returns a deterministic UTC timestamp derived from an already-computed canonical call sum.
func StableUnix ¶
StableUnix returns a deterministic Unix timestamp derived from the call. It is intentionally stable across runs so wire fallbacks stay reproducible.
func StableUnixFromSum ¶
StableUnixFromSum returns a deterministic Unix timestamp derived from an already-computed canonical call sum. It is intentionally stable across runs so wire fallbacks stay reproducible.
func TruncErrDetail ¶
TruncErrDetail returns err.Error() truncated to maxLen runes for log attributes (never for client-visible text).
func WithALeg ¶
WithALeg re-exports lineage.WithALeg.
func WithCallDiag ¶
WithCallDiag re-exports lineage.WithCallDiag.
func WithRouteTraceBuffer ¶
func WithRouteTraceBuffer(ctx context.Context, buf *RouteTraceBuffer) context.Context
WithRouteTraceBuffer attaches buf to ctx for downstream logging helpers.
func WithTraceID ¶
WithTraceID re-exports lineage.WithTraceID.
func WrapDiagnosticsProtect ¶
WrapDiagnosticsProtect returns next unchanged when secret is empty; otherwise it requires an exact match of HeaderDiagnosticsSecret (constant-time when lengths match).
func WrapDiagnosticsProtectHeaders ¶
WrapDiagnosticsProtectHeaders is WrapDiagnosticsProtect with extra accept names for the shared secret. Empty names use HeaderDiagnosticsSecret. First non-empty matching value wins.
Types ¶
type AttemptLoader ¶
type AttemptLoader interface {
LoadAttempts(ctx context.Context, aLegID string) ([]lipapi.AttemptRecord, error)
}
AttemptLoader is the query-style seam for diagnostics reads (hexagonal task 5.4): implementations return canonical lipapi.AttemptRecord rows without exposing persistence internals to HTTP adapters. Typical adapters implement this on top of github.com/matdev83/go-llm-interactive-proxy/internal/core/b2bua.Store.
type CompatibleBackendProjector ¶
type CompatibleBackendProjector func(cfg *config.Config) []CompatibleBackendRow
InventorySnapshotForConfig builds the same operator inventory view as InventoryHandler without HTTP. CompatibleBackendProjector builds bounded compatible-backend rows for inventory.
type CompatibleBackendRow ¶
type CompatibleBackendRow struct {
Origin string `json:"origin"`
InstanceID string `json:"instance_id"`
FactoryKind string `json:"factory_kind"`
Enabled bool `json:"enabled"`
Prefix string `json:"prefix,omitempty"`
// Profile is the configured protocol profile for OpenResponses-compatible
// backends (e.g. "2026-04-24"). Empty for protocol-agnostic compatible rows.
Profile string `json:"profile,omitempty"`
EndpointIdentity string `json:"endpoint_identity,omitempty"`
AuthConfigured bool `json:"auth_configured"`
TokenizerID string `json:"tokenizer_id,omitempty"`
ConcurrencyPolicy string `json:"concurrency_policy,omitempty"`
// Capabilities is the sanitized set of declared semantic capabilities for
// OpenResponses-compatible backends. Empty for protocol-agnostic rows.
Capabilities []string `json:"capabilities,omitempty"`
Conformance string `json:"conformance,omitempty"`
InventoryState string `json:"inventory_state,omitempty"`
InventoryHealth *CompatibleInventoryHealth `json:"inventory_health,omitempty"`
ConfigError string `json:"config_error,omitempty"`
}
CompatibleBackendRow is a bounded operator projection for one configured built-in compatible backend instance. Values never include credential secrets or raw opaque config payloads.
type CompatibleInventoryHealth ¶
type CompatibleInventoryHealth struct {
Status string `json:"status"`
Source string `json:"source,omitempty"`
ModelCount int `json:"model_count"`
ErrorCode string `json:"error_code,omitempty"`
RefreshedAt string `json:"refreshed_at,omitempty"`
LastSuccessHeld bool `json:"last_success_held,omitempty"`
SampleModels []CompatibleInventoryModelSample `json:"sample_models,omitempty"`
}
CompatibleInventoryHealth is bounded live inventory posture for one compatible backend instance. Values never include credential secrets or raw provider errors.
type CompatibleInventoryModelSample ¶
type CompatibleInventoryModelSample struct {
InstanceID string `json:"instance_id"`
FactoryKind string `json:"factory_kind"`
Prefix string `json:"prefix"`
CanonicalID string `json:"canonical_id"`
NativeID string `json:"native_id"`
Source string `json:"source"`
CapabilitySource string `json:"capability_source"`
}
CompatibleInventoryModelSample is a bounded operator view of one inventory row.
type CrashAttrOpts ¶
CrashAttrOpts extends AttrOpts with an optional attempt sequence; fields must stay bounded (static IDs, not unbounded user content).
type FeatureRegistry ¶
type FeatureRegistry interface {
BuildFeatureBundle(factoryKey string, n yaml.Node) (lipfeature.FeatureBundle, error)
}
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
}
HealthResponse is the JSON body for the basic liveness probe.
type InstanceDiagnostic ¶
type InstanceDiagnostic struct {
ID string `json:"id"`
InstanceID string `json:"instance_id,omitempty"`
FactoryKind string `json:"factory_kind"`
Origin string `json:"origin"`
Enabled bool `json:"enabled"`
Family string `json:"family,omitempty"`
Profile string `json:"profile,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
RouteClaims []string `json:"route_claims,omitempty"`
InventoryState string `json:"inventory_state,omitempty"`
Conformance string `json:"conformance,omitempty"`
ConfigError string `json:"config_error,omitempty"`
Details []SafeField `json:"details,omitempty"`
BasePath string `json:"base_path,omitempty"`
WebSocketEnabled bool `json:"websocket_enabled,omitempty"`
ContinuationStore string `json:"continuation_store,omitempty"`
ContinuationTTL string `json:"continuation_ttl,omitempty"`
AllowedOrigins []string `json:"allowed_origins,omitempty"`
}
InstanceDiagnostic is the bounded common operator projection for an extension instance. Protocol-specific data belongs in Details, supplied by its owner.
func CompatibleBackendInstanceDiagnostics ¶
func CompatibleBackendInstanceDiagnostics(rows []CompatibleBackendRow) []InstanceDiagnostic
CompatibleBackendInstanceDiagnostics converts already-projected compatible rows into the generic instance-diagnostic shape without decoding config.
func FallbackRowForRejectedProjection ¶
func FallbackRowForRejectedProjection(row InstanceDiagnostic, sanitizeErr error) InstanceDiagnostic
func SanitizeInstanceDiagnostic ¶
func SanitizeInstanceDiagnostic(in InstanceDiagnostic) (InstanceDiagnostic, error)
SanitizeInstanceDiagnostic bounds and sanitizes the common operator projection before a contribution-owned row reaches HTTP JSON: scalar fields and slice items are truncated to the byte bound with control characters stripped, and cardinality limits are enforced as errors. Values are preserved (not dropped) so operators keep diagnostic detail; rejection is reserved for unbounded cardinality.
type InstanceDiagnosticProjector ¶
type InstanceDiagnosticProjector func(cfg *config.Config) []InstanceDiagnostic
InstanceDiagnosticProjector is an extension-owned, side-effect-free view.
type InterleavedTransition ¶
type InterleavedTransition struct {
Phase string
Role string
MemoPresent bool
MemoVisible bool
MemoInjected bool
MemoExpired bool
ThinkerSuppressed bool
SkipReason string
ExtractionSource string
StreamInterrupted bool
// CycleIndex is the 1-based position of the selected turn within the
// thinker-aware weighted cycle; CycleTotal is the cycle length. Both are 0
// when the selection is not cycle-driven.
CycleIndex int
CycleTotal int
// Target is the normalized selector key of the selected branch/leaf.
Target string
// InjectionMode identifies how a memo was presented (for example, "conversation_view_overlay").
InjectionMode string
// TurnsRemaining is the memo injection budget after the reported decision.
TurnsRemaining int
}
InterleavedTransition carries bounded, low-cardinality interleaved diagnostics. It must never include memo body text, prompt text, or user message content.
type InventoryExtensionStage ¶
type InventoryExtensions ¶
type InventoryExtensions struct {
LegalPipeline []string `json:"legal_pipeline"`
Stages []InventoryExtensionStage `json:"stages"`
Features []InventoryFeatureExtensions `json:"features"`
// GenericPorts aggregates attempt-transform / final-stream observer occupancy
// across features (counts/flags only; no payloads or session partitions).
GenericPorts InventoryGenericPorts `json:"generic_ports"`
}
type InventoryExtras ¶
type InventoryExtras struct {
Reg FeatureRegistry
Registrations []lipsdk.Registration
CompatibleBackends CompatibleBackendProjector
// Precomputed is supplied by a composition root when related operator views
// already share one projection pass. A non-nil value is authoritative.
Precomputed *InventoryProjection
InstanceDiagnosticProjectors []InstanceDiagnosticProjector
SecretGuardCatalogEntryCount int
SecretGuardSourceCategories []string
SecretGuardAccessMode string
SecretGuardAction string
}
type InventoryFeatureExtensions ¶
type InventoryFeatureExtensions struct {
InstanceID string `json:"instance_id"`
FactoryKind string `json:"factory_kind"`
Enabled bool `json:"enabled"`
BundleError string `json:"bundle_error,omitempty"`
StageOccupancy []InventoryStageOccupancy `json:"stage_occupancy"`
Privileges InventoryPrivileges `json:"privileges"`
SecretGuard *InventorySecretGuard `json:"secret_guard,omitempty"`
}
type InventoryGenericPorts ¶
type InventoryGenericPorts struct {
AttemptTransformOccupied bool `json:"attempt_transform_occupied"`
AttemptTransformHandlers int `json:"attempt_transform_handlers"`
FinalStreamObservationOccupied bool `json:"final_stream_observation_occupied"`
FinalStreamObservationHandlers int `json:"final_stream_observation_handlers"`
}
InventoryGenericPorts is process-local aggregate posture for generic extension ports.
type InventoryPrivileges ¶
type InventoryPrivileges struct {
RawCapture bool `json:"raw_capture"`
AuxiliaryRequests bool `json:"auxiliary_requests"`
AuthProvider bool `json:"auth_provider"`
CompletionGate bool `json:"completion_gate"`
}
InventoryPrivileges surfaces privileged contract boundaries (all false until bundles declare them).
type InventoryProjection ¶
type InventoryProjection struct {
CompatibleBackends []CompatibleBackendRow
InstanceDiagnostics []InstanceDiagnostic
OpenResponsesFrontends []InstanceDiagnostic
}
InventoryProjection contains one shared diagnostic projection pass. InventoryProjection is the complete, sanitized diagnostic read model shared by inventory and route inspection. Callers must not rebuild its filtered views independently.
func ProjectInventoryDiagnostics ¶
func ProjectInventoryDiagnostics(cfg *config.Config, compatible []CompatibleBackendRow, projectors []InstanceDiagnosticProjector) InventoryProjection
ProjectInventoryDiagnostics assembles and sanitizes the complete diagnostic read model used by inventory and route inspection. This is the only place that combines compatible-backend rows with contribution-owned projectors.
type InventorySecretGuard ¶
type InventoryServerLimits ¶
type InventoryServerLimits struct {
MaxRequestBodyBytes int64 `json:"max_request_body_bytes"`
MaxConcurrentDecodes int `json:"max_concurrent_decodes"`
MaxInflightDecodeBytes int64 `json:"max_inflight_decode_bytes"`
MaxPendingWireEvents int `json:"max_pending_wire_events"`
}
InventoryServerLimits is the operator-visible server admission/queue caps. Decode fields are effective (zero→finite defaults). MaxPendingWireEvents is as configured (0 = unlimited).
type InventorySnapshot ¶
type InventorySnapshot struct {
Frontends []PluginRow `json:"frontends"`
Backends []PluginRow `json:"backends"`
CompatibleBackends []CompatibleBackendRow `json:"compatible_backends,omitempty"`
InstanceDiagnostics []InstanceDiagnostic `json:"instance_diagnostics,omitempty"`
OpenResponsesFrontends []InstanceDiagnostic `json:"openresponses_frontends,omitempty"`
Features []PluginRow `json:"features"`
Extensions InventoryExtensions `json:"extensions"`
// ServerLimits exposes effective decode/admission caps and configured pending-wire
// (0 = unlimited) as numbers only; no payloads.
ServerLimits InventoryServerLimits `json:"server_limits"`
}
InventorySnapshot is a JSON-serializable view of configured plugins for operators.
func InventorySnapshotForConfig ¶
func InventorySnapshotForConfig( ctx context.Context, cfg *config.Config, extras *InventoryExtras, ) (InventorySnapshot, error)
type InventoryStageOccupancy ¶
type PluginRow ¶
type PluginRow struct {
ID string `json:"id"`
FactoryKind string `json:"factory_kind"`
Enabled bool `json:"enabled"`
}
PluginRow is one config row (instance id + factory kind + enabled; config payloads stay opaque/private).
type ReloadStatusSource ¶
ReloadStatusSource is the query seam for protected reload diagnostics (req 14.1, 14.7).
type RouteOverrideMutation ¶
type RouteOverrideMutation struct {
Action string
Outcome string
Revision int64
ALegID string
Selector string
SelectorBytes int
Active bool
}
RouteOverrideMutation is the bounded audit payload for set/replace/clear.
type RouteTraceBuffer ¶
type RouteTraceBuffer struct {
// contains filtered or unexported fields
}
RouteTraceBuffer keeps a bounded FIFO of recent route-plan entries (debug only).
func NewRouteTraceBuffer ¶
func NewRouteTraceBuffer(n int) *RouteTraceBuffer
NewRouteTraceBuffer creates a ring buffer with capacity n (minimum 1).
func RouteTraceBufferFrom ¶
func RouteTraceBufferFrom(ctx context.Context) *RouteTraceBuffer
RouteTraceBufferFrom returns the buffer from ctx or nil.
func (*RouteTraceBuffer) Append ¶
func (b *RouteTraceBuffer) Append(e RouteTraceEntry)
Append adds an entry (drops oldest when full).
func (*RouteTraceBuffer) Snapshot ¶
func (b *RouteTraceBuffer) Snapshot() []RouteTraceEntry
Snapshot returns a copy of recent entries (newest last).
type RouteTraceCatalog ¶
type RouteTraceCatalog struct {
MatchKind string `json:"match_kind,omitempty"`
FactSource string `json:"fact_source,omitempty"`
MatchedModelID string `json:"matched_model_id,omitempty"`
EstimateBasis string `json:"estimate_basis,omitempty"`
Eligibility string `json:"eligibility,omitempty"`
Negotiation string `json:"negotiation,omitempty"`
}
RouteTraceCatalog is compact, content-free model-catalog routing metadata (optional; route trace only).
type RouteTraceEntry ¶
type RouteTraceEntry struct {
TraceID string `json:"trace_id"`
Decision string `json:"decision"`
Detail string `json:"detail"`
// ModelView identifies the immutable model/config publication used for this decision.
ModelView *RouteTraceModelView `json:"model_view,omitempty"`
// Catalog is set for plan_candidate when model-catalog hooks produced facts for the attempt.
Catalog *RouteTraceCatalog `json:"catalog,omitempty"`
// SelectorSource is client or admin_override. Raw route expressions must not appear here.
SelectorSource string `json:"selector_source,omitempty"`
// OverrideRevision is the snapshotted admin revision when SelectorSource is admin_override.
OverrideRevision int64 `json:"override_revision,omitempty"`
}
RouteTraceEntry is one structured routing decision snapshot.
type RouteTraceModelView ¶
type RouteTraceModelView struct {
Digest string `json:"digest"`
ConfigGeneration int64 `json:"config_generation,omitempty"`
ConfigFingerprint string `json:"config_fingerprint,omitempty"`
RegistryGeneration string `json:"registry_generation,omitempty"`
CatalogGeneration string `json:"catalog_generation,omitempty"`
}
RouteTraceModelView is the safe, immutable config/registry/catalog identity bound to the logical request that produced a routing decision.
type SanitizedInstanceProjection ¶
type SanitizedInstanceProjection struct {
Instances []InstanceDiagnostic
OpenResponsesRows []InstanceDiagnostic
}
FallbackRowForRejectedProjection converts a contribution row that failed SanitizeInstanceDiagnostic into a bounded error row. It re-applies the same byte and control-character bounds so a rejected input cannot re-enter the projection verbatim through the fallback path. SanitizedInstanceProjection is the canonical operator projection shared by inventory and route read models. OpenResponsesRows is a filtered view of the same sanitized instances, never a second sanitization pass.
func ProjectSanitizedInstanceDiagnostics ¶
func ProjectSanitizedInstanceDiagnostics(rows []InstanceDiagnostic) SanitizedInstanceProjection
type TraceIDGenerator ¶
type TraceIDGenerator = lineage.TraceIDGenerator
TraceIDGenerator re-exports lineage.TraceIDGenerator for backward-compatible wiring.
func NewTraceIDGenerator ¶
func NewTraceIDGenerator() *TraceIDGenerator
NewTraceIDGenerator re-exports lineage.NewTraceIDGenerator.