transform

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Overview

Package transform provides some intermediate nodes that might filter/process/transform the events

Index

Constants

View Source
const (
	EventCreated = PodEventType(iota)
	EventDeleted
	EventInstanceDeleted
)
View Source
const (
	ResolverDNS = maps.Bits(1 << iota)
	ResolverK8s
	ResolverRDNS
)
View Source
const (
	// UnmatchUnset leaves the Route field as empty
	UnmatchUnset = UnmatchType("unset")
	// UnmatchPath sets the Route field to the same values as the Path
	UnmatchPath = UnmatchType("path")
	// UnmatchWildcard sets the route field to a generic asterisk symbol
	UnmatchWildcard = UnmatchType("wildcard")
	// UnmatchHeuristic detects the route field using a heuristic
	UnmatchHeuristic = UnmatchType("heuristic")
	// UnmatchLowCardinality uses the same classifier as the Heuristic, but
	// it also has a second level Trie based cache to cap the max cardinality
	UnmatchLowCardinality = UnmatchType("low-cardinality")

	UnmatchDefault = UnmatchHeuristic
)
View Source
const (
	// IgnoreMetrics prevents sending metric events for ignored patterns
	IgnoreMetrics = IgnoreMode("metrics")
	// IgnoreTraces prevents sending trace events for ignored patterns
	IgnoreTraces = IgnoreMode("traces")
	// IgnoreAll prevents sending both metrics and traces for ignored patterns
	IgnoreAll = IgnoreMode("all")

	IgnoreDefault = IgnoreAll
)

Variables

This section is empty.

Functions

func AppendKubeMetadata

func AppendKubeMetadata(db *kube.Store, svc *svc.Attrs, meta *ikube.CachedObjMeta, clusterName, containerName string)

AppendKubeMetadata populates some metadata values in the passed svc.Attrs. This method should be invoked by any entity willing to follow a common policy for setting metadata attributes. For example this metadataDecorator or the survey informer

func KubeClusterName

func KubeClusterName(ctx context.Context, cfg *KubernetesDecorator, k8sInformer *kube.MetadataProvider) string

func KubeDecoratorProvider

func KubeDecoratorProvider(
	ctxInfo *global.ContextInfo,
	cfg *KubernetesDecorator,
	input, output *msg.Queue[[]request.Span],
) swarm.InstanceFunc

func KubeProcessEventDecoratorProvider

func KubeProcessEventDecoratorProvider(
	ctxInfo *global.ContextInfo,
	cfg *KubernetesDecorator,
	input, output *msg.Queue[exec.ProcessEvent],
) swarm.InstanceFunc

func NameResolutionProvider

func NameResolutionProvider(ctxInfo *global.ContextInfo, cfg *NameResolverConfig,
	input, output *msg.Queue[[]request.Span],
) swarm.InstanceFunc

func OwnerLabelName

func OwnerLabelName(kind string) attr.Name

func RoutesProvider

func RoutesProvider(rc *RoutesConfig, input, output *msg.Queue[[]request.Span]) swarm.InstanceFunc

func SpanNameLimiter

func SpanNameLimiter(cfg SpanNameLimiterConfig, input, output *msg.Queue[[]request.Span]) swarm.InstanceFunc

SpanNameLimiter applies only to metrics. If span metrics are enabled and metric_span_names_limit > 0, it renames all the span.name attributes when the cardinality of that attribute for a given, alive service exceeds max_span_names.

Types

type Event

type Event[T any] struct {
	Type PodEventType
	Obj  T
}

type IgnoreMode

type IgnoreMode string

type KubernetesDecorator

type KubernetesDecorator struct {
	Enable kubeflags.EnableFlag `yaml:"enable" env:"OTEL_EBPF_KUBE_METADATA_ENABLE"`

	// ClusterName overrides cluster name. If empty, the NetO11y module will try to retrieve
	// it from the Cloud Provider Metadata (EC2, GCP and Azure), and leave it empty if it fails to.
	ClusterName string `yaml:"cluster_name" env:"OTEL_EBPF_KUBE_CLUSTER_NAME"`

	// KubeconfigPath is optional. If unset, it will look in the usual location.
	KubeconfigPath string `yaml:"kubeconfig_path" env:"KUBECONFIG"`

	InformersSyncTimeout time.Duration `yaml:"informers_sync_timeout" env:"OTEL_EBPF_KUBE_INFORMERS_SYNC_TIMEOUT"`

	// InformersResyncPeriod defaults to 30m. Higher values will reduce the load on the Kube API.
	InformersResyncPeriod time.Duration `yaml:"informers_resync_period" env:"OTEL_EBPF_KUBE_INFORMERS_RESYNC_PERIOD"`

	// DropExternal will drop, in NetO11y component, any flow where the source or destination
	// IPs are not matched to any kubernetes entity, assuming they are cluster-external
	DropExternal bool `yaml:"drop_external" env:"OTEL_EBPF_NETWORK_DROP_EXTERNAL"`

	// DisableInformers allows selectively disabling some informers. Accepted value is a list
	// that might contain node or service. Disabling any of them
	// will cause metadata to be incomplete but will reduce the load of the Kube API.
	// Pods informer can't be disabled. For that purpose, you should disable the whole
	// kubernetes metadata decoration.
	DisableInformers []string `yaml:"disable_informers" env:"OTEL_EBPF_KUBE_DISABLE_INFORMERS"`

	// MetaCacheAddress is the host:port address of the beyla-k8s-cache service instance
	MetaCacheAddress string `yaml:"meta_cache_address" env:"OTEL_EBPF_KUBE_META_CACHE_ADDRESS"`

	// MetaRestrictLocalNode will download only the metadata from the Pods that are located in the same
	// node as the Beyla instance. It will also restrict the Node information to the local node.
	MetaRestrictLocalNode bool `yaml:"meta_restrict_local_node" env:"OTEL_EBPF_KUBE_META_RESTRICT_LOCAL_NODE"`

	// MetaSourceLabels allows Beyla overriding the service name and namespace of an application from
	// the given labels.
	// Deprecated: kept for backwards-compatibility with Beyla 1.9
	MetaSourceLabels kube.MetaSourceLabels `yaml:"meta_source_labels"`

	// ResourceLabels allows Beyla overriding the OTEL Resource attributes from a map of user-defined labels.
	ResourceLabels kube.ResourceLabels `yaml:"resource_labels"`

	// ServiceNameTemplate allows to override the service.name with a custom value. Uses the go template language.
	ServiceNameTemplate string `yaml:"service_name_template" env:"OTEL_EBPF_SERVICE_NAME_TEMPLATE"`
}

type NameResolver

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

type NameResolverConfig

type NameResolverConfig struct {
	// Sources for name resolving. Accepted values: dns, k8s, rdns
	Sources []Source `yaml:"sources" env:"OTEL_EBPF_NAME_RESOLVER_SOURCES" envSeparator:"," envDefault:"k8s"`
	// CacheLen specifies the max size of the LRU cache that is checked before
	// performing the name lookup. Default: 256
	CacheLen int `yaml:"cache_len" env:"OTEL_EBPF_NAME_RESOLVER_CACHE_LEN"`
	// CacheTTL specifies the time-to-live of a cached IP->hostname entry. After the
	// cached entry becomes older than this time, the IP->hostname entry will be looked
	// up again.
	CacheTTL time.Duration `yaml:"cache_expiry" env:"OTEL_EBPF_NAME_RESOLVER_CACHE_TTL"`
}

type PodEventType

type PodEventType int

type RoutesConfig

type RoutesConfig struct {
	// Unmatch specifies what to do when a route pattern is not matched
	Unmatch UnmatchType `yaml:"unmatched"`
	// Patterns of the paths that will match to a route
	Patterns []string `yaml:"patterns"`
	// Deprecated. To be removed and replaced by a collector-like filtering mechanism
	IgnorePatterns []string `yaml:"ignored_patterns"`
	// Deprecated. To be removed and replaced by a collector-like filtering mechanism
	IgnoredEvents IgnoreMode `yaml:"ignore_mode"`
	// Character that will be used to replace route segments
	WildcardChar string `yaml:"wildcard_char,omitempty"`
	// Max allowed path segment cardinality (per service) for the heuristic matcher
	MaxPathSegmentCardinality int `yaml:"max_path_segment_cardinality"`
}

RoutesConfig allows grouping URLs sharing a given pattern.

type Source added in v0.4.0

type Source string
const (
	SourceDNS        Source = "dns"
	SourceK8s        Source = "k8s"
	SourceKube       Source = "kube"
	SourceKubernetes Source = "kubernetes"
	SourceRDNS       Source = "rdns"
)

type SpanNameLimiterConfig

type SpanNameLimiterConfig struct {
	Limit      int
	MetricsCfg *perapp.MetricsConfig
	OTEL       *otelcfg.MetricsConfig
	Prom       *prom.PrometheusConfig
}

type UnmatchType

type UnmatchType string

UnmatchType defines which actions to do when a route pattern is not recognized

Jump to

Keyboard shortcuts

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