Skip to content

Commit

Permalink
Update Alloy examples matching newer version
Browse files Browse the repository at this point in the history
  • Loading branch information
marctc committed Aug 16, 2024
1 parent c8f170d commit bbc26df
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
33 changes: 29 additions & 4 deletions docs/sources/tutorial/helm-alloy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.
Expand Down
28 changes: 19 additions & 9 deletions examples/alloy/config.alloy
Original file line number Diff line number Diff line change
@@ -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]
}
Expand All @@ -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" {
Expand Down

0 comments on commit bbc26df

Please sign in to comment.