impact

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "impact_analysis"

Variables

This section is empty.

Functions

func Enable

func Enable(ctx context.Context, path string) context.Context

func Enabled

func Enabled() bool

Enabled returns if the LIA plugin is enabled

func Enqueue

func Enqueue(ctx context.Context, ectx EvalContext, exp ast.Value)

Enqueue is the quick and dirty entrypoint that the singleton Impact plugin works from

func Factory

func Factory() plugins.Factory

func HTTPMiddleware

func HTTPMiddleware(next http.Handler) http.Handler

Types

type Config

type Config struct {
	DecisionLogs bool `json:"decision_logs"` // Also emit decision logs for secondary evals
}

Config represents the configuration for the impact analysis plugin

type EvalContext

type EvalContext interface {
	CompiledQuery() ast.Body
	NDBCache() builtins.NDBCache
	ParsedInput() ast.Value
	Metrics() metrics.Metrics
}

type Impact

type Impact struct {
	// contains filtered or unexported fields
}

Impact holds the state of a plugin instantiation

func Lookup

func Lookup(manager *plugins.Manager) *Impact

func (*Impact) Reconfigure

func (i *Impact) Reconfigure(context.Context, any)

func (*Impact) ServeHTTP

func (i *Impact) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Impact) Start

func (i *Impact) Start(ctx context.Context) error

func (*Impact) StartJob

func (i *Impact) StartJob(ctx context.Context, j Job) error

func (*Impact) Stop

func (i *Impact) Stop(context.Context)

type Job

type Job interface {
	ID() JobID
	SampleRate() float32
	PublishEquals() bool
	Bundle() *bundle.Bundle
	Duration() time.Duration
	Results() <-chan *Result

	// Result records a single result
	Result(*Result) error

	Start(_ context.Context, cleanup func())
}

func NewJob

func NewJob(_ context.Context, rate float32, publishEquals bool, bundle *bundle.Bundle, dur time.Duration) Job

type JobID

type JobID string

type Result

type Result struct {
	NodeID     string `json:"node_id"`
	RequestID  uint64 `json:"req_id,omitempty"`
	DecisionID string `json:"decision_id,omitempty"`
	ValueA     *any   `json:"value_a"`
	ValueB     *any   `json:"value_b"`
	Input      *any   `json:"input"`
	Path       string `json:"path"`
	EvalNSA    uint64 `json:"eval_ns_a"`
	EvalNSB    uint64 `json:"eval_ns_b"`
}

func (*Result) String

func (r *Result) String() string

Jump to

Keyboard shortcuts

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