Documentation ¶
Overview ¶
+kubebuilder:validation:Optional
Index ¶
- Constants
- Variables
- func AddAlertsPipeline(cfg *OtelParams, extraProcessors ...string)
- func AddControllerMetricsPipeline(cfg *OtelParams)
- func AddMetricsPipeline(cfg *OtelParams)
- func EnforceExcludeList(attributes pcommon.Map, excludeList map[string]bool)
- func EnforceIncludeList(attributes pcommon.Map, includeList map[string]bool)
- func FormExcludeList(attributes []string) map[string]bool
- func FormIncludeList(attributes []string) map[string]bool
- func GetFloat64(attributes pcommon.Map, key string, treatAsMissing []string) (float64, bool)
- func GetStruct(attributes pcommon.Map, label string, output interface{}, ...) bool
- func IterateDataPoints(metric pmetric.Metric, fn func(pcommon.Map))
- func IterateLogRecords(ld plog.Logs, fn func(plog.LogRecord) IterAction)
- func IterateMetrics(md pmetric.Metrics, fn func(pmetric.Metric))
- func IterateSpans(td ptrace.Traces, fn func(ptrace.Span))
- func Max(a, b float64) float64
- func Min(a, b float64) float64
- func Module() fx.Option
- type BatchAlertsConfig
- type BatchPostrollupConfig
- type BatchPrerollupConfig
- type ConstructorIn
- type FxIn
- type IterAction
- type OTELConfig
- func (o *OTELConfig) AddBatchProcessor(name string, timeout time.Duration, sendBatchSize uint32, ...)
- func (o *OTELConfig) AddDebugExtensions(userCfg *OtelConfig)
- func (o *OTELConfig) AddExporter(name string, value interface{})
- func (o *OTELConfig) AddExtension(name string, value interface{})
- func (o *OTELConfig) AddProcessor(name string, value interface{})
- func (o *OTELConfig) AddReceiver(name string, value interface{})
- func (o *OTELConfig) AsMap() map[string]interface{}
- func (o *OTELConfig) SetDebugPort(userCfg *OtelConfig)
- type OTELConfigUnmarshaller
- type OTELService
- type OtelConfig
- type OtelParams
- type Pipeline
- type PortsConfig
Constants ¶
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" // 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" // ApertureFlowStatusLabel label to denote OK or Error across all protocols. ApertureFlowStatusLabel = "aperture.flow.status" // ApertureFlowStatusOK const for OK status. ApertureFlowStatusOK = "OK" // ApertureFlowStatusError const for error status. ApertureFlowStatusError = "Error" // 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 = "-" // 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" // ProcessorAlertsNamespace adds host info as `namespace` attribute. ProcessorAlertsNamespace = "attributes/alerts" // 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" // ExporterAlerts exports alerts via alertmanager clients. ExporterAlerts = "alerts" // AlertGeneratorURLLabel describes. AlertGeneratorURLLabel = "generator_url" // AlertNameLabel describes name of the alert. AlertNameLabel = "alertname" // AlertSeverityLabel also known as log level. Human readable string. AlertSeverityLabel = "severity" // AlertChannelsLabel is a comma-separated list of channels to which alert is assigned. AlertChannelsLabel = "alert_channels" // IsAlertLabel helps to differentiate normal logs from alert logs. IsAlertLabel = "is_alert" // AlertNamespaceLabel which required by Alertmanager. Set to host name. AlertNamespaceLabel = "namespace" )
Variables ¶
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
EnforceExcludeList enforces the given exclude list on the given attributes.
func EnforceIncludeList ¶ added in v0.1.3
EnforceIncludeList enforces the given include list on the given attributes.
func FormExcludeList ¶ added in v0.1.3
FormExcludeList returns a map of all the keys in the given list with a value of false.
func FormIncludeList ¶ added in v0.1.3
FormIncludeList returns a map of all the keys in the given list with a value of true.
func GetFloat64 ¶ added in v0.1.3
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 ¶
IterateDataPoints calls given function for each metric data point.
func IterateLogRecords ¶
func IterateLogRecords(ld plog.Logs, fn func(plog.LogRecord) IterAction)
IterateLogRecords calls given function for each logRecord.
The callback should return whether a log record should be kept or removed.
func IterateMetrics ¶
IterateMetrics calls given function for each metric.
func IterateSpans ¶
IterateSpans calls given function for each span.
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
func (in *BatchPostrollupConfig) DeepCopy() *BatchPostrollupConfig
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:"10s"` // 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
func (in *BatchPrerollupConfig) DeepCopy() *BatchPrerollupConfig
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 IterAction ¶ added in v0.12.0
type IterAction bool
IterAction describes whether to keep or discard an item processed by an iteration callback.
const ( // Keep means keep this item and continue. Keep IterAction = true // Discard means remove this item and continue. Discard = false )
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 (*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(userCfg *OtelConfig)
AddDebugExtensions adds common debug extensions 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.
func (*OTELConfig) SetDebugPort ¶ added in v0.11.0
func (o *OTELConfig) SetDebugPort(userCfg *OtelConfig)
SetDebugPort configures debug port on which OTEL server /metrics as specified by user.
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 ¶
func (u *OTELConfigUnmarshaller) Retrieve(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error)
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.
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.
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"` // Ports configures debug, health and extension ports values. Ports PortsConfig `json:"ports"` }
OtelConfig is the configuration for the OTEL collector. swagger:model +kubebuilder:object:generate=true
func NewDefaultOtelConfig ¶ added in v0.11.0
func NewDefaultOtelConfig() *OtelConfig
NewDefaultOtelConfig creates OtelConfig with all the default values set.
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 PortsConfig ¶ added in v0.11.0
type PortsConfig struct { // Port on which otel collector exposes prometheus metrics on /metrics path. DebugPort uint32 `json:"debug_port" validate:"gte=0" default:"8888"` // Port on which health check extension in exposed. HealthCheckPort uint32 `json:"health_check_port" validate:"gte=0" default:"13133"` // Port on which pprof extension in exposed. PprofPort uint32 `json:"pprof_port" validate:"gte=0" default:"1777"` // Port on which zpages extension in exposed. ZpagesPort uint32 `json:"zpages_port" validate:"gte=0" default:"55679"` }
PortsConfig defines configuration for OTEL debug and extension ports. swagger:model +kubebuilder:object:generate=true
func (*PortsConfig) DeepCopy ¶ added in v0.11.0
func (in *PortsConfig) DeepCopy() *PortsConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortsConfig.
func (*PortsConfig) DeepCopyInto ¶ added in v0.11.0
func (in *PortsConfig) DeepCopyInto(out *PortsConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.