control

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProducerTag = "producer"
	ConsumerTag = "consumer"
	RequestTag  = "request"
	ResponseTag = "response"
	DLQTag      = "dlq"
)

if updated, remember to update the exported tags in the public sampler API

Variables

Functions

This section is empty.

Types

type ClientUID

type ClientUID string

type ComputationLocation

type ComputationLocation uint8
const (
	ComputationLocationUnknown ComputationLocation = iota
	ComputationLocationSampler
	ComputationLocationCollector
)

func NewComputationLocationFromString added in v0.2.0

func NewComputationLocationFromString(t string) ComputationLocation

func (ComputationLocation) MarshalYAML added in v0.2.0

func (cl ComputationLocation) MarshalYAML() (interface{}, error)

func (ComputationLocation) String

func (cl ComputationLocation) String() string

func (*ComputationLocation) UnmarshalYAML added in v0.2.0

func (cl *ComputationLocation) UnmarshalYAML(value *yaml.Node) error

type DeterministicSamplingConfig

type DeterministicSamplingConfig struct {
	SampleRate             int32
	SampleEmptyDeterminant bool
}

type Digest

type Digest struct {
	UID                 SamplerDigestUID
	Name                string
	StreamUID           SamplerStreamUID
	FlushPeriod         time.Duration
	BufferSize          int
	ComputationLocation ComputationLocation

	// digest specific config
	Type  DigestType
	St    *DigestSt    `yaml:",omitempty"`
	Value *DigestValue `yaml:",omitempty"`
}

func NewDigestFromProto

func NewDigestFromProto(protoDigest *protos.Digest) Digest

func (Digest) GetName

func (d Digest) GetName() string

func (*Digest) ToProto

func (d *Digest) ToProto() *protos.Digest

type DigestSt

type DigestSt struct {
	MaxProcessedFields int
}

func NewDigestStFromProto

func NewDigestStFromProto(protoDigestSt *protos.Digest_St) *DigestSt

func (*DigestSt) ToProto

func (ds *DigestSt) ToProto() *protos.Digest_St

type DigestType

type DigestType uint8
const (
	DigestTypeUnknown DigestType = iota
	DigestTypeSt
	DigestTypeValue
)

func NewDigestTypeFromString added in v0.2.0

func NewDigestTypeFromString(t string) DigestType

func (DigestType) MarshalYAML added in v0.2.0

func (dt DigestType) MarshalYAML() (interface{}, error)

func (DigestType) String added in v0.2.0

func (dt DigestType) String() string

func (*DigestType) UnmarshalYAML added in v0.2.0

func (dt *DigestType) UnmarshalYAML(value *yaml.Node) error

type DigestUpdate

type DigestUpdate struct {
	Op     DigestUpdateOp
	Digest Digest
}

func NewDigestUpdateFromProto

func NewDigestUpdateFromProto(digestUpdate *protos.ClientDigestUpdate) DigestUpdate

func (*DigestUpdate) IsValid

func (du *DigestUpdate) IsValid() error

func (*DigestUpdate) ToProto

func (du *DigestUpdate) ToProto() *protos.ClientDigestUpdate

type DigestUpdateOp

type DigestUpdateOp int
const (
	DigestUpsert DigestUpdateOp = iota + 1
	DigestDelete
)

type DigestValue

type DigestValue struct {
	MaxProcessedFields int
}

func NewDigestValueFromProto

func NewDigestValueFromProto(protoDigestValue *protos.Digest_Value) *DigestValue

func (*DigestValue) ToProto

func (dv *DigestValue) ToProto() *protos.Digest_Value

type Digests added in v0.2.0

type Digests map[SamplerDigestUID]Digest

func (Digests) MarshalYAML added in v0.2.0

func (d Digests) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface. Digests contains a map, but the data is marshaled into a list.

func (*Digests) UnmarshalYAML added in v0.2.0

func (d *Digests) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface. Digests contains a list, but the data is unmarshaled into a map.

type Event

type Event struct {
	UID            SamplerEventUID
	Name           string
	StreamUID      SamplerStreamUID
	SampleType     SampleType
	Rule           Rule
	Limiter        LimiterConfig
	ExportTemplate string
}

func NewEventFromProto

func NewEventFromProto(protoEvent *protos.Event) Event

func (Event) GetName

func (e Event) GetName() string

func (*Event) ToProto

func (e *Event) ToProto() *protos.Event

type EventUpdate

type EventUpdate struct {
	Op    EventUpdateOp
	Event Event
}

func NewEventUpdateFromProto

func NewEventUpdateFromProto(eventUpdate *protos.ClientEventUpdate) EventUpdate

func (*EventUpdate) IsValid

func (eu *EventUpdate) IsValid() error

func (*EventUpdate) ToProto

func (eu *EventUpdate) ToProto() *protos.ClientEventUpdate

type EventUpdateOp

type EventUpdateOp int
const (
	EventUpsert EventUpdateOp = iota + 1
	EventDelete
)

type Events added in v0.2.0

type Events map[SamplerEventUID]Event

func (Events) MarshalYAML added in v0.2.0

func (d Events) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface. Events contains a map, but the data is marshaled into a list.

func (*Events) UnmarshalYAML added in v0.2.0

func (d *Events) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface. Events contains a list, but the data is unmarshaled into a map.

type LimiterConfig

type LimiterConfig struct {
	Limit int32
}

func NewLimiterFromProto

func NewLimiterFromProto(sr *protos.Limiter) LimiterConfig

func (LimiterConfig) ToProto

func (sr LimiterConfig) ToProto() *protos.Limiter

type Rule

type Rule struct {
	Lang       RuleLang
	Expression string
}

func NewRuleFromProto

func NewRuleFromProto(sr *protos.Rule) Rule

func (Rule) ToProto

func (r Rule) ToProto() *protos.Rule

type RuleLang

type RuleLang int
const (
	SrlUnknown RuleLang = iota
	SrlCel
)

func NewRuleLangFromProto

func NewRuleLangFromProto(lang protos.Rule_Language) RuleLang

func NewRuleLangFromString added in v0.2.0

func NewRuleLangFromString(s string) RuleLang

func (RuleLang) MarshalYAML added in v0.2.0

func (srl RuleLang) MarshalYAML() (interface{}, error)

func (RuleLang) String

func (srl RuleLang) String() string

func (RuleLang) ToProto

func (srl RuleLang) ToProto() protos.Rule_Language

func (*RuleLang) UnmarshalYAML added in v0.2.0

func (srl *RuleLang) UnmarshalYAML(value *yaml.Node) error

type SampleType

type SampleType uint8
const (
	UnknownSampleType SampleType = iota
	RawSampleType
	StructDigestSampleType
	ValueDigestSampleType
	EventSampleType
	ConfigSampleType
)

func NewSampleTypeFromProto

func NewSampleTypeFromProto(sampleType protos.SampleType) SampleType

func ParseSampleType

func ParseSampleType(t string) SampleType

func (SampleType) String

func (s SampleType) String() string

func (SampleType) ToProto

func (s SampleType) ToProto() protos.SampleType

type Sampler

type Sampler struct {
	Name          string
	Resource      string
	Tags          []Tag
	UID           SamplerUID
	Config        SamplerConfig
	SamplingStats SamplerSamplingStats
}

func NewSampler

func NewSampler(name, resource string, uid SamplerUID) *Sampler

func NewSamplerFromProto

func NewSamplerFromProto(sampler *protos.Sampler) *Sampler

func (Sampler) ToProto

func (p Sampler) ToProto() *protos.Sampler

type SamplerConfig

type SamplerConfig struct {
	Streams    Streams
	LimiterIn  *LimiterConfig
	SamplingIn *SamplingConfig
	LimiterOut *LimiterConfig
	Digests    Digests
	Events     Events
}

Used to get and update the sampler configuration.

When sent by the server to update a sampler, only the fields that are present are updated. If a field is present, the previous value is replaced with the new one.

func NewSamplerConfig

func NewSamplerConfig() *SamplerConfig

func NewSamplerConfigFromProto

func NewSamplerConfigFromProto(config *protos.SamplerConfig) SamplerConfig

func (*SamplerConfig) DigestTypesByLocation

func (pc *SamplerConfig) DigestTypesByLocation(location ComputationLocation) []DigestType

func (SamplerConfig) IsEmpty

func (pc SamplerConfig) IsEmpty() bool

func (*SamplerConfig) Merge

func (pc *SamplerConfig) Merge(update SamplerConfigUpdate)

func (SamplerConfig) ToProto

func (pc SamplerConfig) ToProto() *protos.SamplerConfig

type SamplerConfigUpdate

type SamplerConfigUpdate struct {
	// If a field is set to true, it means that the field is reset to its default.
	// If a configuration option is reset and set in the same request, it will be
	// first resetted and then set to its new value.
	Reset SamplerConfigUpdateReset

	// All fields are optional. If a field is nil, it means that the field is not updated.
	StreamUpdates []StreamUpdate
	LimiterIn     *LimiterConfig
	SamplingIn    *SamplingConfig
	LimiterOut    *LimiterConfig
	DigestUpdates []DigestUpdate
	EventUpdates  []EventUpdate
}

func NewSamplerConfigUpdate

func NewSamplerConfigUpdate() SamplerConfigUpdate

func NewSamplerConfigUpdateFromProto

func NewSamplerConfigUpdateFromProto(protoUpdate *protos.ClientSamplerConfigUpdate) SamplerConfigUpdate

func (SamplerConfigUpdate) IsValid

func (scu SamplerConfigUpdate) IsValid() error

func (SamplerConfigUpdate) ToProto

type SamplerConfigUpdateReset

type SamplerConfigUpdateReset struct {
	LimiterIn  bool
	SamplingIn bool
	Streams    bool
	LimiterOut bool
	Digests    bool
	Events     bool
}

func NewSamplerConfigUpdateResetFromProto

func NewSamplerConfigUpdateResetFromProto(protoReset *protos.ClientSamplerConfigUpdate_Reset) SamplerConfigUpdateReset

func (SamplerConfigUpdateReset) ToProto

type SamplerDigestUID

type SamplerDigestUID string

type SamplerEventUID

type SamplerEventUID string

type SamplerSamplingStats

type SamplerSamplingStats struct {
	SamplesEvaluated uint64
	SamplesExported  uint64
	SamplesDigested  uint64
}

func NewSamplerSamplingStatsFromProto

func NewSamplerSamplingStatsFromProto(stats *protos.SamplerSamplingStats) SamplerSamplingStats

func (SamplerSamplingStats) ToProto

type SamplerStreamRuleUID

type SamplerStreamRuleUID string

type SamplerStreamUID

type SamplerStreamUID string

type SamplerUID

type SamplerUID string

type SamplingConfig

type SamplingConfig struct {
	SamplingType          SamplingType
	DeterministicSampling DeterministicSamplingConfig
}

func NewSamplingConfigFromProto

func NewSamplingConfigFromProto(sr *protos.Sampling) SamplingConfig

func (SamplingConfig) ToProto

func (sc SamplingConfig) ToProto() *protos.Sampling

type SamplingType

type SamplingType int
const (
	UnknownSamplingType SamplingType = iota
	DeterministicSamplingType
)

type Stream

type Stream struct {
	UID              SamplerStreamUID
	Name             string
	StreamRule       Rule
	ExportRawSamples bool
}

func NewStreamFromProto

func NewStreamFromProto(s *protos.Stream) Stream

func (Stream) GetName

func (s Stream) GetName() string

func (Stream) ToProto

func (s Stream) ToProto() *protos.Stream

type StreamUpdate

type StreamUpdate struct {
	Op     StreamUpdateOp
	Stream Stream
}

func NewStreamUpdateFromProto

func NewStreamUpdateFromProto(streamUpdate *protos.ClientStreamUpdate) StreamUpdate

func (*StreamUpdate) IsValid

func (su *StreamUpdate) IsValid() error

func (*StreamUpdate) ToProto

func (su *StreamUpdate) ToProto() *protos.ClientStreamUpdate

type StreamUpdateOp

type StreamUpdateOp int
const (
	StreamUpsert StreamUpdateOp = iota + 1
	StreamDelete
)

type Streams added in v0.2.0

type Streams map[SamplerStreamUID]Stream

func (Streams) MarshalYAML added in v0.2.0

func (s Streams) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface. Streams contains a map, but the data is marshaled into a list.

func (*Streams) UnmarshalYAML added in v0.2.0

func (s *Streams) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface. Streams contains a list, but the data is unmarshaled into a map.

type Tag added in v0.3.0

type Tag struct {
	Name  string
	Attrs map[string]string
}

func NewTagFromProto added in v0.3.0

func NewTagFromProto(tag *protos.Sampler_Tag) Tag

func NewTagsFromProto added in v0.3.0

func NewTagsFromProto(protoTags []*protos.Sampler_Tag) []Tag

func (Tag) ToProto added in v0.3.0

func (t Tag) ToProto() *protos.Sampler_Tag

Jump to

Keyboard shortcuts

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