otelcollector

package
v0.10.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

+kubebuilder:validation:Optional

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"

	// ResponseReceivedLabel designates whether a response was received.
	ResponseReceivedLabel = "response_received"
	// ResponseReceivedTrue const for true value.
	ResponseReceivedTrue = "true"
	// ResponseReceivedFalse const for false value.
	ResponseReceivedFalse = "false"

	// 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 concurrency limiters matched to the traffic.
	ApertureConcurrencyLimitersLabel = "aperture.concurrency_limiters"
	// ApertureDroppingConcurrencyLimitersLabel describes concurrency 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"
	// ApertureClassifierErrorsLabel describes encountered classifier errors for specified policy.
	ApertureClassifierErrorsLabel = "aperture.classifier_errors"
	// ApertureResponseStatusLabel label to denote OK or Error across all protocols.
	ApertureResponseStatusLabel = "aperture.response_status"
	// ApertureResponseStatusOK OK response across all protocols.
	ApertureResponseStatusOK = ApertureFeatureStatusOK
	// ApertureResponseStatusError Error response across all protocols.
	ApertureResponseStatusError = ApertureFeatureStatusError

	// 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"
	// ApertureFeatureStatusOK const for OK status.
	ApertureFeatureStatusOK = "OK"
	// ApertureFeatureStatusError const for error status.
	ApertureFeatureStatusError = "Error"
	// 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"
	// InstanceLabel describes agent group to which metrics refer.
	InstanceLabel = "instance"

	// ReceiverOTLP collects logs from libraries and SDKs.
	ReceiverOTLP = "otlp"
	// ReceiverPrometheus collects metrics from environment and services.
	ReceiverPrometheus = "prometheus"
	// ReceiverAlerts collects alerts from alerter.
	ReceiverAlerts = "alerts"

	// ProcessorEnrichment enriches metrics with discovery data.
	ProcessorEnrichment = "enrichment"
	// ProcessorMetrics generates metrics based on logs and exposes them
	// on application prometheus metrics endpoint.
	ProcessorMetrics = "metrics"
	// ProcessorBatchPrerollup batches incoming data before rolling up. This is
	// required, as rollup processor can only roll up data inside a single batch.
	ProcessorBatchPrerollup = "batch/prerollup"
	// ProcessorBatchPostrollup batches data after rolling up, as roll up process
	// shrinks number of data points significantly.
	ProcessorBatchPostrollup = "batch/postrollup"
	// ProcessorBatchAlerts batches alerts before passing them to exporters.
	// This reduces number of calls to the Alertmanager.
	ProcessorBatchAlerts = "batch/alerts"
	// ProcessorRollup rolls up data to decrease cardinality.
	ProcessorRollup = "rollup"
	// ProcessorAgentGroup adds `agent_group` attribute.
	ProcessorAgentGroup = "attributes/agent_group"
	// ProcessorAgentResourceLabels adds `instance` and `agent_group` resource attributes.
	ProcessorAgentResourceLabels = "transform/agent_resource_labels"
	// ProcessorTracesToLogs converts received tracess to logs and passes them to configured
	// log exporter.
	ProcessorTracesToLogs = "tracestologs"

	// ExporterLogging exports telemetry using Aperture logger.
	ExporterLogging = "logging"
	// ExporterPrometheusRemoteWrite exports metrics to local prometheus instance.
	ExporterPrometheusRemoteWrite = "prometheusremotewrite"
	// ExporterOTLPLoopback exports OTLP data to local OTLP receiver. To be used only
	// with ProcessorSpanToLog.
	ExporterOTLPLoopback = "otlp/loopback"

	// AlertGeneratorURLLabel describes.
	AlertGeneratorURLLabel = "generator_url"
	// AlertNameLabel describes name of the alert.
	AlertNameLabel = "alertname"
	// AlertSeverityLabel also known as log level. Human readable string.
	AlertSeverityLabel = "severity"
)

Variables

View Source
var BaseFxTag = config.NameTag("base")

BaseFxTag is the base name tag for otel components.

Functions

func AddAlertsPipeline added in v0.10.0

func AddAlertsPipeline(cfg *OtelParams, extraProcessors ...string)

AddAlertsPipeline adds reusable alerts pipeline.

func AddControllerMetricsPipeline added in v0.4.0

func AddControllerMetricsPipeline(cfg *OtelParams)

AddControllerMetricsPipeline adds metrics to pipeline for controller OTEL collector.

func AddMetricsPipeline added in v0.4.0

func AddMetricsPipeline(cfg *OtelParams)

AddMetricsPipeline adds metrics to pipeline for agent OTEL collector.

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, treatAsMissing []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 string.

The attribute can be encoded as either: * JSON. * base64'd protobuf wire format, if `output` is `proto.Message`.

Takes: attributes to read from label key to read in attributes output interface that is filled via json/proto 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 BatchAlertsConfig added in v0.10.0

type BatchAlertsConfig struct {
	// Timeout sets the time after which a batch will be sent regardless of size.
	Timeout config.Duration `json:"timeout" validate:"gt=0" default:"1s"`

	// SendBatchSize is the size of a batch which after hit, will trigger it to be sent.
	SendBatchSize uint32 `json:"send_batch_size" validate:"gt=0" default:"100"`

	// SendBatchMaxSize is the upper limit of the batch size. Bigger batches will be split
	// into smaller units.
	SendBatchMaxSize uint32 `json:"send_batch_max_size" validate:"gte=0" default:"100"`
}

BatchAlertsConfig defines configuration for OTEL batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchAlertsConfig) DeepCopy added in v0.10.0

func (in *BatchAlertsConfig) DeepCopy() *BatchAlertsConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchAlertsConfig.

func (*BatchAlertsConfig) DeepCopyInto added in v0.10.0

func (in *BatchAlertsConfig) DeepCopyInto(out *BatchAlertsConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BatchPostrollupConfig added in v0.6.1

type BatchPostrollupConfig struct {
	// Timeout sets the time after which a batch will be sent regardless of size.
	Timeout config.Duration `json:"timeout" validate:"gt=0" default:"1s"`

	// SendBatchSize is the size of a batch which after hit, will trigger it to be sent.
	SendBatchSize uint32 `json:"send_batch_size" validate:"gt=0" default:"100"`

	// SendBatchMaxSize is the upper limit of the batch size. Bigger batches will be split
	// into smaller units.
	SendBatchMaxSize uint32 `json:"send_batch_max_size" validate:"gte=0" default:"100"`
}

BatchPostrollupConfig defines configuration for OTEL batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchPostrollupConfig) DeepCopy added in v0.6.1

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchPostrollupConfig.

func (*BatchPostrollupConfig) DeepCopyInto added in v0.6.1

func (in *BatchPostrollupConfig) DeepCopyInto(out *BatchPostrollupConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BatchPrerollupConfig added in v0.6.1

type BatchPrerollupConfig struct {
	// Timeout sets the time after which a batch will be sent regardless of size.
	Timeout config.Duration `json:"timeout" validate:"gt=0" default:"1s"`

	// SendBatchSize is the size of a batch which after hit, will trigger it to be sent.
	SendBatchSize uint32 `json:"send_batch_size" validate:"gt=0" default:"10000"`

	// SendBatchMaxSize is the upper limit of the batch size. Bigger batches will be split
	// into smaller units.
	SendBatchMaxSize uint32 `json:"send_batch_max_size" validate:"gte=0" default:"10000"`
}

BatchPrerollupConfig defines configuration for OTEL batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchPrerollupConfig) DeepCopy added in v0.6.1

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchPrerollupConfig.

func (*BatchPrerollupConfig) DeepCopyInto added in v0.6.1

func (in *BatchPrerollupConfig) DeepCopyInto(out *BatchPrerollupConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

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 FxIn added in v0.4.0

type FxIn struct {
	fx.In
	Unmarshaller    config.Unmarshaller
	Listener        *listener.Listener
	PromClient      promapi.Client
	TLSConfig       *tls.Config
	ServerTLSConfig tlsconfig.ServerTLSConfig
}

FxIn consumes parameters via Fx.

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,
	sendBatchMaxSize 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 OtelConfig added in v0.4.0

type OtelConfig struct {
	// BatchPrerollup configures batch prerollup processor.
	BatchPrerollup BatchPrerollupConfig `json:"batch_prerollup"`
	// BatchPostrollup configures batch postrollup processor.
	BatchPostrollup BatchPostrollupConfig `json:"batch_postrollup"`
	// BatchAlerts configures batch alerts processor.
	BatchAlerts BatchAlertsConfig `json:"batch_alerts"`
}

OtelConfig is the configuration for the OTEL collector. swagger:model +kubebuilder:object:generate=true

func (*OtelConfig) DeepCopy added in v0.4.0

func (in *OtelConfig) DeepCopy() *OtelConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OtelConfig.

func (*OtelConfig) DeepCopyInto added in v0.4.0

func (in *OtelConfig) DeepCopyInto(out *OtelConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OtelParams added in v0.4.0

type OtelParams struct {
	Config   *OTELConfig
	Listener *listener.Listener

	OtelConfig
	// contains filtered or unexported fields
}

OtelParams contains parameters for otel collector factories for agent and controller.

func NewOtelConfig added in v0.4.0

func NewOtelConfig(in FxIn) (*OtelParams, error)

NewOtelConfig returns OTEL parameters for OTEL collectors.

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.

Jump to

Keyboard shortcuts

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