tagger

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const SelectChunksCount = 10

Variables

View Source
var EmptySet = &Set{
	data: make(map[string]bool),
	list: make([]string, 0),
}

Functions

func Make

func Make(cfg *config.Config) error

Types

type Metric

type Metric struct {
	Path        []byte
	Level       int
	ParentIndex int
	Tags        *Set
}

func (*Metric) IsLeaf

func (m *Metric) IsLeaf() uint8

func (*Metric) MarshalJSON

func (m *Metric) MarshalJSON() ([]byte, error)

func (*Metric) ParentPath

func (m *Metric) ParentPath() []byte

type Rule

type Rule struct {
	Single string   `toml:"tag"`
	List   []string `toml:"tags"`

	Equal          string `toml:"equal"`
	HasPrefix      string `toml:"has-prefix"`
	HasSuffix      string `toml:"has-suffix"`
	Contains       string `toml:"contains"`
	Regexp         string `toml:"regexp"`
	BytesEqual     []byte `toml:"-"`
	BytesHasPrefix []byte `toml:"-"`
	BytesHasSuffix []byte `toml:"-"`
	BytesContains  []byte `toml:"-"`
	Tags           *Set   `toml:"-"`
	// contains filtered or unexported fields
}

func (*Rule) Match

func (r *Rule) Match(m *Metric)

type Rules

type Rules struct {
	Rule []Rule `toml:"rule"`
	// contains filtered or unexported fields
}

func Parse

func Parse(content string) (*Rules, error)

func ParseFile

func ParseFile(filename string) (*Rules, error)

func ParseGlob

func ParseGlob(glob string) (*Rules, error)

func (*Rules) Match

func (r *Rules) Match(m *Metric)

type Set

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

set with copy-on-write

func (*Set) Add

func (s *Set) Add(tag ...string) *Set

func (*Set) Len

func (s *Set) Len() int

func (*Set) List

func (s *Set) List() []string

func (*Set) MarshalJSON

func (s *Set) MarshalJSON() ([]byte, error)

func (*Set) Merge

func (s *Set) Merge(other *Set) *Set

type Tree

type Tree struct {
	Next  [256]*Tree
	Rules []*Rule
}

func (*Tree) Add

func (t *Tree) Add(prefix []byte, rule *Rule)

func (*Tree) AddSuffix

func (t *Tree) AddSuffix(suffix []byte, rule *Rule)

Jump to

Keyboard shortcuts

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