otelcollector

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ControlPointLabel describes control point which reported traffic.
	// May be 'ingress', 'egress' or 'feature'.
	ControlPointLabel = "control_point"
	// ControlPointIngress const for ingress control point.
	ControlPointIngress = "ingress"
	// ControlPointEgress const for egress control point.
	ControlPointEgress = "egress"
	// ControlPointFeature const for feature control point.
	ControlPointFeature = "feature"

	// MarshalledAuthzResponseLabel contains JSON encoded response from authz.
	MarshalledAuthzResponseLabel = "aperture.authz_response"

	// AuthzStatusLabel describes the status reported from authz processing.
	AuthzStatusLabel = "authz_status"

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

	// MissingAttributeSourceValue is a special attribute value, which can
	// happen when (eg. Envoy's) logger tries to send attribute value, but its
	// source is missing. 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 "{}".
	MissingAttributeSourceValue = "-"

	// MarshalledLabelsLabel describes labels relevant to this traffic.
	// This is JSON encoded field:
	// {
	//   "foo": "bar",
	//   "fizz": "buzz"
	// }.
	MarshalledLabelsLabel = "aperture.labels"
	// LabeledLabel describes if there are any labels matched to traffic.
	LabeledLabel = "labeled"
	// StatusCodeLabel describes HTTP status code of the response.
	StatusCodeLabel = "http.status_code"
	// DurationLabel describes duration of the HTTP request in milliseconds.
	DurationLabel = "duration_millis"
	// 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"
	// DecisionTypeLabel describes the decision type taken by policy.
	DecisionTypeLabel = "decision_type"
	// DecisionErrorReasonLabel describes the error reason of the decision taken by policy.
	DecisionErrorReasonLabel = "decision_error_reason"
	// DecisionRejectReasonLabel describes the reject reason of the decision taken by policy.
	DecisionRejectReasonLabel = "decision_reject_reason"
	// RateLimitersLabel describes rate limiters matched to the traffic.
	RateLimitersLabel = "rate_limiters"
	// DroppingRateLimitersLabel describes rate limiters dropping the traffic.
	DroppingRateLimitersLabel = "dropping_rate_limiters"
	// ConcurrencyLimitersLabel describes rate limiters matched to the traffic.
	ConcurrencyLimitersLabel = "concurrency_limiters"
	// DroppingConcurrencyLimitersLabel describes rate limiters dropping the traffic.
	DroppingConcurrencyLimitersLabel = "dropping_concurrency_limiters"
	// WorkloadsLabel describes workloads matched to the traffic.
	WorkloadsLabel = "workloads"
	// DroppingWorkloadsLabel describes workloads dropping the traffic.
	DroppingWorkloadsLabel = "dropping_workloads"
	// FluxMetersLabel describes flux meters matched to the traffic.
	FluxMetersLabel = "flux_meters"
	// FlowLabelKeysLabel describes keys of flow labels matched to the traffic.
	FlowLabelKeysLabel = "flow_label_keys"
	// ClassifiersLabel describes classifiers matched to the traffic.
	ClassifiersLabel = "classifiers"
	// HostAddressLabel describes host address of the request.
	HostAddressLabel = "net.host.address"
	// PeerAddressLabel describes peer address of the request.
	PeerAddressLabel = "net.peer.address"
	// HostIPLabel describes host IP address of the request.
	HostIPLabel = "net.host.ip"
	// PeerIPLabel describes peer IP address of the request.
	PeerIPLabel = "net.peer.ip"
	// FeatureAddressLabel describes feature address of the request.
	FeatureAddressLabel = "feature.ip"
	// FeatureIDLabel describes the ID of the feature.
	FeatureIDLabel = "feature.id"
	// FeatureStatusLabel describes the status of the feature.
	FeatureStatusLabel = "feature.status"
	// EntityNameLabel describes entity name e.g. pod name.
	EntityNameLabel = "entity_name"
	// TimestampLabel describes timestamp of the request.
	TimestampLabel = "timestamp"
	// AgentGroupLabel describes cluster to which metrics refer.
	AgentGroupLabel = "agent_group"
	// ServicesLabel describes services to which metrics refer.
	ServicesLabel = "services"
)

Variables

This section is empty.

Functions

func GetAuthzResponse

func GetAuthzResponse(attributes pcommon.Map) *flowcontrolv1.AuthzResponse

GetAuthzResponse unmarshalls authz response from string label.

func GetCheckResponse

func GetCheckResponse(attributes pcommon.Map) *flowcontrolv1.CheckResponse

GetCheckResponse unmarshalls flowcontrol CheckResponse from string label.

func Invoke

func Invoke(in ConstructorIn) (*service.Collector, error)

Invoke creates and runs a new instance of OTEL Collector with the passed configuration.

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 Module

func Module() fx.Option

Module is a fx module that invokes OTEL Collector.

func UnmarshalStringVal

func UnmarshalStringVal(value pcommon.Value, labelName string, output interface{}) bool

UnmarshalStringVal is a helper for cases we're sending more complex structure json-encoded in a string label

Returns whether label was actually a string and unmarshaling was attempted.

Types

type ConstructorIn

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

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.

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