From def558b11c7e0dae9b03f9562880440e750634cb Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Tue, 18 Nov 2025 13:57:12 +0000 Subject: [PATCH 1/3] beyla: add meta_cache_address to beyla.ebpf.attributes.kubernetes --- docs/sources/reference/components/beyla/beyla.ebpf.md | 1 + internal/component/beyla/ebpf/args.go | 1 + internal/component/beyla/ebpf/beyla_linux.go | 3 +++ internal/component/beyla/ebpf/beyla_linux_test.go | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/docs/sources/reference/components/beyla/beyla.ebpf.md b/docs/sources/reference/components/beyla/beyla.ebpf.md index 1cd1ec237ac..e17a0bb934b 100644 --- a/docs/sources/reference/components/beyla/beyla.ebpf.md +++ b/docs/sources/reference/components/beyla/beyla.ebpf.md @@ -146,6 +146,7 @@ This `kubernetes` block configures the decorating of the metrics and traces with | `enable` | `string` | Enable the Kubernetes metadata decoration. | `autodetect` | no | | `informers_resync_period` | `duration` | Period for Kubernetes informers resynchronization. | `"30m"` | no | | `informers_sync_timeout` | `duration` | Timeout for Kubernetes informers synchronization. | `"30s"` | no | +| `meta_cache_address` | `string` | Address of the Kubernetes metadata cache service. | `""` | no | | `meta_restrict_local_node` | `bool` | Restrict Kubernetes metadata collection to local node. | `false` | no | If `cluster_name` isn't set, Beyla tries to detect the cluster name from the Kubernetes API. diff --git a/internal/component/beyla/ebpf/args.go b/internal/component/beyla/ebpf/args.go index a9c9063376a..1f508bd78d8 100644 --- a/internal/component/beyla/ebpf/args.go +++ b/internal/component/beyla/ebpf/args.go @@ -51,6 +51,7 @@ type KubernetesDecorator struct { InformersResyncPeriod time.Duration `alloy:"informers_resync_period,attr,optional"` DisableInformers []string `alloy:"disable_informers,attr,optional"` MetaRestrictLocalNode bool `alloy:"meta_restrict_local_node,attr,optional"` + MetaCacheAddress string `alloy:"meta_cache_address,attr,optional"` } type InstanceIDConfig struct { diff --git a/internal/component/beyla/ebpf/beyla_linux.go b/internal/component/beyla/ebpf/beyla_linux.go index f9f660c7100..34752c6f1ae 100644 --- a/internal/component/beyla/ebpf/beyla_linux.go +++ b/internal/component/beyla/ebpf/beyla_linux.go @@ -153,6 +153,9 @@ func (args Attributes) Convert() beyla.Attributes { attrs.Kubernetes.DisableInformers = args.Kubernetes.DisableInformers attrs.Kubernetes.MetaRestrictLocalNode = args.Kubernetes.MetaRestrictLocalNode attrs.Kubernetes.ClusterName = args.Kubernetes.ClusterName + if args.Kubernetes.MetaCacheAddress != "" { + attrs.Kubernetes.MetaCacheAddress = args.Kubernetes.MetaCacheAddress + } // InstanceID if args.InstanceID.HostnameDNSResolution { attrs.InstanceID.HostnameDNSResolution = args.InstanceID.HostnameDNSResolution diff --git a/internal/component/beyla/ebpf/beyla_linux_test.go b/internal/component/beyla/ebpf/beyla_linux_test.go index 1ecc021250c..2fae5408ea3 100644 --- a/internal/component/beyla/ebpf/beyla_linux_test.go +++ b/internal/component/beyla/ebpf/beyla_linux_test.go @@ -48,6 +48,7 @@ func TestArguments_UnmarshalSyntax(t *testing.T) { cluster_name = "test" disable_informers = ["node"] meta_restrict_local_node = true + meta_cache_address = "localhost:9090" } select { attr = "sql_client_duration" @@ -159,6 +160,7 @@ func TestArguments_UnmarshalSyntax(t *testing.T) { require.Equal(t, "test", cfg.Attributes.Kubernetes.ClusterName) require.Equal(t, []string{"node"}, cfg.Attributes.Kubernetes.DisableInformers) require.True(t, cfg.Attributes.Kubernetes.MetaRestrictLocalNode) + require.Equal(t, "localhost:9090", cfg.Attributes.Kubernetes.MetaCacheAddress) require.Len(t, cfg.Attributes.Select, 1) sel, ok := cfg.Attributes.Select["sql_client_duration"] require.True(t, ok) @@ -701,6 +703,7 @@ func TestConvert_Attributes(t *testing.T) { Kubernetes: KubernetesDecorator{ Enable: "true", InformersSyncTimeout: 15 * time.Second, + MetaCacheAddress: "localhost:9090", }, Select: Selections{ { @@ -720,6 +723,7 @@ func TestConvert_Attributes(t *testing.T) { InformersSyncTimeout: 15 * time.Second, InformersResyncPeriod: 30 * time.Minute, ResourceLabels: beyla.DefaultConfig.Attributes.Kubernetes.ResourceLabels, + MetaCacheAddress: "localhost:9090", }, HostID: beyla.HostIDConfig{ FetchTimeout: 500 * time.Millisecond, From 50da1d440ee4410e2d0273cd972d8f8305d01f48 Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Tue, 18 Nov 2025 14:02:54 +0000 Subject: [PATCH 2/3] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f24a497b08..d4d6c9951c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ Main (unreleased) - update promtail converter to use `file_match` block for `loki.source.file` instead of going through `local.file_match`. (@kalleep) +- Add `meta_cache_address` to `beyla.ebpf` component. (@skl) + ### Bugfixes - `loki.source.api` no longer drops request when relabel rules drops a specific stream. (@kalleep) From 576c5dfb34f3ff4545f9677afc8bc4b45a8e8a90 Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Thu, 20 Nov 2025 15:58:45 +0000 Subject: [PATCH 3/3] chore: lint --- internal/component/beyla/ebpf/beyla_linux_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/component/beyla/ebpf/beyla_linux_test.go b/internal/component/beyla/ebpf/beyla_linux_test.go index 2fae5408ea3..2d2c06c1195 100644 --- a/internal/component/beyla/ebpf/beyla_linux_test.go +++ b/internal/component/beyla/ebpf/beyla_linux_test.go @@ -723,7 +723,7 @@ func TestConvert_Attributes(t *testing.T) { InformersSyncTimeout: 15 * time.Second, InformersResyncPeriod: 30 * time.Minute, ResourceLabels: beyla.DefaultConfig.Attributes.Kubernetes.ResourceLabels, - MetaCacheAddress: "localhost:9090", + MetaCacheAddress: "localhost:9090", }, HostID: beyla.HostIDConfig{ FetchTimeout: 500 * time.Millisecond,