otelcollector

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ApertureSourceLabel is the label used to identify the flow control integration.
	ApertureSourceLabel = "aperture.source"
	// ApertureSourceSDK const for SDK source.
	ApertureSourceSDK = "sdk"
	// ApertureSourceEnvoy const for Envoy source.
	ApertureSourceEnvoy = "envoy"

	// ApertureCheckResponseLabel contains JSON encoded check response struct.
	ApertureCheckResponseLabel = "aperture.check_response"

	// ApertureServicesLabel describes services to which metrics refer.
	ApertureServicesLabel = "aperture.services"
	// ApertureControlPointLabel describes control point to which metrics refer.
	ApertureControlPointLabel = "aperture.control_point"
	// WorkloadDurationLabel describes duration of the workload in milliseconds.
	WorkloadDurationLabel = "workload_duration_ms"
	// FlowDurationLabel describes duration of the flow in milliseconds.
	FlowDurationLabel = "flow_duration_ms"
	// ApertureProcessingDurationLabel describes Aperture's processing duration in milliseconds.
	ApertureProcessingDurationLabel = "aperture_processing_duration_ms"

	// ApertureDecisionTypeLabel describes the decision type taken by policy.
	ApertureDecisionTypeLabel = "aperture.decision_type"
	// ApertureErrorLabel describes the error reason of the decision taken by policy.
	ApertureErrorLabel = "aperture.error"
	// ApertureRejectReasonLabel describes the reject reason of the decision taken by policy.
	ApertureRejectReasonLabel = "aperture.reject_reason"
	// ApertureRateLimitersLabel describes rate limiters matched to the traffic.
	ApertureRateLimitersLabel = "aperture.rate_limiters"
	// ApertureDroppingRateLimitersLabel describes rate limiters dropping the traffic.
	ApertureDroppingRateLimitersLabel = "aperture.dropping_rate_limiters"
	// ApertureConcurrencyLimitersLabel describes rate limiters matched to the traffic.
	ApertureConcurrencyLimitersLabel = "aperture.concurrency_limiters"
	// ApertureDroppingConcurrencyLimitersLabel describes rate limiters dropping the traffic.
	ApertureDroppingConcurrencyLimitersLabel = "aperture.dropping_concurrency_limiters"
	// ApertureWorkloadsLabel describes workloads matched to the traffic.
	ApertureWorkloadsLabel = "aperture.workloads"
	// ApertureDroppingWorkloadsLabel describes workloads dropping the traffic.
	ApertureDroppingWorkloadsLabel = "aperture.dropping_workloads"
	// ApertureFluxMetersLabel describes flux meters matched to the traffic.
	ApertureFluxMetersLabel = "aperture.flux_meters"
	// ApertureFlowLabelKeysLabel describes keys of flow labels matched to the traffic.
	ApertureFlowLabelKeysLabel = "aperture.flow_label_keys"
	// ApertureClassifiersLabel describes classifiers matched to the traffic.
	ApertureClassifiersLabel = "aperture.classifiers"

	// HTTPStatusCodeLabel describes HTTP status code of the response.
	HTTPStatusCodeLabel = "http.status_code"
	// HTTPRequestContentLength describes length of the HTTP request content in bytes.
	HTTPRequestContentLength = "http.request_content_length"
	// HTTPResponseContentLength describes length of the HTTP response content in bytes.
	HTTPResponseContentLength = "http.response_content_length"

	// EnvoyAuthzDurationLabel describes duration of the Authz call in milliseconds.
	EnvoyAuthzDurationLabel = "authz_duration"
	// EnvoyResponseDurationLabel from envoy access logs.
	EnvoyResponseDurationLabel = "RESPONSE_DURATION"
	// EnvoyBytesReceivedLabel from envoy access logs.
	EnvoyBytesReceivedLabel = "BYTES_RECEIVED"
	// EnvoyBytesSentLabel from envoy access logs.
	EnvoyBytesSentLabel = "BYTES_SENT"

	// EnvoyMissingAttributeValue is a special attribute value, which can
	// happen when (eg. Envoy's) logger tries to send attribute value, but it
	// is not available. Eg. In case authz couldn't reach agent, so we know
	// nothing about flowcontrol policies.  Note that this is different case
	// from "just empty", eg. "", "[]" or "{}".
	EnvoyMissingAttributeValue = "-"

	// ApertureFeatureStatusLabel describes the status of the feature.
	ApertureFeatureStatusLabel = "aperture.feature.status"
	// ApertureFlowStartTimestampLabel is the start timestamp of the flow.
	ApertureFlowStartTimestampLabel = "aperture.flow_start_timestamp"
	// ApertureFlowEndTimestampLabel is the end timestamp of the flow.
	ApertureFlowEndTimestampLabel = "aperture.flow_end_timestamp"
	// ApertureWorkloadStartTimestampLabel is the start timestamp of the workload.
	ApertureWorkloadStartTimestampLabel = "aperture.workload_start_timestamp"

	// EntityNameLabel describes entity name e.g. pod name.
	EntityNameLabel = "entity_name"

	// AgentGroupLabel describes agent group to which metrics refer.
	AgentGroupLabel = "agent_group"
)

Variables

RollupTypes contains all available rollup types.

Functions

func EnforceExcludeList added in v0.1.3

func EnforceExcludeList(attributes pcommon.Map, excludeList map[string]bool)

EnforceExcludeList enforces the given exclude list on the given attributes.

func EnforceIncludeList added in v0.1.3

func EnforceIncludeList(attributes pcommon.Map, includeList map[string]bool)

EnforceIncludeList enforces the given include list on the given attributes.

func FormExcludeList added in v0.1.3

func FormExcludeList(attributes []string) map[string]bool

FormExcludeList returns a map of all the keys in the given list with a value of false.

func FormIncludeList added in v0.1.3

func FormIncludeList(attributes []string) map[string]bool

FormIncludeList returns a map of all the keys in the given list with a value of true.

func GetFloat64 added in v0.1.3

func GetFloat64(attributes pcommon.Map, key string, treatAsZero []string) (float64, bool)

GetFloat64 returns float64 value from given attribute map at given key.

func GetStruct added in v0.1.3

func GetStruct(attributes pcommon.Map, label string, output interface{}, treatAsMissing []string) bool

GetStruct is a helper for decoding complex structs encoded into an attribute as a json-encoded string. Takes: attributes to read from label key to read in attributes output interface that is filled via json unmarshal treatAsMissing is a list of values that are treated as attribute missing from source

Returns true is label was decoded successfully, false otherwise.

func IterateDataPoints

func IterateDataPoints(metric pmetric.Metric, fn func(pcommon.Map) error) error

IterateDataPoints calls given function for each metric data point. If the function returns error further data point will not be processed and the error will be returned.

func IterateLogRecords

func IterateLogRecords(ld plog.Logs, fn func(plog.LogRecord) error) error

IterateLogRecords calls given function for each logRecord. If the function returns error further logRecords will not be processed and the error will be returned.

func IterateMetrics

func IterateMetrics(md pmetric.Metrics, fn func(pmetric.Metric) error) error

IterateMetrics calls given function for each metric. If the function returns error further metric will not be processed and the error will be returned.

func IterateSpans

func IterateSpans(td ptrace.Traces, fn func(ptrace.Span) error) error

IterateSpans calls given function for each span. If the function returns error further span will not be processed and the error will be returned.

func Max added in v0.1.3

func Max(a, b float64) float64

Max returns the maximum value of the given values.

func Min added in v0.1.3

func Min(a, b float64) float64

Min returns the minimum value of the given values.

func Module

func Module() fx.Option

Module is a fx module that invokes OTEL Collector.

Types

type ConstructorIn

type ConstructorIn struct {
	fx.In
	Factories     component.Factories
	Lifecycle     fx.Lifecycle
	Shutdowner    fx.Shutdowner
	Unmarshaller  config.Unmarshaller
	BaseConfig    *OTELConfig `name:"base"`
	Logger        *log.Logger
	PluginConfigs []*OTELConfig `group:"plugin-config"`
}

ConstructorIn describes parameters passed to create OTEL Collector, server providing the OpenTelemetry Collector service.

type OTELConfig

type OTELConfig struct {
	Extensions map[string]interface{} `json:"extensions,omitempty"`
	Receivers  map[string]interface{} `json:"receivers,omitempty"`
	Processors map[string]interface{} `json:"processors,omitempty"`
	Exporters  map[string]interface{} `json:"exporters,omitempty"`
	Service    *OTELService           `json:"service"`
}

OTELConfig represents OTEL Collector configuration.

func NewOTELConfig

func NewOTELConfig() *OTELConfig

NewOTELConfig creates new empty OTELConfig.

func (*OTELConfig) AddBatchProcessor

func (o *OTELConfig) AddBatchProcessor(name string, timeout time.Duration, sendBatchSize uint32)

AddBatchProcessor is a helper function for adding batch processor.

func (*OTELConfig) AddDebugExtensions

func (o *OTELConfig) AddDebugExtensions()

AddDebugExtensions adds common debug extextions and enables them.

func (*OTELConfig) AddExporter

func (o *OTELConfig) AddExporter(name string, value interface{})

AddExporter adds receiver to OTEL config.

func (*OTELConfig) AddExtension

func (o *OTELConfig) AddExtension(name string, value interface{})

AddExtension adds given extension and enables it in service.

func (*OTELConfig) AddProcessor

func (o *OTELConfig) AddProcessor(name string, value interface{})

AddProcessor adds receiver to OTEL config.

func (*OTELConfig) AddReceiver

func (o *OTELConfig) AddReceiver(name string, value interface{})

AddReceiver adds receiver to OTEL config.

func (*OTELConfig) AsMap

func (o *OTELConfig) AsMap() map[string]interface{}

AsMap returns map representation of OTELConfig.

type OTELConfigUnmarshaller

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

OTELConfigUnmarshaller can be used as an OTEL config map provider.

func NewOTELConfigUnmarshaler

func NewOTELConfigUnmarshaler(config map[string]interface{}) *OTELConfigUnmarshaller

NewOTELConfigUnmarshaler creates a new OTELConfigUnmarshaler instance.

func (*OTELConfigUnmarshaller) Retrieve

Retrieve returns the value to be injected in the configuration and the corresponding watcher.

func (*OTELConfigUnmarshaller) Scheme

func (u *OTELConfigUnmarshaller) Scheme() string

Scheme returns the scheme name, location scheme used by Retrieve.

func (*OTELConfigUnmarshaller) Shutdown

func (u *OTELConfigUnmarshaller) Shutdown(ctx context.Context) error

Shutdown indicates the provider should close.

type OTELService

type OTELService struct {
	Telemetry  map[string]interface{}
	Pipelines  map[string]Pipeline
	Extensions []string
}

OTELService represents service in OTEL Config.

func NewOTELService

func NewOTELService() *OTELService

NewOTELService returns new empty OTEL Service.

func (*OTELService) AddPipeline

func (o *OTELService) AddPipeline(name string, pipeline Pipeline)

AddPipeline adds pipeline to OTEL Service.

func (*OTELService) AsMap

func (o *OTELService) AsMap() map[string]interface{}

AsMap returns map representation of OTELService.

func (*OTELService) Pipeline

func (o *OTELService) Pipeline(name string) (Pipeline, bool)

Pipeline gets pipeline with given name from OTEL Service together with `exists` bool.

type Pipeline

type Pipeline struct {
	Receivers  []string
	Processors []string
	Exporters  []string
}

Pipeline represents OTEL Config pipeline.

func (*Pipeline) AsMap

func (p *Pipeline) AsMap() map[string]interface{}

AsMap returns map representation of Pipeline.

type Rollup added in v0.1.3

type Rollup struct {
	FromField   string     `mapstructure:"from"`
	ToField     string     `mapstructure:"to"`
	Type        RollupType `mapstructure:"type"`
	TreatAsZero []string   `mapstructure:"treat_as_zero"`
}

Rollup represents single rollup operation. It describes Type of operation to be done on all `FromField`s from logs/traces. Result of operation is stored in `ToField`.

func (*Rollup) GetFromFieldValue added in v0.1.3

func (rollup *Rollup) GetFromFieldValue(attributes pcommon.Map) (float64, bool)

GetFromFieldValue returns value of `FromField` from attributes as float64.

func (*Rollup) GetToFieldValue added in v0.1.3

func (rollup *Rollup) GetToFieldValue(attributes pcommon.Map) (float64, bool)

GetToFieldValue returns value of `ToField` from attributes as float64.

type RollupType added in v0.1.3

type RollupType string

RollupType represents rollup type available in the processor.

const (
	// RollupSum rolls up fields by adding them.
	RollupSum RollupType = "sum"
	// RollupMax rolls up fields by getting max value of them.
	RollupMax RollupType = "max"
	// RollupMin rolls up fields by getting min value of them.
	RollupMin RollupType = "min"
	// RollupSumOfSquares rolls up fields by summing squares of them.
	RollupSumOfSquares RollupType = "sumOfSquares"
	// RollupDatasketch rolls up fields by creating datasketch from them.
	RollupDatasketch RollupType = "datasketch"
)

Directories

Path Synopsis
Package loggingexporter exports data to console as logs.
Package loggingexporter exports data to console as logs.

Jump to

Keyboard shortcuts

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