Skip to content

Commit

Permalink
From Agent to Alloy
Browse files Browse the repository at this point in the history
Signed-off-by: Weifeng Wang <qclaogui@gmail.com>

From Agent to Alloy

Signed-off-by: Weifeng Wang <qclaogui@gmail.com>
  • Loading branch information
qclaogui committed Apr 12, 2024
1 parent 4e46e5c commit 5043215
Show file tree
Hide file tree
Showing 121 changed files with 7,775 additions and 3,654 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ copyright: $(COPYRIGHT) ## Add Copyright header to .go files.
CONFIG_FILES = $(shell find . -type f -name '*.river')
CONFIG_FILES_IN_DOCKER = $(subst ./, /data/, $(CONFIG_FILES))
.PHONY: fmt
fmt: ## Uses Grafana Agent to fmt the river config
fmt: alloy-fmt ## Uses Grafana Agent to fmt the river config
@for c in $(CONFIG_FILES_IN_DOCKER); do \
echo "$$c"; \
docker run -e AGENT_MODE=flow --rm --volume "$(shell pwd):/data" -u $(shell id -u) grafana/agent:v0.40.3 fmt -w $$c ; \
done

ALLOY_CONFIG_FILES = $(shell find . -type f -name '*.alloy')
ALLOY_CONFIG_FILES_IN_DOCKER = $(subst ./, /data/, $(ALLOY_CONFIG_FILES))
.PHONY: alloy-fmt
alloy-fmt: ## Uses Grafana Alloy to fmt the config
@for c in $(ALLOY_CONFIG_FILES_IN_DOCKER); do \
echo "$$c"; \
docker run --rm --volume "$(shell pwd):/data" -u $(shell id -u) grafana/alloy:v1.0.0 fmt -w $$c ; \
done

##@ Docker compose

Expand Down
13 changes: 7 additions & 6 deletions compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ x-labels: &profiles-labels
profiles.agent.grafana.com/goroutine.scrape: true

x-environment: &jaeger-environment
JAEGER_AGENT_HOST: grafana-agent
JAEGER_AGENT_HOST: alloy
JAEGER_AGENT_PORT: 6831
JAEGER_SAMPLER_TYPE: const
JAEGER_SAMPLER_PARAM: 1

services:
# override compose.yaml included service grafana-agent's entrypoint to use monolithic-mode-all.river. default(metrics.river)
grafana-agent:
alloy: # override compose.yaml included service alloy entrypoint to use all-in-one.alloy. default(metrics.alloy)
entrypoint:
- /bin/grafana-agent
- /bin/alloy
- run
- /etc/agent-config/monolithic-mode-all.river # Note: Agent use monolithic-mode-all.river
- /etc/alloy/all-in-one.alloy
- --server.http.listen-addr=0.0.0.0:12345
- --cluster.enabled=true
- --cluster.join-addresses=grafana-agent-cluster:12345
- --cluster.join-addresses=alloy-cluster:12345
- --disable-reporting=true
- --stability.level=experimental
- --storage.path=/var/lib/alloy/data

# override compose.yaml included service loki's labels and environment to enabled profiles and traces data collection
loki:
Expand Down
4 changes: 2 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ version: '3.9'
include:
- path: ./docker-compose/common/compose-include/minio.yaml
- path: ./docker-compose/common/compose-include/memcached.yaml
# Grafana LGTMP Stack Components
- path: ./docker-compose/common/compose-include/alloy.yaml
# Self Hosted Grafana LGTMP Stack
- path: ./docker-compose/common/compose-include/loki.yaml
- path: ./docker-compose/common/compose-include/grafana-agent.yaml
- path: ./docker-compose/common/compose-include/grafana.yaml
- path: ./docker-compose/common/compose-include/tempo.yaml
- path: ./docker-compose/common/compose-include/mimir.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@

services:
grafana-agent:
alloy:
labels:
logs.agent.grafana.com/log-format: logfmt
depends_on: { gateway: { condition: service_healthy } }
image: ${AGENT_IMAGE:-docker.io/grafana/agent:v0.40.3}
image: ${ALLOY_IMAGE:-docker.io/grafana/alloy:v1.0.0}
volumes:
- ../config/agent-flow:/etc/agent-config
- ../config/alloy:/etc/alloy
- /var/run/docker.sock:/var/run/docker.sock:ro
- /:/rootfs:ro
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
entrypoint:
- /bin/grafana-agent
- /bin/alloy
- run
- /etc/agent-config/metrics.river
- /etc/alloy/metrics.alloy
- --server.http.listen-addr=0.0.0.0:12345
- --cluster.enabled=true
- --cluster.join-addresses=grafana-agent-cluster:12345
- --cluster.join-addresses=alloy-cluster:12345
- --disable-reporting=true
- --stability.level=experimental
- --storage.path=/var/lib/alloy/data
environment:
- AGENT_MODE=flow
- AGENT_CONFIG_FOLDER=/etc/agent-config
- ALLOY_CONFIG_FOLDER=/etc/alloy
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:12345/ready || exit 1" ]
interval: 5s
timeout: 2s
retries: 10
ports:
- "12345:12345"
# scale up support
# - "12345-12348:12345" # Note: max replicas num is 3.
deploy:
replicas: 1
networks:
default:
aliases:
- grafana-agent-cluster
- alloy-cluster
2 changes: 1 addition & 1 deletion docker-compose/common/compose-include/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
- ../config/grafana/grafana.ini:/etc/grafana-config/grafana.ini
- ../config/grafana/dashboards:/var/lib/grafana/dashboards
- ../config/grafana/provisioning:/etc/grafana/provisioning
- ../../../monitoring-mixins/agent-flow-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/agent-flow-mixin
- ../../../monitoring-mixins/alloy-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/alloy-mixin
- ../../../monitoring-mixins/go-runtime-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/go-runtime-mixin
- ../../../monitoring-mixins/mimir-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/mimir-mixin
- ../../../monitoring-mixins/memcached-mixin/deploy/dashboards_out:/var/lib/grafana/dashboards/memcached-mixin
Expand Down
4 changes: 2 additions & 2 deletions docker-compose/common/compose-include/mimir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ services:
mimirtool:
labels:
metrics.agent.grafana.com/scrape: false
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:2.11.0}
image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:2.12.0}
volumes:
- ../../../monitoring-mixins/crontab:/etc/crontabs/root
- ../../../monitoring-mixins/agent-flow-mixin/deploy/agent-flow-mixin-alerts.yaml:/rules/agent-flow-mixin-alerts.yaml
- ../../../monitoring-mixins/alloy-mixin/deploy/alloy-mixin-alerts.yaml:/rules/alloy-mixin-alerts.yaml
- ../../../monitoring-mixins/memcached-mixin/deploy/memcached-mixin-alerts.yaml:/rules/memcached-mixin-alerts.yaml
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-rules.yaml:/rules/mimir-mixin-rules.yaml
- ../../../monitoring-mixins/mimir-mixin/deploy/mimir-mixin-alerts.yaml:/rules/mimir-mixin-alerts.yaml
Expand Down
1 change: 1 addition & 0 deletions docker-compose/common/config/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ALLOY_IMAGE=grafana/alloy:v1.0.0
AGENT_IMAGE=grafana/agent:v0.40.3
LOKI_IMAGE=grafana/loki:3.0.0
GRAFANA_IMAGE=grafana/grafana:11.0.0-preview
Expand Down
40 changes: 0 additions & 40 deletions docker-compose/common/config/agent-flow/logs.river

This file was deleted.

28 changes: 0 additions & 28 deletions docker-compose/common/config/agent-flow/metrics.river

This file was deleted.

60 changes: 0 additions & 60 deletions docker-compose/common/config/agent-flow/modules/docker/README.md

This file was deleted.

Loading

0 comments on commit 5043215

Please sign in to comment.