Documentation
¶
Index ¶
- Constants
- func MatchNsToFilter(ns string, filter string) (bool, error)
- func SplitNamespace(s string) ([]string, string, error)
- type Namespace
- type Node
- type TreeConstraints
- type TreeStrategy
- type TreeValidator
- func (tv *TreeValidator) AddRule(ns string) error
- func (tv *TreeValidator) AllowAddingUndefinedMetrics()
- func (tv *TreeValidator) AllowValuesAtAnyNamespaceLevel()
- func (tv *TreeValidator) IsPartiallyValid(ns string) bool
- func (tv *TreeValidator) IsUsableForAddition(ns string, isFilter bool) error
- func (tv *TreeValidator) IsValid(ns string) (bool, []string)
- func (tv *TreeValidator) ListRules() []string
Constants ¶
const (
DefaultNsSeparator = "/"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func ParseNamespace ¶
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 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