diag

package
v0.1.0 Latest Latest
Warning

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

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

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

View Source
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"
)
View Source
const DefaultRouteTraceCapacity = 64

DefaultRouteTraceCapacity is the ring size used when diagnostics.route_trace_path is mounted.

View Source
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 ALegID

func ALegID(ctx context.Context) string

ALegID re-exports lineage.ALegID.

func AppendIsolatedCrashStack

func AppendIsolatedCrashStack(attrs []slog.Attr, pe *safety.PanicError) []slog.Attr

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

func AppendLimited(values []string, value string, maxLen int) []string

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

func Attrs(ctx context.Context, o AttrOpts) []slog.Attr

Attrs builds stable slog attributes for orchestration and lineage logs (Req 13.2, 13.3).

func BoundedALegID

func BoundedALegID(aLegID string) string

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

func EnsureCallDiag(ctx context.Context, traceID, aLegID string) context.Context

EnsureCallDiag re-exports lineage.EnsureCallDiag.

func HealthHandler

func HealthHandler() http.Handler

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

func InventoryHandler(cfg *config.Config, extras *InventoryExtras) (http.Handler, error)

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

func LogDecision(ctx context.Context, log *slog.Logger, msg string, o AttrOpts, extra ...slog.Attr)

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

func LoggerOrDefault(log *slog.Logger) *slog.Logger

LoggerOrDefault returns log when present, otherwise slog.Default().

func PprofHandler

func PprofHandler(prefix string) http.Handler

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

func RouteSelectorDigest(raw string) string

RouteSelectorDigest returns a short hex SHA-256 prefix of the selector for logs.

func RouteTraceHandler

func RouteTraceHandler(buf *RouteTraceBuffer, log *slog.Logger) (http.Handler, error)

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

func StableCallID(call *lipapi.Call) string

StableCallID returns the caller-provided ID when present, otherwise a deterministic call-derived identifier suitable for trace and wire fallback use.

func StableCallIDFromSum

func StableCallIDFromSum(explicitID string, sum [32]byte) string

StableCallIDFromSum returns explicitID when present, otherwise a deterministic call-derived identifier derived from sum.

func StableCallSum

func StableCallSum(call *lipapi.Call) [32]byte

StableCallSum returns the canonical SHA-256 identity digest for call.

func StableCallToken

func StableCallToken(call *lipapi.Call) string

StableCallToken returns a deterministic fingerprint for a canonical call. The token is stable across process runs for the same call content.

func StableCallTokenFromSum

func StableCallTokenFromSum(sum [32]byte) string

StableCallTokenFromSum returns a deterministic fingerprint for an already-computed canonical call sum.

func StableCounts

func StableCounts(counts map[string]int) []string

StableCounts formats count maps as sorted "key=value" strings for stable logs.

func StableTime

func StableTime(call *lipapi.Call) time.Time

StableTime returns a deterministic UTC timestamp derived from the call.

func StableTimeFromSum

func StableTimeFromSum(sum [32]byte) time.Time

StableTimeFromSum returns a deterministic UTC timestamp derived from an already-computed canonical call sum.

func StableUnix

func StableUnix(call *lipapi.Call) int64

StableUnix returns a deterministic Unix timestamp derived from the call. It is intentionally stable across runs so wire fallbacks stay reproducible.

func StableUnixFromSum

func StableUnixFromSum(sum [32]byte) int64

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 TraceID

func TraceID(ctx context.Context) string

TraceID re-exports lineage.TraceID.

func TruncErrDetail

func TruncErrDetail(err error, maxLen int) string

TruncErrDetail returns err.Error() truncated to maxLen runes for log attributes (never for client-visible text).

func WithALeg

func WithALeg(ctx context.Context, aLegID string) context.Context

WithALeg re-exports lineage.WithALeg.

func WithCallDiag

func WithCallDiag(ctx context.Context, traceID, aLegID string) context.Context

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

func WithTraceID(ctx context.Context, traceID string) context.Context

WithTraceID re-exports lineage.WithTraceID.

func WrapDiagnosticsProtect

func WrapDiagnosticsProtect(secret string, next http.Handler) http.Handler

WrapDiagnosticsProtect returns next unchanged when secret is empty; otherwise it requires an exact match of HeaderDiagnosticsSecret (constant-time when lengths match).

func WrapDiagnosticsProtectHeaders

func WrapDiagnosticsProtectHeaders(secret string, names []string, next http.Handler) http.Handler

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 AttrOpts

type AttrOpts struct {
	CallID string
	BLegID string
}

AttrOpts selects optional slog attributes beyond trace and A-leg from ctx.

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

type CrashAttrOpts struct {
	AttrOpts
	AttemptSeq int
}

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 InventoryExtensionStage struct {
	ID             string `json:"id"`
	DefaultFailure string `json:"default_failure"`
}

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 InventorySecretGuard struct {
	InstanceID        string   `json:"instance_id"`
	Action            string   `json:"action,omitempty"`
	CatalogEntryCount int      `json:"catalog_entry_count"`
	SourceCategories  []string `json:"source_categories,omitempty"`
	AccessMode        string   `json:"access_mode,omitempty"`
}

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 InventoryStageOccupancy struct {
	StageID    string   `json:"stage_id"`
	HandlerIDs []string `json:"handler_ids"`
	Count      int      `json:"count"`
}

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

type ReloadStatusSource interface {
	ReloadStatus() sdkreload.Status
}

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 SafeField

type SafeField struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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.

Jump to

Keyboard shortcuts

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