Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PUBLIC_BACKEND_WS_ENDPOINT=ws://localhost:3333
# docker-compose-cloud.yaml env variables
QUICKPIZZA_CONF_FARO_URL=GRAFANA_CLOUD_FARO_URL

# https://github.com/grafana/agent-modules/tree/main/modules/grafana-cloud/autoconfigure
# https://github.com/grafana/alloy-modules/tree/main/modules/cloud/grafana/cloud
# Name of your stack as shown in the account console
GRAFANA_CLOUD_STACK=GRAFANA_CLOUD_STACK_NAME

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ export QUICKPIZZA_LOG_LEVEL=debug

## Local Setup

The [docker-compose-local.yaml](./docker-compose-local.yaml) file is set up to run and orchestrate the QuickPizza, Grafana, Tempo, Loki, Prometheus, Pyroscope, and Grafana Agent containers.
The [docker-compose-local.yaml](./docker-compose-local.yaml) file is set up to run and orchestrate the QuickPizza, Grafana, Tempo, Loki, Prometheus, Pyroscope, and Grafana Alloy containers.

The Grafana Agent collects traces, metrics, logs and profiling data from the QuickPizza app, forwarding them to the Tempo, Prometheus and Loki. Finally, you can visualize and correlate data stored in these containers with the locally running Grafana instance.
Grafana Alloy collects traces, metrics, logs and profiling data from the QuickPizza app, forwarding them to the Tempo, Prometheus and Loki. Finally, you can visualize and correlate data stored in these containers with the locally running Grafana instance.

To start the local environment, use the following command:

Expand All @@ -129,7 +129,7 @@ Like before, QuickPizza is available at [localhost:3333](http://localhost:3333).

Then, you can visit the Grafana instance running at [localhost:3000](http://localhost:3000) to access QuickPizza data.

Please refer to [agent-local.river](./contrib/agent-local.river) and [docker-compose-local.yaml](./docker-compose-local.yaml) to find the labels applied to the telemetry data.
Please refer to [alloy-local.river](./contrib/alloy-local.river) and [docker-compose-local.yaml](./docker-compose-local.yaml) to find the labels applied to the telemetry data.

### Correlate Pyroscope Data with k6 Tests

Expand Down Expand Up @@ -163,9 +163,9 @@ For detailed instructions about the different options of the k6 Prometheus outpu

## Grafana Cloud

The [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) file is set up to run the QuickPizza and Grafana Agent containers.
The [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) file is set up to run the QuickPizza and Grafana Alloy containers.

In this setup, the Grafana Agent collects observability data from the QuickPizza app and forwards it to [Grafana Cloud](https://grafana.com/products/cloud/).
In this setup, Grafana Alloy collects observability data from the QuickPizza app and forwards it to [Grafana Cloud](https://grafana.com/products/cloud/).

You will need the following settings:

Expand Down Expand Up @@ -196,7 +196,7 @@ docker compose -f docker-compose-cloud.yaml up -d

QuickPizza is available at [localhost:3333](http://localhost:3333). Click the `Pizza, Please!` button and discover some awesome pizzas!

Now, you can log in to [Grafana Cloud](https://grafana.com/products/cloud/) and explore QuickPizza's telemetry data on the Prometheus, Tempo, Loki, and Pyroscope instances of your Grafana Cloud Stack. Refer to [agent-cloud.river](./contrib/agent-cloud.river) and [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) to find the labels applied to the telemetry data.
Now, you can log in to [Grafana Cloud](https://grafana.com/products/cloud/) and explore QuickPizza's telemetry data on the Prometheus, Tempo, Loki, and Pyroscope instances of your Grafana Cloud Stack. Refer to [alloy-cloud.river](./contrib/alloy-cloud.river) and [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) to find the labels applied to the telemetry data.

### Enable Profiling (Send profiles to Grafana Cloud Profiles / Pyroscope)

Expand Down Expand Up @@ -242,7 +242,7 @@ For detailed instructions, refer to the [k6 output guide for Grafana Cloud Prome

## Deploy QuickPizza Docker image

The [Dockerfile](./Dockerfile) contains the setup for running QuickPizza without collecting data with the Grafana agent.
The [Dockerfile](./Dockerfile) contains the setup for running QuickPizza without collecting data with Grafana Alloy.

You can use the Dockerfile or build a Docker image to deploy the QuickPizza app on any cloud provider that supports Docker deployments. For simplicity, here are the `Fly.io` instructions:

Expand Down
21 changes: 11 additions & 10 deletions contrib/agent-cloud.river → contrib/alloy-cloud.river
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ otelcol.processor.batch "default" {
metrics = []
logs = []
traces = [
module.git.grafana_cloud.exports.traces_receiver,
grafana_cloud.stack.receivers.traces,
]
}
}

// Scrape Metrics
prometheus.scrape "default" {
forward_to = [
module.git.grafana_cloud.exports.metrics_receiver,
grafana_cloud.stack.receivers.metrics,
]
targets = [
{
Expand Down Expand Up @@ -64,16 +64,17 @@ discovery.relabel "quickpizza" {
loki.source.docker "default" {
host = "unix:///var/run/docker.sock"
targets = discovery.relabel.quickpizza.output
forward_to = [module.git.grafana_cloud.exports.logs_receiver]
forward_to = [grafana_cloud.stack.receivers.logs]
}

module.git "grafana_cloud" {
repository = "https://github.com/grafana/agent-modules.git"
path = "modules/grafana-cloud/autoconfigure/module.river"
import.git "grafana_cloud" {
repository = "https://github.com/grafana/alloy-modules.git"
revision = "main"
path = "modules/cloud/grafana/cloud/module.alloy"
pull_frequency = "0s"
arguments {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
}
}

grafana_cloud.stack "receivers" {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
}
File renamed without changes.
11 changes: 5 additions & 6 deletions docker-compose-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ services:
ports:
- "3333:3333"
environment:
QUICKPIZZA_OTLP_ENDPOINT: http://agent:4318
QUICKPIZZA_OTLP_ENDPOINT: http://alloy:4318
QUICKPIZZA_TRUST_CLIENT_TRACEID: 1
# must be set with an .env file
QUICKPIZZA_CONF_FARO_URL: "${QUICKPIZZA_CONF_FARO_URL}"
QUICKPIZZA_PYROSCOPE_ENDPOINT: "${QUICKPIZZA_CONF_PYROSCOPE_ENDPOINT}"

agent:
image: grafana/agent:latest
alloy:
image: grafana/alloy:v1.9.1
volumes:
- "./contrib/agent-cloud.river:/grafana-agent.river:Z"
- "./contrib/alloy-cloud.river:/grafana-alloy.river:Z"
- "${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock"
command:
["run", "/grafana-agent.river", "--server.http.listen-addr=0.0.0.0:12345"]
["run", "/grafana-alloy.river", "--server.http.listen-addr=0.0.0.0:12345"]
ports:
- "12345:12345"
environment:
AGENT_MODE: flow
QUICKPIZZA_HOST: quickpizza:3333
# must be set with an .env file
GRAFANA_CLOUD_TOKEN: "${GRAFANA_CLOUD_TOKEN}"
Expand Down
11 changes: 5 additions & 6 deletions docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ports:
- "3333:3333"
environment:
QUICKPIZZA_OTLP_ENDPOINT: http://agent:4318
QUICKPIZZA_OTLP_ENDPOINT: http://alloy:4318
QUICKPIZZA_TRUST_CLIENT_TRACEID: 1
QUICKPIZZA_PYROSCOPE_ENDPOINT: http://pyroscope:4040

Expand Down Expand Up @@ -55,17 +55,16 @@ services:
volumes:
- ./grafana:/etc/grafana/provisioning/

agent:
image: grafana/agent:latest
alloy:
image: grafana/alloy:v1.9.1
volumes:
- "./contrib/agent-local.river:/grafana-agent.river:Z"
- "./contrib/alloy-local.river:/grafana-alloy.river:Z"
- "${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock"
command:
["run", "/grafana-agent.river", "--server.http.listen-addr=0.0.0.0:12345"]
["run", "/grafana-alloy.river", "--server.http.listen-addr=0.0.0.0:12345"]
ports:
- "12345:12345"
environment:
AGENT_MODE: flow
QUICKPIZZA_HOST: quickpizza:3333
METRICS_ENDPOINT: http://prometheus:9090/api/v1/write
TRACES_ENDPOINT: http://tempo:4317
Expand Down
4 changes: 2 additions & 2 deletions docs/kubernetes-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ echo $BASE_URL

### Enable telemetry in Kubernetes

To collect telemetry information, enable the `grafana-agent/cloud` (or `grafana-agent/local`) resource in `kubernetes/kustomization.yaml` and set the required configuration options.
To collect telemetry information, enable the `grafana-alloy/cloud` (or `grafana-alloy/local`) resource in `kubernetes/kustomization.yaml` and set the required configuration options.

After making the changes `kubernetes/kustomization.yaml`, you may need to restart the QuickPizza pods for them to pick up the new configuration:

Expand All @@ -92,7 +92,7 @@ kubectl delete pods -l app.k8s.io/name=QuickPizza

![Screenshot of a trace visualized in Grafana Tempo](https://github.com/grafana/QuickPizza/assets/969721/4088f92b-c98c-4631-9681-c2ce8a49d721)

To ingest logs from Kubernetes, take a look at the [Grafana Cloud Kubernetes Integration](https://grafana.com/solutions/kubernetes) or use the [`loki.source.kubernetes`](https://grafana.com/docs/agent/latest/flow/reference/components/loki.source.kubernetes/)/[`loki.source.file`](https://grafana.com/docs/agent/latest/flow/reference/components/local.file_match/#send-kubernetes-pod-logs-to-loki) agent components.
To ingest logs from Kubernetes, take a look at the [Grafana Cloud Kubernetes Integration](https://grafana.com/solutions/kubernetes) or use the [`loki.source.kubernetes`](https://grafana.com/docs/alloy/latest/reference/components/loki/loki.source.kubernetes/)/[`loki.source.file`](https://grafana.com/docs/alloy/latest/reference/components/loki/loki.source.file/#file-globbing) components.

### Running xk6-disruptor tests

Expand Down
45 changes: 0 additions & 45 deletions kubernetes/grafana-agent/base/resources/deployment.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions kubernetes/grafana-agent/cloud/kustomization.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions kubernetes/grafana-agent/local/kustomization.yaml

This file was deleted.

42 changes: 42 additions & 0 deletions kubernetes/grafana-alloy/base/resources/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-alloy
labels:
app.k8s.io/name: grafana-alloy
spec:
replicas: 1
selector:
matchLabels:
app.k8s.io/name: grafana-alloy
template:
metadata:
name: grafana-alloy
labels:
app.k8s.io/name: grafana-alloy
spec:
restartPolicy: Always
serviceAccountName: grafana-alloy
containers:
- name: grafana-alloy
image: grafana/alloy:v1.9.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we either pin all versions of grafana/alloy, like here, or use grafana/alloy:latest everywhere, like you do in Docker Compose.

imagePullPolicy: IfNotPresent
args:
- run
- /etc/alloy-config/grafana-alloy.river
envFrom:
- secretRef:
name: grafana-alloy-credentials
ports:
- name: grpc
containerPort: 4317
- name: http
containerPort: 4318
volumeMounts:
- mountPath: /etc/alloy-config/grafana-alloy.river
name: alloy-config
subPath: grafana-alloy.river
volumes:
- name: alloy-config
configMap:
name: alloy-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: grafana-agent
name: grafana-alloy
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: grafana-agent
name: grafana-alloy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: grafana-agent
name: grafana-alloy
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: grafana-agent
name: grafana-alloy
labels:
app.k8s.io/name: grafana-agent
app.k8s.io/name: grafana-alloy
spec:
selector:
app.k8s.io/name: grafana-agent
app.k8s.io/name: grafana-alloy
ports:
- port: 4317
name: grpc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ otelcol.processor.batch "default" {
metrics = []
logs = []
traces = [
module.git.grafana_cloud.exports.traces_receiver,
grafana_cloud.stack.receivers.traces,
]
}
}
Expand All @@ -36,7 +36,7 @@ discovery.kubernetes "application_pods" {
}
prometheus.scrape "default" {
forward_to = [
module.git.grafana_cloud.exports.metrics_receiver,
grafana_cloud.stack.receivers.metrics,
]
targets = discovery.relabel.relabel_targets.output
}
Expand Down Expand Up @@ -65,18 +65,19 @@ discovery.relabel "relabel_targets" {

pyroscope.scrape "scrape_profiles" {
forward_to = [
module.git.grafana_cloud.exports.profiles_receiver,
grafana_cloud.stack.receivers.profiles,
]
targets = discovery.relabel.relabel_targets.output
}

module.git "grafana_cloud" {
repository = "https://github.com/grafana/agent-modules.git"
path = "modules/grafana-cloud/autoconfigure/module.river"
import.git "grafana_cloud" {
repository = "https://github.com/grafana/alloy-modules.git"
revision = "main"
path = "modules/cloud/grafana/cloud/module.alloy"
pull_frequency = "0s"
arguments {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
}
}

grafana_cloud.stack "receivers" {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
}
10 changes: 10 additions & 0 deletions kubernetes/grafana-alloy/cloud/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- ../base/

configMapGenerator:
- name: alloy-config
files:
- ./config/grafana-alloy.river
- name: tracing-env
literals:
- QUICKPIZZA_OTLP_ENDPOINT=http://grafana-alloy:4318
10 changes: 10 additions & 0 deletions kubernetes/grafana-alloy/local/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- ../base/

configMapGenerator:
- name: alloy-config
files:
- ./config/grafana-alloy.river
- name: tracing-env
literals:
- QUICKPIZZA_OTLP_ENDPOINT=http://grafana-alloy:4318
Loading
Loading