Skip to content

Commit 93a6365

Browse files
authored
Add metric missing features and remove unneeded validations (#4094)
1 parent 8165dc9 commit 93a6365

File tree

4 files changed

+17
-25
lines changed

4 files changed

+17
-25
lines changed

CHANGELOG.md

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

5454
- `pyroscope.java` now supports configuring the `log_level` and `quiet` flags on async-profiler. (@deltamualpha)
5555

56+
- Add `application_host` and `network_inter_zone` features to `beyla.ebpf` component. (@marctc)
57+
5658
### Bugfixes
5759

5860
- Fix issues with propagating cluster peers change notifications to components configured with remotecfg. (@dehaansa)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,9 @@ The `metrics` block configures which metrics Beyla collects.
417417
* `application_process` exports metrics about the processes that run the instrumented application.
418418
* `application_service_graph` exports application-level service graph metrics.
419419
* `application_span` exports application-level metrics in traces span metrics format.
420+
* `application_host` exports application-level host metrics for host-based pricing.
420421
* `network` exports network-level metrics.
422+
* `network_inter_zone` exports network-level inter-zone metrics.
421423

422424
`instrumentations` is a list of instrumentations to enable for the metrics. The following instrumentations are available:
423425

internal/component/beyla/ebpf/beyla_linux.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (args Metrics) hasNetworkFeature() bool {
329329
func (args Metrics) hasAppFeature() bool {
330330
for _, feature := range args.Features {
331331
switch feature {
332-
case "application", "application_span", "application_service_graph", "application_process":
332+
case "application", "application_host", "application_span", "application_service_graph", "application_process":
333333
return true
334334
}
335335
}
@@ -347,9 +347,9 @@ func (args Metrics) Validate() error {
347347
}
348348

349349
validFeatures := map[string]struct{}{
350-
"application": {}, "application_span": {},
350+
"application": {}, "application_span": {}, "application_host": {},
351351
"application_service_graph": {}, "application_process": {},
352-
"network": {},
352+
"network": {}, "network_inter_zone": {},
353353
}
354354
for _, feature := range args.Features {
355355
if _, ok := validFeatures[feature]; !ok {
@@ -627,12 +627,8 @@ func (a *Arguments) Convert() (*beyla.Config, error) {
627627
}
628628

629629
func (args *Arguments) Validate() error {
630-
hasNetworkFeature := args.Metrics.hasNetworkFeature()
631630
hasAppFeature := args.Metrics.hasAppFeature()
632631

633-
isTracingEnabled := args.TracePrinter != "" && args.TracePrinter != string(debug.TracePrinterDisabled)
634-
hasOutputConfig := args.Output != nil && args.Output.Traces != nil
635-
636632
if args.TracePrinter == "" {
637633
args.TracePrinter = string(debug.TracePrinterDisabled)
638634
} else if !debug.TracePrinter(args.TracePrinter).Valid() {
@@ -664,11 +660,6 @@ func (args *Arguments) Validate() error {
664660
return fmt.Errorf("invalid exclude_services configuration: %s", err.Error())
665661
}
666662
}
667-
668-
if !hasNetworkFeature && !hasAppFeature && !isTracingEnabled && !hasOutputConfig {
669-
return fmt.Errorf("either metrics.features must include at least one of: [network, application, application_span, application_service_graph, application_process], or tracing must be enabled via trace_printer or output section")
670-
}
671-
672663
return nil
673664
}
674665

internal/component/beyla/ebpf/beyla_linux_test.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,15 @@ func TestMetrics_Validate(t *testing.T) {
618618
wantErr: `metrics.instrumentations: invalid value "invalid"`,
619619
},
620620
{
621-
name: "valid features",
621+
name: "valid application features",
622622
args: Metrics{
623-
Features: []string{"application", "network"},
623+
Features: []string{"application", "application_span", "application_service_graph", "application_process", "application_host"},
624+
},
625+
},
626+
{
627+
name: "valid network features",
628+
args: Metrics{
629+
Features: []string{"network", "network_inter_zone"},
624630
},
625631
},
626632
{
@@ -652,9 +658,8 @@ func TestArguments_Validate(t *testing.T) {
652658
wantErr string
653659
}{
654660
{
655-
name: "empty arguments",
656-
args: Arguments{},
657-
wantErr: "either metrics.features must include at least one of: [network, application, application_span, application_service_graph, application_process], or tracing must be enabled",
661+
name: "empty arguments",
662+
args: Arguments{},
658663
},
659664
{
660665
name: "valid network-only configuration",
@@ -758,14 +763,6 @@ func TestArguments_Validate(t *testing.T) {
758763
// No metrics features defined
759764
},
760765
},
761-
{
762-
name: "invalid configuration with disabled tracing and no metrics",
763-
args: Arguments{
764-
TracePrinter: "disabled",
765-
// No metrics features and disabled tracing
766-
},
767-
wantErr: "either metrics.features must include at least one of: [network, application, application_span, application_service_graph, application_process], or tracing must be enabled",
768-
},
769766
}
770767

771768
for _, tt := range tests {

0 commit comments

Comments
 (0)