Skip to content

Commit b43864b

Browse files
sklclayton-cornell
andauthored
beyla: add meta_cache_address to beyla.ebpf.attributes.kubernetes (#4871)
* beyla: add meta_cache_address to beyla.ebpf.attributes.kubernetes * chore: update changelog * chore: lint --------- Co-authored-by: Clayton Cornell <[email protected]>
1 parent 9756147 commit b43864b

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Main (unreleased)
1919

2020
- update promtail converter to use `file_match` block for `loki.source.file` instead of going through `local.file_match`. (@kalleep)
2121

22+
- Add `meta_cache_address` to `beyla.ebpf` component. (@skl)
23+
2224
### Bugfixes
2325

2426
- `loki.source.api` no longer drops request when relabel rules drops a specific stream. (@kalleep)

docs/sources/reference/components/beyla/beyla.ebpf.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ This `kubernetes` block configures the decorating of the metrics and traces with
146146
| `enable` | `string` | Enable the Kubernetes metadata decoration. | `autodetect` | no |
147147
| `informers_resync_period` | `duration` | Period for Kubernetes informers resynchronization. | `"30m"` | no |
148148
| `informers_sync_timeout` | `duration` | Timeout for Kubernetes informers synchronization. | `"30s"` | no |
149+
| `meta_cache_address` | `string` | Address of the Kubernetes metadata cache service. | `""` | no |
149150
| `meta_restrict_local_node` | `bool` | Restrict Kubernetes metadata collection to local node. | `false` | no |
150151

151152
If `cluster_name` isn't set, Beyla tries to detect the cluster name from the Kubernetes API.

internal/component/beyla/ebpf/args.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type KubernetesDecorator struct {
5151
InformersResyncPeriod time.Duration `alloy:"informers_resync_period,attr,optional"`
5252
DisableInformers []string `alloy:"disable_informers,attr,optional"`
5353
MetaRestrictLocalNode bool `alloy:"meta_restrict_local_node,attr,optional"`
54+
MetaCacheAddress string `alloy:"meta_cache_address,attr,optional"`
5455
}
5556

5657
type InstanceIDConfig struct {

internal/component/beyla/ebpf/beyla_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func (args Attributes) Convert() beyla.Attributes {
153153
attrs.Kubernetes.DisableInformers = args.Kubernetes.DisableInformers
154154
attrs.Kubernetes.MetaRestrictLocalNode = args.Kubernetes.MetaRestrictLocalNode
155155
attrs.Kubernetes.ClusterName = args.Kubernetes.ClusterName
156+
if args.Kubernetes.MetaCacheAddress != "" {
157+
attrs.Kubernetes.MetaCacheAddress = args.Kubernetes.MetaCacheAddress
158+
}
156159
// InstanceID
157160
if args.InstanceID.HostnameDNSResolution {
158161
attrs.InstanceID.HostnameDNSResolution = args.InstanceID.HostnameDNSResolution

internal/component/beyla/ebpf/beyla_linux_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestArguments_UnmarshalSyntax(t *testing.T) {
4848
cluster_name = "test"
4949
disable_informers = ["node"]
5050
meta_restrict_local_node = true
51+
meta_cache_address = "localhost:9090"
5152
}
5253
select {
5354
attr = "sql_client_duration"
@@ -159,6 +160,7 @@ func TestArguments_UnmarshalSyntax(t *testing.T) {
159160
require.Equal(t, "test", cfg.Attributes.Kubernetes.ClusterName)
160161
require.Equal(t, []string{"node"}, cfg.Attributes.Kubernetes.DisableInformers)
161162
require.True(t, cfg.Attributes.Kubernetes.MetaRestrictLocalNode)
163+
require.Equal(t, "localhost:9090", cfg.Attributes.Kubernetes.MetaCacheAddress)
162164
require.Len(t, cfg.Attributes.Select, 1)
163165
sel, ok := cfg.Attributes.Select["sql_client_duration"]
164166
require.True(t, ok)
@@ -701,6 +703,7 @@ func TestConvert_Attributes(t *testing.T) {
701703
Kubernetes: KubernetesDecorator{
702704
Enable: "true",
703705
InformersSyncTimeout: 15 * time.Second,
706+
MetaCacheAddress: "localhost:9090",
704707
},
705708
Select: Selections{
706709
{
@@ -720,6 +723,7 @@ func TestConvert_Attributes(t *testing.T) {
720723
InformersSyncTimeout: 15 * time.Second,
721724
InformersResyncPeriod: 30 * time.Minute,
722725
ResourceLabels: beyla.DefaultConfig.Attributes.Kubernetes.ResourceLabels,
726+
MetaCacheAddress: "localhost:9090",
723727
},
724728
HostID: beyla.HostIDConfig{
725729
FetchTimeout: 500 * time.Millisecond,

0 commit comments

Comments
 (0)