From 196ea058806a42c8b24723fde82e8dcfc5f3e919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Tudur=C3=AD?= Date: Thu, 4 Apr 2024 13:15:19 +0200 Subject: [PATCH] Add Grafana Beyla Flow component (#6789) Co-authored-by: Piotr Gwizdala <17101802+thampiotr@users.noreply.github.com> Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- CHANGELOG.md | 2 + CODEOWNERS | 3 +- .../flow/reference/compatibility/_index.md | 8 + .../flow/reference/components/beyla.ebpf.md | 276 +++++++++++++++++ go.mod | 26 +- go.sum | 51 +++- internal/component/all/all.go | 1 + internal/component/beyla/ebpf/args.go | 48 +++ internal/component/beyla/ebpf/beyla_linux.go | 287 ++++++++++++++++++ .../component/beyla/ebpf/beyla_linux_test.go | 200 ++++++++++++ .../component/beyla/ebpf/beyla_placeholder.go | 43 +++ 11 files changed, 925 insertions(+), 20 deletions(-) create mode 100644 docs/sources/flow/reference/components/beyla.ebpf.md create mode 100644 internal/component/beyla/ebpf/args.go create mode 100644 internal/component/beyla/ebpf/beyla_linux.go create mode 100644 internal/component/beyla/ebpf/beyla_linux_test.go create mode 100644 internal/component/beyla/ebpf/beyla_placeholder.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ca991d172a2..d74e2c156e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ Main (unreleased) - A new `loki.rules.kubernetes` component that discovers `PrometheusRule` Kubernetes resources and loads them into a Loki Ruler instance. (@EStork09) +- Add `beyla.ebpf` component to automatically instrument services with eBPF. (@marctc) + ### Bugfixes - Fix an issue where JSON string array elements were not parsed correctly in `loki.source.cloudflare`. (@thampiotr) diff --git a/CODEOWNERS b/CODEOWNERS index 4f1541f12dbd..b48a1816109b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -18,4 +18,5 @@ /docs/sources/ @clayton-cornell # Components: -/component/pyroscope/ @grafana/grafana-agent-profiling-maintainers +/internal/component/pyroscope/ @grafana/grafana-agent-profiling-maintainers +/internal/component/beyla/ @marctc \ No newline at end of file diff --git a/docs/sources/flow/reference/compatibility/_index.md b/docs/sources/flow/reference/compatibility/_index.md index 61775bcf26b5..30825a901f4b 100644 --- a/docs/sources/flow/reference/compatibility/_index.md +++ b/docs/sources/flow/reference/compatibility/_index.md @@ -44,6 +44,10 @@ The following components, grouped by namespace, _export_ Targets. +{{< collapse title="beyla" >}} +- [beyla.ebpf](../components/beyla.ebpf) +{{< /collapse >}} + {{< collapse title="discovery" >}} - [discovery.azure](../components/discovery.azure) - [discovery.consul](../components/discovery.consul) @@ -315,6 +319,10 @@ The following components, grouped by namespace, _consume_ OpenTelemetry `otelcol +{{< collapse title="beyla" >}} +- [beyla.ebpf](../components/beyla.ebpf) +{{< /collapse >}} + {{< collapse title="faro" >}} - [faro.receiver](../components/faro.receiver) {{< /collapse >}} diff --git a/docs/sources/flow/reference/components/beyla.ebpf.md b/docs/sources/flow/reference/components/beyla.ebpf.md new file mode 100644 index 000000000000..ad35b9ccba45 --- /dev/null +++ b/docs/sources/flow/reference/components/beyla.ebpf.md @@ -0,0 +1,276 @@ +--- +canonical: https://grafana.com/docs/agent/latest/flow/reference/components/beyla.ebpf/ +description: Learn about beyla.ebpf +title: beyla.ebpf +labels: + stage: beta +--- + +# beyla.ebpf + +{{< docs/shared lookup="flow/stability/beta.md" source="agent" version="" >}} + +The `beyla.ebpf` component is used as a wrapper for [Grafana Beyla][] which uses [eBPF][] to automatically inspect application executables and the OS networking layer, and capture trace spans related to web transactions and Rate Errors Duration (RED) metrics for Linux HTTP/S and gRPC services. +You can configure the component to collect telemetry data from a specific port or executable path, and other criteria from Kubernetes metadata. +The component exposes metrics that can be collected by a Prometheus scrape component, and traces that can be forwarded to an OTEL exporter component. + +{{< admonition type="note" >}} +To run this component, {{< param "PRODUCT_NAME" >}} requires administrative (`sudo`) privileges, or at least it needs to be granted the `CAP_SYS_ADMIN` and `CAP_SYS_PTRACE` capability. In Kubernetes environments, app armour must be disabled for the Deployment or DaemonSet running {{< param "PRODUCT_NAME" >}}. +{{< /admonition >}} + +[Grafana Beyla]: https://github.com/grafana/beyla +[eBPF]: https://ebpf.io/ + +## Usage + +```river +beyla.ebpf "