sampler

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpressionMatcher

type ExpressionMatcher interface {
	// Evaluate compare property value with evaluator criteria and
	// return if it found a match
	Evaluate(event interface{}) bool
}

ExpressionMatcher is an interface every evaluator must implement

type IncludeSampleMatchFn

type IncludeSampleMatchFn func(sample interface{}) bool

IncludeSampleMatchFn func that returns whether an event/sample should be included, it satisfies the metrics matcher (processor.MatcherChain) interface.

func NewSampleMatchFn

func NewSampleMatchFn(enableProcessMetrics *bool, includeMetricsMatchers config.IncludeMetricsMap, ffRetriever feature_flags.Retriever) IncludeSampleMatchFn

NewSampleMatchFn creates new includeSampleMatchFn func, enableProcessMetrics might be nil when value was not set.

type MatcherChain

type MatcherChain struct {
	Matchers map[string][]ExpressionMatcher
	Enabled  bool
}

MatcherChain is a chain of evaluators An evaluator chain stores for each attribute an array of evaluators Each evaluator represent a single rule that evaluates against the attribute Usually each attribute will have a single evaluator. For example: - process.name

  • "test"

- process.executable

  • "/bin/test"
  • regex "^/opt/newrelic/"

will create an evaluator chain with 2 entries. The first one will have 1 evaluator. The second 2 evaluators

func NewMatcherChain

func NewMatcherChain(expressions config.IncludeMetricsMap) MatcherChain

NewMatcherChain creates a new chain of matchers. Each expression will generate an matcher that gets added to the chain While the chain will be matched for each "sample", it terminates as soon as 1 match is matched (result = true)

func (MatcherChain) Evaluate

func (ec MatcherChain) Evaluate(event interface{}) bool

Evaluate returns the result of compare an event with a chain of matching rules return:

  • true, if event match with evaluator criteria chain
  • false, if event do not match with evaluator criteria chain

If there is no matchers will return true.

type Sampler

type Sampler interface {
	Sample() (sample.EventBatch, error)
	OnStartup()
	Name() string
	Interval() time.Duration
	Disabled() bool
}

type SamplerRoutine

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

func StartSamplerRoutine

func StartSamplerRoutine(sampler Sampler, sampleQueue chan sample.EventBatch) *SamplerRoutine

func (*SamplerRoutine) Stop

func (sr *SamplerRoutine) Stop()

Jump to

Keyboard shortcuts

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