Skip to content

Commit a9afe80

Browse files
authored
Update OBI and fix moved packages (#2237)
* Handle new obi/pkg/traces visibility changes * handle changes in network, traces and ebpf packages * update .obi-src
1 parent 12095c6 commit a9afe80

File tree

126 files changed

+361
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+361
-587
lines changed

.obi-src

Submodule .obi-src updated 175 files

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
go.opentelemetry.io/collector/exporter/otlpexporter v0.136.0
3535
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.136.0
3636
go.opentelemetry.io/collector/pdata v1.42.0
37-
go.opentelemetry.io/obi v0.0.0-20251007070432-e1a412f8b605
37+
go.opentelemetry.io/obi v0.0.0-20251009145850-a086ec09ef1b
3838
go.opentelemetry.io/otel v1.38.0
3939
go.opentelemetry.io/otel/sdk v1.38.0
4040
go.opentelemetry.io/otel/sdk/metric v1.38.0

pkg/beyla/config.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
otelconsumer "go.opentelemetry.io/collector/consumer"
1111
"gopkg.in/yaml.v3"
1212

13-
"go.opentelemetry.io/obi/pkg/components/ebpf/tcmanager"
1413
"go.opentelemetry.io/obi/pkg/components/imetrics"
1514
"go.opentelemetry.io/obi/pkg/components/kube"
16-
"go.opentelemetry.io/obi/pkg/components/traces"
15+
obicfg "go.opentelemetry.io/obi/pkg/config"
16+
"go.opentelemetry.io/obi/pkg/ebpf/tcmanager"
1717
"go.opentelemetry.io/obi/pkg/export/attributes"
1818
attr "go.opentelemetry.io/obi/pkg/export/attributes/names"
1919
"go.opentelemetry.io/obi/pkg/export/debug"
@@ -53,18 +53,18 @@ var DefaultConfig = Config{
5353
LogLevel: "INFO",
5454
ShutdownTimeout: 10 * time.Second,
5555
EnforceSysCaps: false,
56-
EBPF: config.EBPFTracer{
56+
EBPF: obicfg.EBPFTracer{
5757
BatchLength: 100,
5858
BatchTimeout: time.Second,
5959
HTTPRequestTimeout: 0,
60-
TCBackend: tcmanager.TCBackendAuto,
60+
TCBackend: obicfg.TCBackendAuto,
6161
ContextPropagationEnabled: false,
62-
ContextPropagation: config.ContextPropagationDisabled,
63-
RedisDBCache: config.RedisDBCacheConfig{
62+
ContextPropagation: obicfg.ContextPropagationDisabled,
63+
RedisDBCache: obicfg.RedisDBCacheConfig{
6464
Enabled: false,
6565
MaxSize: 1000,
6666
},
67-
BufferSizes: config.EBPFBufferSizes{
67+
BufferSizes: obicfg.EBPFBufferSizes{
6868
HTTP: 0,
6969
MySQL: 0,
7070
Postgres: 0,
@@ -128,7 +128,7 @@ var DefaultConfig = Config{
128128
BpfMetricScrapeInterval: 15 * time.Second,
129129
},
130130
Attributes: Attributes{
131-
InstanceID: traces.InstanceIDConfig{
131+
InstanceID: obicfg.InstanceIDConfig{
132132
HostnameDNSResolution: true,
133133
},
134134
Kubernetes: transform.KubernetesDecorator{
@@ -149,7 +149,7 @@ var DefaultConfig = Config{
149149
Unmatch: transform.UnmatchDefault,
150150
WildcardChar: "*",
151151
},
152-
NetworkFlows: defaultNetworkConfig,
152+
NetworkFlows: obi.DefaultNetworkConfig,
153153
Processes: process.CollectConfig{
154154
RunMode: process.RunModePrivileged,
155155
Interval: 5 * time.Second,
@@ -168,10 +168,10 @@ var DefaultConfig = Config{
168168
}
169169

170170
type Config struct {
171-
EBPF config.EBPFTracer `yaml:"ebpf"`
171+
EBPF obicfg.EBPFTracer `yaml:"ebpf"`
172172

173173
// NetworkFlows configuration for Network Observability feature
174-
NetworkFlows NetworkConfig `yaml:"network"`
174+
NetworkFlows obi.NetworkConfig `yaml:"network"`
175175

176176
// Grafana overrides some values of the otel.MetricsConfig and otel.TracesConfig below
177177
// for a simpler submission of OTEL metrics to Grafana Cloud
@@ -278,7 +278,7 @@ func (t TracesReceiverConfig) Enabled() bool {
278278
// added to each span
279279
type Attributes struct {
280280
Kubernetes transform.KubernetesDecorator `yaml:"kubernetes"`
281-
InstanceID traces.InstanceIDConfig `yaml:"instance_id"`
281+
InstanceID obicfg.InstanceIDConfig `yaml:"instance_id"`
282282
Select attributes.Selection `yaml:"select"`
283283
HostID HostIDConfig `yaml:"host_id"`
284284
ExtraGroupAttributes map[string][]attr.Name `yaml:"extra_group_attributes"`
@@ -334,7 +334,7 @@ func (c *Config) Validate() error {
334334

335335
// nolint:staticcheck
336336
// remove after deleting ContextPropagationEnabled
337-
if c.EBPF.ContextPropagationEnabled && c.EBPF.ContextPropagation != config.ContextPropagationDisabled {
337+
if c.EBPF.ContextPropagationEnabled && c.EBPF.ContextPropagation != obicfg.ContextPropagationDisabled {
338338
return ConfigError("context_propagation_enabled and context_propagation are mutually exclusive")
339339
}
340340

@@ -344,7 +344,7 @@ func (c *Config) Validate() error {
344344
if c.EBPF.ContextPropagationEnabled {
345345
slog.Warn("DEPRECATION NOTICE: 'context_propagation_enabled' configuration option has been " +
346346
"deprecated and will be removed in the future - use 'context_propagation' instead")
347-
c.EBPF.ContextPropagation = config.ContextPropagationAll
347+
c.EBPF.ContextPropagation = obicfg.ContextPropagationAll
348348
}
349349

350350
if c.willUseTC() {
@@ -409,10 +409,10 @@ func (c *Config) otelNetO11yEnabled() bool {
409409
func (c *Config) willUseTC() bool {
410410
// nolint:staticcheck
411411
// remove after deleting ContextPropagationEnabled
412-
return c.EBPF.ContextPropagation == config.ContextPropagationAll ||
413-
c.EBPF.ContextPropagation == config.ContextPropagationIPOptionsOnly ||
412+
return c.EBPF.ContextPropagation == obicfg.ContextPropagationAll ||
413+
c.EBPF.ContextPropagation == obicfg.ContextPropagationIPOptionsOnly ||
414414
c.EBPF.ContextPropagationEnabled ||
415-
(c.Enabled(FeatureNetO11y) && c.NetworkFlows.Source == EbpfSourceTC)
415+
(c.Enabled(FeatureNetO11y) && c.NetworkFlows.Source == obi.EbpfSourceTC)
416416
}
417417

418418
// Enabled checks if a given Beyla feature is enabled according to the global configuration

pkg/beyla/config_test.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,21 @@ import (
1515
"github.com/stretchr/testify/assert"
1616
"github.com/stretchr/testify/require"
1717

18-
"go.opentelemetry.io/obi/pkg/components/ebpf/tcmanager"
1918
"go.opentelemetry.io/obi/pkg/components/imetrics"
2019
"go.opentelemetry.io/obi/pkg/components/kube"
21-
"go.opentelemetry.io/obi/pkg/components/netolly/transform/cidr"
22-
"go.opentelemetry.io/obi/pkg/components/traces"
20+
obiconfig "go.opentelemetry.io/obi/pkg/config"
2321
"go.opentelemetry.io/obi/pkg/export/attributes"
2422
attr "go.opentelemetry.io/obi/pkg/export/attributes/names"
2523
"go.opentelemetry.io/obi/pkg/export/debug"
2624
"go.opentelemetry.io/obi/pkg/export/instrumentations"
2725
"go.opentelemetry.io/obi/pkg/export/otel/otelcfg"
2826
"go.opentelemetry.io/obi/pkg/export/prom"
2927
"go.opentelemetry.io/obi/pkg/kubeflags"
28+
"go.opentelemetry.io/obi/pkg/netolly/cidr"
3029
"go.opentelemetry.io/obi/pkg/obi"
3130
"go.opentelemetry.io/obi/pkg/services"
3231
"go.opentelemetry.io/obi/pkg/transform"
3332

34-
"github.com/grafana/beyla/v2/pkg/config"
3533
"github.com/grafana/beyla/v2/pkg/export/otel"
3634
"github.com/grafana/beyla/v2/pkg/internal/infraolly/process"
3735
servicesextra "github.com/grafana/beyla/v2/pkg/services"
@@ -110,7 +108,7 @@ network:
110108
assert.False(t, cfg.Port.Matches(8078))
111109
assert.False(t, cfg.Port.Matches(8098))
112110

113-
nc := defaultNetworkConfig
111+
nc := obi.DefaultNetworkConfig
114112
nc.Enable = true
115113
nc.AgentIP = "1.2.3.4"
116114
nc.CIDRs = cidr.Definitions{"10.244.0.0/16"}
@@ -131,18 +129,18 @@ network:
131129
ShutdownTimeout: 30 * time.Second,
132130
EnforceSysCaps: false,
133131
TracePrinter: "json",
134-
EBPF: config.EBPFTracer{
132+
EBPF: obiconfig.EBPFTracer{
135133
BatchLength: 100,
136134
BatchTimeout: time.Second,
137135
HTTPRequestTimeout: 0,
138-
TCBackend: tcmanager.TCBackendAuto,
136+
TCBackend: obiconfig.TCBackendAuto,
139137
ContextPropagationEnabled: false,
140-
ContextPropagation: config.ContextPropagationDisabled,
141-
RedisDBCache: config.RedisDBCacheConfig{
138+
ContextPropagation: obiconfig.ContextPropagationDisabled,
139+
RedisDBCache: obiconfig.RedisDBCacheConfig{
142140
Enabled: false,
143141
MaxSize: 1000,
144142
},
145-
BufferSizes: config.EBPFBufferSizes{
143+
BufferSizes: obiconfig.EBPFBufferSizes{
146144
HTTP: 0,
147145
MySQL: 0,
148146
Postgres: 0,
@@ -209,7 +207,7 @@ network:
209207
BpfMetricScrapeInterval: 15 * time.Second,
210208
},
211209
Attributes: Attributes{
212-
InstanceID: traces.InstanceIDConfig{
210+
InstanceID: obiconfig.InstanceIDConfig{
213211
HostnameDNSResolution: true,
214212
},
215213
Kubernetes: transform.KubernetesDecorator{
@@ -517,7 +515,7 @@ time=\S+ level=DEBUG msg=debug arg=debug$`),
517515
debugMode: true,
518516
expectedCfg: Config{
519517
TracePrinter: debug.TracePrinterText,
520-
EBPF: config.EBPFTracer{BpfDebug: true, ProtocolDebug: true},
518+
EBPF: obiconfig.EBPFTracer{BpfDebug: true, ProtocolDebug: true},
521519
},
522520
}, {
523521
name: "debug log with network flows",
@@ -531,12 +529,12 @@ time=\S+ level=DEBUG msg=debug arg=debug$`),
531529
debugMode: true,
532530
expectedCfg: Config{
533531
TracePrinter: debug.TracePrinterText,
534-
EBPF: config.EBPFTracer{BpfDebug: true, ProtocolDebug: true},
535-
NetworkFlows: NetworkConfig{Enable: true, Print: true},
532+
EBPF: obiconfig.EBPFTracer{BpfDebug: true, ProtocolDebug: true},
533+
NetworkFlows: obi.NetworkConfig{Enable: true, Print: true},
536534
},
537535
}} {
538536
t.Run(tc.name, func(t *testing.T) {
539-
cfg := Config{NetworkFlows: NetworkConfig{Enable: tc.networkEnable}}
537+
cfg := Config{NetworkFlows: obi.NetworkConfig{Enable: tc.networkEnable}}
540538
out := &bytes.Buffer{}
541539
cfg.ExternalLogger(tc.handler(out), tc.debugMode)
542540
slog.Info("information", "arg", "info")

pkg/beyla/network_cfg.go

Lines changed: 0 additions & 145 deletions
This file was deleted.

pkg/components/beyla.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515
"go.opentelemetry.io/obi/pkg/components/connector"
1616
"go.opentelemetry.io/obi/pkg/components/imetrics"
1717
"go.opentelemetry.io/obi/pkg/components/kube"
18-
"go.opentelemetry.io/obi/pkg/components/netolly/agent"
19-
"go.opentelemetry.io/obi/pkg/components/netolly/flow"
2018
"go.opentelemetry.io/obi/pkg/components/pipe/global"
2119
"go.opentelemetry.io/obi/pkg/export/attributes"
2220
obiotel "go.opentelemetry.io/obi/pkg/export/otel"
2321
"go.opentelemetry.io/obi/pkg/export/otel/otelcfg"
22+
"go.opentelemetry.io/obi/pkg/netolly/agent"
23+
"go.opentelemetry.io/obi/pkg/netolly/flowdef"
2424
"go.opentelemetry.io/obi/pkg/pipe/msg"
2525

2626
"github.com/grafana/beyla/v2/pkg/beyla"
@@ -233,7 +233,7 @@ func attributeGroups(config *beyla.Config, ctxInfo *global.ContextInfo) {
233233
if config.Routes != nil {
234234
ctxInfo.MetricAttributeGroups.Add(attributes.GroupHTTPRoutes)
235235
}
236-
if config.NetworkFlows.Deduper == flow.DeduperNone {
236+
if config.NetworkFlows.Deduper == flowdef.DeduperNone {
237237
ctxInfo.MetricAttributeGroups.Add(attributes.GroupNetIfaceDirection)
238238
}
239239
if config.NetworkFlows.CIDRs.Enabled() {

0 commit comments

Comments
 (0)