metrictree

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNsSeparator = "/"
)

Variables

This section is empty.

Functions

func MatchNsToFilter

func MatchNsToFilter(ns string, filter string) (bool, error)

func SplitNamespace

func SplitNamespace(s string) ([]string, string, error)

Types

type Namespace

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

func ParseNamespace

func ParseNamespace(s string, isFilter bool) (*Namespace, error)

Parsing whole selector (ie. "/plugin/[group={reg}]/group2/metric1) into smaller elements

func (*Namespace) IsUsableForAddition

func (ns *Namespace) IsUsableForAddition(tc TreeConstraints, metricDefinitionPresent bool, allowAnyMatch bool) bool

Check if namespace selector can be used for metric addition (ctx.AddMetric) or metric calculation reasonableness (ctx.ShouldProcess) First and last element should be static names, middle elements can be group with defined value (ie. [group=id])

metricDefinitionPresent - In case plugin doesn't provide metric definition, added elements should be only static names. allowAnyMatch - When true, using '*' is allowed (ie. ctx.ShouldProcess("/plugin/group/*/*/metric1")

func (*Namespace) IsUsableForDefinition

func (ns *Namespace) IsUsableForDefinition(tc TreeConstraints) bool

Check is namespace selector can be used for metric definition First and last element should be static names, middle elements can be group (ie. [group])

func (*Namespace) IsUsableForFiltering

func (ns *Namespace) IsUsableForFiltering(_ TreeConstraints, metricDefinitionPresent bool) bool

Check if namespace selector can be used for metric filters !! Note: If metric definition is not provided in plugin, matcher with dynamic element can't be used in filter (to avoid ambiguity)

type Node

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

type TreeConstraints added in v2.1.0

type TreeConstraints int

type TreeStrategy

type TreeStrategy int

type TreeValidator

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

func NewMetricDefinition

func NewMetricDefinition() *TreeValidator

func NewMetricFilter

func NewMetricFilter(definitionTree *TreeValidator) *TreeValidator

func (*TreeValidator) AddRule

func (tv *TreeValidator) AddRule(ns string) error

func (*TreeValidator) AllowAddingUndefinedMetrics added in v2.1.0

func (tv *TreeValidator) AllowAddingUndefinedMetrics()

func (*TreeValidator) AllowValuesAtAnyNamespaceLevel added in v2.1.0

func (tv *TreeValidator) AllowValuesAtAnyNamespaceLevel()

func (*TreeValidator) IsPartiallyValid

func (tv *TreeValidator) IsPartiallyValid(ns string) bool

IsPartiallyValid does a partial metric validation in metricFilteringStrategy is used by ctx.ShouldProcess to provide quick-return optimization in collecting metrics routine(s)

func (*TreeValidator) IsUsableForAddition added in v2.1.0

func (tv *TreeValidator) IsUsableForAddition(ns string, isFilter bool) error

func (*TreeValidator) IsValid

func (tv *TreeValidator) IsValid(ns string) (bool, []string)

IsValid does full metric validation in metricFilteringStrategy tests metric eligibility for adding, is called by ctx.AddMetric

func (*TreeValidator) ListRules

func (tv *TreeValidator) ListRules() []string

Jump to

Keyboard shortcuts

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