query

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpandDepth = 1
	MaxExpandDepth     = 4
	DefaultExpandLimit = 200
	MaxExpandLimit     = 2000
)
View Source
const MaxDiagnosticDepth = 10

Variables

View Source
var (
	ErrDiagnosticNotReady      = errors.New("diagnostic facade is not ready")
	ErrDiagnosticEntryNotFound = errors.New("diagnostic entry not found")
	ErrInvalidDiagnosticQuery  = errors.New("invalid diagnostic query")
)

Functions

func ExpandSubgraph

func ExpandSubgraph(ctx context.Context, backend ontology.Backend, options ExpandOptions) (api.GraphSubgraph, error)

func ParseTerminalNodeKinds

func ParseTerminalNodeKinds(raw string) ([]api.NodeKind, bool, error)

func ValidateDiagnosticOptions

func ValidateDiagnosticOptions(options DiagnosticOptions) error

func ValidateExpandOptions

func ValidateExpandOptions(options ExpandOptions) error

Types

type DiagnosticOptions

type DiagnosticOptions struct {
	MaxDepth            int
	StorageMaxDepth     int
	TerminalNodeKinds   []api.NodeKind
	ExpandTerminalNodes bool
}

type DiagnosticSubgraphResponse

type DiagnosticSubgraphResponse struct {
	api.DiagnosticSubgraph
	NodeCount int       `json:"nodeCount"`
	EdgeCount int       `json:"edgeCount"`
	Freshness Freshness `json:"freshness"`
}

func NewDiagnosticSubgraphResponse

func NewDiagnosticSubgraphResponse(result api.DiagnosticSubgraph, status RuntimeStatus) DiagnosticSubgraphResponse

type ErrorResponse

type ErrorResponse struct {
	Error     string `json:"error"`
	Message   string `json:"message"`
	Code      string `json:"code"`
	Status    int    `json:"status,omitempty"`
	Retryable bool   `json:"retryable"`
	Source    string `json:"source,omitempty"`
}

func NewErrorResponse

func NewErrorResponse(code string, status int, err error, retryable bool) ErrorResponse

type ExpandOptions

type ExpandOptions struct {
	EntityID     model.CanonicalID
	Depth        int
	Direction    ontology.Direction
	RelationKind string
	Limit        int
}

type Facade

type Facade struct {
	Diagnostic *diagnostic.Service
	// contains filtered or unexported fields
}

func NewFacade

func NewFacade(cluster string, snapshot collectk8s.Snapshot, builder *graph.Builder, diagnosticService *diagnostic.Service) *Facade

func (*Facade) DiagnosticPolicy

func (f *Facade) DiagnosticPolicy(options DiagnosticOptions) api.ExpansionPolicy

func (*Facade) FindEntryID

func (f *Facade) FindEntryID(entryKind, namespace, name string) (string, error)

func (*Facade) QueryDiagnosticSubgraph

func (f *Facade) QueryDiagnosticSubgraph(entryKind, namespace, name string, options DiagnosticOptions) (api.DiagnosticSubgraph, error)

func (*Facade) QueryDiagnosticSubgraphContext

func (f *Facade) QueryDiagnosticSubgraphContext(ctx context.Context, entryKind, namespace, name string, options DiagnosticOptions) (api.DiagnosticSubgraph, error)

func (*Facade) RuntimeStatus

func (f *Facade) RuntimeStatus() RuntimeStatus

func (*Facade) SetRuntimeStatus

func (f *Facade) SetRuntimeStatus(status RuntimeStatus)

func (*Facade) SetSnapshot

func (f *Facade) SetSnapshot(snapshot collectk8s.Snapshot)

type Freshness

type Freshness struct {
	Ready                      bool   `json:"ready"`
	Phase                      string `json:"phase,omitempty"`
	Cluster                    string `json:"cluster,omitempty"`
	NodeCount                  int    `json:"nodeCount"`
	EdgeCount                  int    `json:"edgeCount"`
	LastRefreshAt              string `json:"lastRefreshAt,omitempty"`
	LastBootstrapAt            string `json:"lastBootstrapAt,omitempty"`
	LastAppliedChangeKind      string `json:"lastAppliedChangeKind,omitempty"`
	LastAppliedChangeNamespace string `json:"lastAppliedChangeNamespace,omitempty"`
	LastAppliedChangeName      string `json:"lastAppliedChangeName,omitempty"`
	LastAppliedChangeType      string `json:"lastAppliedChangeType,omitempty"`
	LastAppliedChangeAt        string `json:"lastAppliedChangeAt,omitempty"`
	LastStrategy               string `json:"lastStrategy,omitempty"`
	LastError                  string `json:"lastError,omitempty"`
}

func FreshnessFromRuntimeStatus

func FreshnessFromRuntimeStatus(status RuntimeStatus) Freshness

type GraphExpansion

type GraphExpansion struct {
	GraphStateGraph
	ExpandedFrom string `json:"expandedFrom"`
	Depth        int    `json:"depth,omitempty"`
	Direction    string `json:"direction,omitempty"`
	Limit        int    `json:"limit,omitempty"`
}

type GraphStateDocument

type GraphStateDocument struct {
	Source      string               `json:"source,omitempty"`
	Mode        string               `json:"mode,omitempty"`
	Status      json.RawMessage      `json:"status,omitempty"`
	Entry       json.RawMessage      `json:"entry,omitempty"`
	Nodes       []api.DiagnosticNode `json:"nodes,omitempty"`
	Edges       []api.DiagnosticEdge `json:"edges,omitempty"`
	CollectedAt json.RawMessage      `json:"collectedAt,omitempty"`
	Explanation []string             `json:"explanation,omitempty"`
	BaseGraph   *GraphStateGraph     `json:"baseGraph,omitempty"`
	Expansions  []GraphExpansion     `json:"expansions,omitempty"`
	ExportedAt  string               `json:"exportedAt,omitempty"`
}

func CollapseGraphExpansion

func CollapseGraphExpansion(doc GraphStateDocument, entityID string) (GraphStateDocument, error)

type GraphStateGraph

type GraphStateGraph struct {
	Source      string               `json:"source,omitempty"`
	Mode        string               `json:"mode,omitempty"`
	Status      json.RawMessage      `json:"status,omitempty"`
	Entry       json.RawMessage      `json:"entry,omitempty"`
	Nodes       []api.DiagnosticNode `json:"nodes,omitempty"`
	Edges       []api.DiagnosticEdge `json:"edges,omitempty"`
	CollectedAt json.RawMessage      `json:"collectedAt,omitempty"`
	Explanation []string             `json:"explanation,omitempty"`
}

type GraphSubgraphResponse

type GraphSubgraphResponse struct {
	api.GraphSubgraph
	NodeCount int       `json:"nodeCount"`
	EdgeCount int       `json:"edgeCount"`
	Freshness Freshness `json:"freshness"`
}

func NewGraphSubgraphResponse

func NewGraphSubgraphResponse(result api.GraphSubgraph, status RuntimeStatus) GraphSubgraphResponse

type RuntimeStatus

type RuntimeStatus struct {
	Phase                       string
	Cluster                     string
	Ready                       bool
	NodeCount                   int
	EdgeCount                   int
	LastBootstrapAt             string
	LastAppliedChangeKind       string
	LastAppliedChangeNS         string
	LastAppliedChangeName       string
	LastAppliedChangeType       string
	LastAppliedChangeAt         string
	LastStrategy                string
	FullRebuildCount            int
	EventNarrowCount            int
	StorageNarrowCount          int
	ServiceNarrowCount          int
	PodNarrowCount              int
	WorkloadNarrowCount         int
	IdentitySecurityNarrowCount int
	LastError                   string
}

Jump to

Keyboard shortcuts

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