sampling

package
v0.0.0-...-9cda745 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultWaitDuraiton = "30s"
)

Variables

Functions

This section is empty.

Types

type ActionHandler

type ActionHandler interface {
	// GetRuleConfig Returns rule configuration for a given action
	GetRuleConfig(action metav1.Object) []Rule
	// // Lists all actions of a specific type in a given namespace
	List(ctx context.Context, client client.Client, namespace string) ([]metav1.Object, error)
	// ValidateRuleConfig validates the rule configuration for the action
	ValidateRuleConfig([]Rule) error
	// GetActionReference returns the owner reference for the action
	GetActionReference(action metav1.Object) metav1.OwnerReference
	// IsActionDisabled returns whether the action is disabled [action.Spec.Disabled]
	IsActionDisabled(action metav1.Object) bool
	// GetActionScope returns the scope of the action [global/service/endpoint]
	GetActionScope(action metav1.Object) string
}

ActionHandler defines methods for handling sampling actions using metav1.Objects for generic handling

type ErrorConfig

type ErrorConfig struct {
	FallbackSamplingRatio float64 `json:"fallback_sampling_ratio"`
}

func (*ErrorConfig) Validate

func (ec *ErrorConfig) Validate() error

type ErrorSamplerHandler

type ErrorSamplerHandler struct{}

func (*ErrorSamplerHandler) GetActionReference

func (h *ErrorSamplerHandler) GetActionReference(action metav1.Object) metav1.OwnerReference

func (*ErrorSamplerHandler) GetActionScope

func (h *ErrorSamplerHandler) GetActionScope(action metav1.Object) string

func (*ErrorSamplerHandler) GetRuleConfig

func (h *ErrorSamplerHandler) GetRuleConfig(action metav1.Object) []Rule

func (*ErrorSamplerHandler) IsActionDisabled

func (h *ErrorSamplerHandler) IsActionDisabled(action metav1.Object) bool

func (*ErrorSamplerHandler) List

func (h *ErrorSamplerHandler) List(ctx context.Context, c client.Client, namespace string) ([]metav1.Object, error)

func (*ErrorSamplerHandler) ValidateRuleConfig

func (h *ErrorSamplerHandler) ValidateRuleConfig(config []Rule) error

type GroupByTraceConfig

type GroupByTraceConfig struct {
	WaitDuration string `json:"wait_duration"`
}

type LatencyConfig

type LatencyConfig struct {
	ThresholdMs           int     `json:"threshold"`
	HttpRoute             string  `json:"http_route"`
	ServiceName           string  `json:"service_name"`
	FallbackSamplingRatio float64 `json:"fallback_sampling_ratio"`
}

func (*LatencyConfig) Validate

func (lc *LatencyConfig) Validate() error

type LatencySamplerHandler

type LatencySamplerHandler struct{}

func (*LatencySamplerHandler) GetActionReference

func (h *LatencySamplerHandler) GetActionReference(action metav1.Object) metav1.OwnerReference

func (*LatencySamplerHandler) GetActionScope

func (h *LatencySamplerHandler) GetActionScope(action metav1.Object) string

func (*LatencySamplerHandler) GetRuleConfig

func (h *LatencySamplerHandler) GetRuleConfig(action metav1.Object) []Rule

func (*LatencySamplerHandler) IsActionDisabled

func (h *LatencySamplerHandler) IsActionDisabled(action metav1.Object) bool

func (*LatencySamplerHandler) List

func (h *LatencySamplerHandler) List(ctx context.Context, c client.Client, namespace string) ([]metav1.Object, error)

func (*LatencySamplerHandler) ValidateRuleConfig

func (h *LatencySamplerHandler) ValidateRuleConfig(config []Rule) error

type Rule

type Rule struct {
	Name     string      `json:"name"`
	RuleType RuleType    `json:"type"`
	Details  RuleDetails `json:"rule_details"`
}

Rule representes a rule in odigossampling processor rule

type RuleDetails

type RuleDetails interface {
	Validate() error
}

type RuleType

type RuleType string
const (
	LatencyRule RuleType = "http_latency"
	ErrorRule   RuleType = "error"
)

type SamplingConfig

type SamplingConfig struct {
	GlobalRules   []Rule `json:"global_rules,omitempty"`
	ServiceRules  []Rule `json:"service_rules,omitempty"`
	EndpointRules []Rule `json:"endpoint_rules,omitempty"`
}

Jump to

Keyboard shortcuts

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