feat(traffic): add Grafana Beyla as a traffic source (#1205)#1217
feat(traffic): add Grafana Beyla as a traffic source (#1205)#1217rafaelpissolatto wants to merge 1 commit into
Conversation
Add Beyla as a fourth traffic source for L7 HTTP/gRPC visibility via eBPF auto-instrumentation. Beyla is detected through Prometheus metrics (beyla_network_flow_bytes_total, http_request_duration_milliseconds_count) with a pod-label fallback for Alloy and standalone Beyla deployments
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e09d4d7. Configure here.
| existing.HTTPMethod = l7.HTTPMethod | ||
| existing.HTTPPath = l7.HTTPPath | ||
| existing.HTTPStatus = l7.HTTPStatus | ||
| existing.RequestRate = l7.RequestRate |
There was a problem hiding this comment.
L7 merge skips multi-port flows
Medium Severity
When building L4 flows, byPair keeps only one flow per source/destination pair (the last seen). L7 HTTP fields are merged through that single pointer, so additional L4 edges on other ports for the same pair never receive L7 enrichment despite the feature intent to enrich each L4 flow.
Reviewed by Cursor Bugbot for commit e09d4d7. Configure here.


Description
Adds Grafana Beyla as a fourth traffic source, alongside Hubble, Istio and Caretta.
Beyla derives network flows from eBPF without requiring a service mesh or CNI-level
integration, which makes it the first traffic source that works on a plain cluster.
Radar reads its metrics from any Prometheus-compatible endpoint - Prometheus, Mimir,
or whatever Alloy remote-writes to - rather than talking to Beyla directly.
Implementation
BeylaSourceimplementing theTrafficSourceinterface:Connect,Detect,GetFlows,StreamFlows,Closebeyla_network_flow_bytes_total, with a pod-label fallback thatrecognises both Alloy-embedded and standalone Beyla deployments
beyla_network_flow_bytes_total, keyed on owner-levelattributes (
k8s_src_owner_name/k8s_dst_owner_name) so edges land onDeployments rather than individual pods
series for that source→destination pair (method, route, status)
existing Hubble or Istio install still wins
Notes for reviewers
sum(...{src="ns"}) or sum(...{dst="ns"})). PromQL cannot express "src OR dst namespace" inside asingle selector - a bare matcher after
andis a parse error, not just astylistic issue. This matches the idiom already used in
istio.go.Connectionsis used downstream inpkg/traffic/aggregation.goas anaggregation weight, so it is kept explicitly non-zero. Byte and request values
are per-second rates over the 5m window, converted back to window totals.
as anonymous nodes the UI cannot resolve or navigate to.
Type of change
Purely additive - the source is only used when detected, and detection is
last in priority order, so existing Hubble/Istio/Caretta users see no change.
How has this been tested?
Unit tests - 13 cases covering metric-probe and pod-label detection, owner-level
and extended-label flows, the L4+L7 merge, namespace filtering, kind/transport
mapping, and a regression test pinning the namespace filter as valid PromQL.
Live cluster - validated end-to-end on a 3-node
kindcluster running Beyla(DaemonSet,
hostPID+hostNetwork), Alloy scraping via ServiceMonitor, andMimir as the query backend:
Detectavailable=true, "Beyla detected via Prometheus metrics"GetFlowsdemo-backend→ 24,demo-frontend→ 223, no cross-namespace leakageRepresentative flows:
A build-tagged live test (
//go:build livebeyla) is included so this isreproducible; it is excluded from normal builds and CI.
Not yet validated: the L7 path. Beyla's application-level probes failed to load
on the test kernel (WSL2) with
BPF program is too large. Processed 1000001 insn,so no HTTP metrics existed to exercise the merge against. The L7 code path is
covered by unit tests but has not run against real data, and the metric name
http_request_duration_milliseconds_countshould be confirmed on a stock kernel -recent Beyla follows OTel semconv naming, which differs. The L4 path is unaffected.
Checklist
Related issues
Part-Of and Closes #1205
Note
Low Risk
Additive traffic path with lowest detection priority; existing sources unchanged. Main caveat is dependency on Prometheus metric names and optional L7 merge, which the author notes is unit-tested but not fully validated on live HTTP metrics.
Overview
Adds Grafana Beyla as a fourth Traffic view backend, reading eBPF-derived metrics from the shared Prometheus client (standalone Beyla or Alloy) instead of a mesh/CNI integration.
BeylaSourceimplements the usualTrafficSourcesurface: Prometheus-backedConnect/Detect,GetFlows(L4 frombeyla_network_flow_bytes_totalat workload owner labels, optional HTTP enrichment from request-duration counts, merged per src→dst pair), and a 10s pollingStreamFlows. Detection probes the same Beyla/Alloy scrape jobs as the flow queries, then falls back to running Alloy/Beyla pods. Namespace filters use two OR’d PromQL sums so src-or-dst matching stays valid.The traffic manager registers
beyla, includes it inConnect, and runs it last in auto-detect priority so Hubble, Istio, and Caretta still win when present. README Traffic section documents Beyla alongside the other sources. Unit tests cover detection, flow parsing/merge, and PromQL shape; an opt-inlivebeylatest exercises a real metrics backend.Reviewed by Cursor Bugbot for commit e09d4d7. Bugbot is set up for automated code reviews on this repo. Configure here.