span

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AttributesFieldName = "attributes"

MatchTypeFieldName is the mapstructure field name for MatchProperties.Attributes field.

View Source
const MatchTypeFieldName = "match_type"

MatchTypeFieldName is the mapstructure field name for MatchProperties.MatchType field.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	// Key specifies the attribute key.
	Key string `mapstructure:"key"`

	// Values specifies the value to match against.
	// If it is not set, any value will match.
	Value interface{} `mapstructure:"value"`
}

Attribute specifies the attribute key and optional value to match against.

type MatchConfig

type MatchConfig struct {
	// Include specifies the set of span properties that must be present in order
	// for this processor to apply to it.
	// Note: If `exclude` is specified, the span is compared against those
	// properties after the `include` properties.
	// This is an optional field. If neither `include` and `exclude` are set, all spans
	// are processed. If `include` is set and `exclude` isn't set, then all
	// spans matching the properties in this structure are processed.
	Include *MatchProperties `mapstructure:"include"`

	// Exclude specifies when this processor will not be applied to the Spans
	// which match the specified properties.
	// Note: The `exclude` properties are checked after the `include` properties,
	// if they exist, are checked.
	// If `include` isn't specified, the `exclude` properties are checked against
	// all spans.
	// This is an optional field. If neither `include` and `exclude` are set, all spans
	// are processed. If `exclude` is set and `include` isn't set, then all
	// spans  that do no match the properties in this structure are processed.
	Exclude *MatchProperties `mapstructure:"exclude"`
}

MatchConfig has two optional MatchProperties one to define what is processed by the processor, captured under the 'include' and the second, exclude, to define what is excluded from the processor.

type MatchProperties

type MatchProperties struct {
	// MatchType controls how items in "services" and "span_names" arrays are
	// interpreted. Possible values are "regexp" or "strict".
	MatchType MatchType `mapstructure:"match_type"`

	// Services specify the list of of items to match service name against.
	// A match occurs if the span's service name matches at least one item in this list.
	// This is an optional field.
	Services []string `mapstructure:"services"`

	// SpanNames specify the list of items to match span name against.
	// A match occurs if the span name matches at least one item in this list.
	// This is an optional field.
	SpanNames []string `mapstructure:"span_names"`

	// Attributes specifies the list of attributes to match against.
	// All of these attributes must match exactly for a match to occur.
	// Only match_type=strict is allowed if "attributes" are specified.
	// This is an optional field.
	Attributes []Attribute `mapstructure:"attributes"`
}

MatchProperties specifies the set of properties in a span to match against and if the span should be included or excluded from the processor. At least one of services, span names or attributes must be specified. It is supported to have all specified, but this requires all of the properties to match for the inclusion/exclusion to occur. The following are examples of invalid configurations:

attributes/bad1:
  # This is invalid because include is specified with neither services or
  # attributes.
  include:
  actions: ...

span/bad2:
  exclude:
  	# This is invalid because services, span_names and attributes have empty values.
    services:
    span_names:
    attributes:
  actions: ...

Please refer to processor/attributesprocessor/testdata/config.yaml and processor/spanprocessor/testdata/config.yaml for valid configurations.

type MatchType

type MatchType string

MatchType defines possible match types.

const (
	MatchTypeRegexp MatchType = "regexp"
	MatchTypeStrict MatchType = "strict"
)

type Matcher

type Matcher interface {
	MatchSpan(span *tracepb.Span, serviceName string) bool
}

TODO: Modify Matcher to invoke both the include and exclude properties so calling processors will always have the same logic. Matcher is an interface that allows matching a span against a configuration of a match.

func NewMatcher

func NewMatcher(config *MatchProperties) (Matcher, error)

Jump to

Keyboard shortcuts

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