cel

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cel implements a metrics evaluator using the Common Expression Language (CEL).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

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

Environment is environment in which cel programs are executed

func NewEnvironment

func NewEnvironment(conf NodeEvaluatorConfig) (*Environment, error)

NewEnvironment returns a MetricEvaluator that is able to evaluate node metrics

func (*Environment) Compile

func (e *Environment) Compile(src string) (*Evaluator, error)

Compile is responsible for compiling a cel program

type Evaluator

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

Evaluator evaluates a cel program

func (*Evaluator) EvaluateFloat64

func (e *Evaluator) EvaluateFloat64(node *corev1.Node) (float64, error)

EvaluateFloat64 evaluates a cel program and returns a metric value and returns float64.

func (*Evaluator) EvaluateString

func (e *Evaluator) EvaluateString(node *corev1.Node) (string, error)

EvaluateString evaluates a cel program and returns a string

type NodeEvaluatorConfig

type NodeEvaluatorConfig struct {
	Now                    func() time.Time
	StartedContainersTotal func(nodeName string) int64
}

NodeEvaluatorConfig holds configuration for a cel program

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳