logqlabels

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package logqlabels contains LogQL label utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedLabels

type AggregatedLabels interface {
	// By returns new set of labels containing only given list of labels.
	By(...logql.Label) AggregatedLabels
	// Without returns new set of labels without given list of labels.
	Without(...logql.Label) AggregatedLabels
	// Key computes grouping key from set of labels.
	Key() GroupingKey
	// Replace replaces labels using given regexp.
	Replace(dstLabel, replacement, srcLabel string, re *regexp.Regexp) AggregatedLabels

	// AsLokiAPI returns API structure for label set.
	AsLokiAPI() lokiapi.LabelSet
}

AggregatedLabels is a set of labels.

func AggregatedLabelsFromMap

func AggregatedLabelsFromMap(m map[string]string) AggregatedLabels

AggregatedLabelsFromMap creates new AggregatedLabels from label map.

func AggregatedLabelsFromSet

func AggregatedLabelsFromSet(set LabelSet, by, without map[string]struct{}) AggregatedLabels

AggregatedLabelsFromSet creates new AggregatedLabels from LabelSet.

func EmptyAggregatedLabels

func EmptyAggregatedLabels() AggregatedLabels

EmptyAggregatedLabels returns empty set of aggregated labels.

type GroupingKey

type GroupingKey = uint64

GroupingKey is a key to group metrics by label.

type LabelSet

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

LabelSet is a log record's label set.

func NewLabelSet

func NewLabelSet() LabelSet

NewLabelSet creates new LabelSet.

func (*LabelSet) AllowDots

func (l *LabelSet) AllowDots() bool

AllowDots whether if dots in labels are allowed.

func (*LabelSet) AppendString added in v0.13.0

func (l *LabelSet) AppendString(buf []byte) []byte

AppendString appends text representation of labels.

func (*LabelSet) AsLokiAPI

func (l *LabelSet) AsLokiAPI() lokiapi.LabelSet

AsLokiAPI returns lokiapi.LabelSet

func (*LabelSet) AsMap

func (l *LabelSet) AsMap() map[string]string

AsMap returns labels as strings map.

func (*LabelSet) Delete

func (l *LabelSet) Delete(s logql.Label)

Delete deletes label.

func (*LabelSet) Get

func (l *LabelSet) Get(name logql.Label) (v pcommon.Value, ok bool)

Get returns attr value.

func (*LabelSet) GetError

func (l *LabelSet) GetError() (string, bool)

GetError returns error label.

func (*LabelSet) GetFloat

func (l *LabelSet) GetFloat(name logql.Label) (_ float64, ok bool, err error)

GetFloat returns number attr value.

func (*LabelSet) GetString

func (l *LabelSet) GetString(name logql.Label) (string, bool)

GetString returns stringified attr value.

func (*LabelSet) Len

func (l *LabelSet) Len() int

Len returns set length

func (*LabelSet) Range

func (l *LabelSet) Range(cb func(logql.Label, pcommon.Value))

Range iterates over label set.

func (*LabelSet) Reset

func (l *LabelSet) Reset()

Reset resets internal state of LabelSet.

func (*LabelSet) Set

func (l *LabelSet) Set(s logql.Label, val pcommon.Value)

Set sets label.

func (*LabelSet) SetAttrs

func (l *LabelSet) SetAttrs(attrMaps ...otelstorage.Attrs)

SetAttrs sets labels from attrs.

func (*LabelSet) SetError

func (l *LabelSet) SetError(typ string, err error)

SetError sets special error label.

func (*LabelSet) SetFromRecord

func (l *LabelSet) SetFromRecord(record logstorage.Record)

SetFromRecord sets labels from given log record.

func (*LabelSet) String

func (l *LabelSet) String() string

String returns text representation of labels.

Jump to

Keyboard shortcuts

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