From bbc26df58742096ff6f0241e670509119ef1ab9c Mon Sep 17 00:00:00 2001 From: Marc Tuduri Date: Fri, 16 Aug 2024 13:46:33 +0200 Subject: [PATCH] Update Alloy examples matching newer version --- docs/sources/tutorial/helm-alloy.md | 33 +++++++++++++++++++++++++---- examples/alloy/config.alloy | 28 ++++++++++++++++-------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/docs/sources/tutorial/helm-alloy.md b/docs/sources/tutorial/helm-alloy.md index 84557661e..7179882ce 100644 --- a/docs/sources/tutorial/helm-alloy.md +++ b/docs/sources/tutorial/helm-alloy.md @@ -149,16 +149,41 @@ beyla.ebpf "default" { discovery { services { - exe_path = "http" - open_ports = "80" + kubernetes { + namespace = "default" + deployment_name = "." + } } } + metrics { + features = [ + "application", + ] + } + output { traces = [otelcol.exporter.otlp.grafana_cloud_tempo.input] } } +prometheus.scrape "beyla" { + targets = beyla.ebpf.default.targets + honor_labels = true + forward_to = [prometheus.remote_write.rw.receiver] +} + +prometheus.remote_write "rw" { + endpoint { + url = "https://prometheus-us-central1.grafana.net/api/prom/push" + + basic_auth { + username = env("PROMETHEUS_REMOTE_WRITE_USERNAME") + password = env("PROMETHEUS_REMOTE_WRITE_PASSWORD") + } + } +} + otelcol.exporter.otlp "grafana_cloud_tempo" { client { endpoint = "tempo-us-central1.grafana.net:443" @@ -180,10 +205,10 @@ kubectl create configmap --namespace alloy alloy-config "--from-file=config.allo With this configuration Beyla instruments the services running in the Kubernetes cluster and send traces to Grafana Cloud Tempo and metrics to Prometheus. -The argument `discovery > services > exe_path` specifies the path to the executable of the services to instrument. The `discovery > services > open_ports` argument specifies the port where the services are listening. - The `attributes > kubernetes > enable` enables Kubernetes decoration for metrics and traces, which adds the metadata of the Kubernetes entities running the automatically instrumented services. +The argument `discovery > services > kubernetes` specifies the selection of services based ton Kubernetes metadata. In this example, Beyla instruments all deployments in namespace "default". + The `prometheus.scrape` section configures the Prometheus scrape configuration to collect the metrics from Beyla. The `prometheus.remote_write` section configures the remote write to send the metrics to Grafana Cloud Prometheus. The `output` section configures that Beyla component sends traces to `otelcol.exporter.otlp` component. The `otelcol.exporter.otlp` section configures the [OTLP exporter](/docs/alloy/latest/reference/components/otelcol.exporter.otlp) to send the traces to Grafana Cloud Tempo. diff --git a/examples/alloy/config.alloy b/examples/alloy/config.alloy index dde04955d..e51c0c4dd 100644 --- a/examples/alloy/config.alloy +++ b/examples/alloy/config.alloy @@ -1,22 +1,31 @@ -logging { - level = "debug" - format = "logfmt" -} - beyla.ebpf "default" { + // Enable Kubernetes decoration attributes { kubernetes { enable = "true" } } + // Enable debug mode + debug = true + + // Discovery all deployments in the default namespace discovery { services { - exe_path = "http" - open_ports = "80" + kubernetes { + namespace = "default" + deployment_name = "." + } } } + // Enable all metrics features for Prometheus + metrics { + features = [ + "application", + ] + } + output { traces = [otelcol.exporter.logging.traces.input, otelcol.exporter.otlp.grafana_cloud_tempo.input] } @@ -29,8 +38,9 @@ otelcol.exporter.logging "traces" { } prometheus.scrape "beyla" { - targets = beyla.ebpf.default.targets - forward_to = [prometheus.remote_write.rw.receiver] + targets = beyla.ebpf.default.targets + honor_labels = true + forward_to = [prometheus.remote_write.rw.receiver] } prometheus.remote_write "rw" {