Skip to content

Commit bfe035c

Browse files
committed
Add stub for making alloy the default
1 parent c352673 commit bfe035c

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

observability/examples/alloy/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ services:
5050
- --server.http.listen-addr=0.0.0.0:12345
5151
- --storage.path=/var/lib/alloy/data
5252
- --server.http.ui-path-prefix=/alloy
53-
- /etc/alloy/config.alloy
53+
- /etc/alloy
5454
ports:
5555
- "12345:12345"
5656
volumes:
@@ -62,11 +62,11 @@ services:
6262
- /var/lib/docker/:/var/lib/docker:ro
6363
labels:
6464
- "traefik.enable=true"
65-
- "traefik.http.routers.cadvisor.rule=PathPrefix(`/alloy`)"
65+
- "traefik.http.routers.alloy.rule=PathPrefix(`/alloy`)"
6666
environment:
6767
- PROMETHEUS_URL=${PROMETHEUS_URL-http://cogstack-observability-prometheus-1:9090/prometheus/api/v1/write}
68-
- ALLOY_HOSTNAME=my-custom-host
69-
- ALLOY_IP_ADDRESS=my-custom-ip
68+
- ALLOY_HOSTNAME=${ALLOY_HOSTNAME} # Used to add a label to metrics
69+
- ALLOY_IP_ADDRESS=${ALLOY_IP_ADDRESS} # Used to add a label to metrics
7070
networks:
7171
- observability
7272
networks:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
logging {
2+
level = "debug"
3+
format = "logfmt"
4+
}
5+
6+
prometheus.remote_write "default" {
7+
endpoint {
8+
url = sys.env("PROMETHEUS_URL")
9+
}
10+
external_labels = {
11+
host = sys.env("ALLOY_HOSTNAME"),
12+
ip_address = sys.env("ALLOY_IP_ADDRESS"),
13+
}
14+
}
15+
16+
prometheus.scrape "exporter" {
17+
scrape_interval = "15s"
18+
targets = array.concat(
19+
prometheus.exporter.self.alloy.targets,
20+
prometheus.exporter.cadvisor.local_cadvisor.targets,
21+
prometheus.exporter.unix.local_node_exporter.targets,
22+
)
23+
forward_to = [prometheus.remote_write.default.receiver]
24+
}
25+
26+
// Alloys internal metrics
27+
prometheus.exporter.self "alloy" {
28+
}
29+
30+
// CAdvisor
31+
prometheus.exporter.cadvisor "local_cadvisor" {
32+
docker_host = "unix:///var/run/docker.sock"
33+
storage_duration = "5m"
34+
}
35+
36+
// Node exporter
37+
prometheus.exporter.unix "local_node_exporter" {
38+
}

0 commit comments

Comments
 (0)