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
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Then, you can visit the Grafana instance running at [localhost:3000](http://loca

![Use Profiles Drilldown](./docs/images/drilldown-profiles.png)

To find the labels applied to the telemetry data, 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, refer to [local.alloy](./alloy/local.alloy) and [docker-compose-local.yaml](./docker-compose-local.yaml).

### Send k6 Test Results to Prometheus and visualize them in Grafana with prebuilt dashboards

Expand All @@ -147,23 +147,14 @@ You will need the following settings:

1. The name of the [Grafana Cloud Stack](https://grafana.com/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack) where the telemetry data will be stored.
2. An [Access Policy Token](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/) that includes the following scopes for the selected Grafana Cloud Stack: `stacks:read`, `metrics:write`, `logs:write`, `traces:write`, and `profiles:write`.
3. To enable [Profiling](https://grafana.com/docs/grafana-cloud/monitor-applications/profiles/), go to the Pyroscope profiling service of your [Grafana Cloud Stack](https://grafana.com/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack), and copy the URL, User, and Password.

Then, create an `.env` file with the following environment variables and the values of the previous settings:

```bash
# Your Grafana Cloud Stack Name (Slug)
GRAFANA_CLOUD_STACK=name
GRAFANA_CLOUD_STACK=
# Your Grafana Cloud Access Policy Token
GRAFANA_CLOUD_TOKEN=

# Optional - Profiling configuration for Grafana Cloud Profiles (Pyroscope)
# Endpoint URL for your Grafana Cloud Stack
QUICKPIZZA_PYROSCOPE_ENDPOINT=
# Username for Profiles authentication
QUICKPIZZA_GRAFANA_CLOUD_USER=
# Password for Profiles authentication (typically your Grafana Cloud Access Policy Token)
QUICKPIZZA_GRAFANA_CLOUD_PASSWORD=${GRAFANA_CLOUD_TOKEN}
```

Finally, execute the Docker Compose command using the `docker-compose-cloud.yaml` file, just as in the local setup:
Expand All @@ -180,7 +171,7 @@ Now, you can log in to [Grafana Cloud](https://grafana.com/products/cloud/) and

![Use Profiles Drilldown](./docs/images/grafana-cloud-drilldown-profiles.png)

To find the labels applied to the telemetry data, 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, refer to [cloud.alloy](./alloy/cloud.alloy) and [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) .

### Monitor frontend with Grafana Cloud Frontend Observability

Expand Down
9 changes: 9 additions & 0 deletions contrib/alloy-cloud.river → alloy/cloud.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ import.git "grafana_cloud" {
pull_frequency = "0s"
}

// Receive profiling data
pyroscope.receive_http "default" {
http {
listen_address = "0.0.0.0"
listen_port = 9999
}
forward_to = [grafana_cloud.stack.receivers.profiles]
}

grafana_cloud.stack "receivers" {
stack_name = env("GRAFANA_CLOUD_STACK")
token = env("GRAFANA_CLOUD_TOKEN")
Expand Down
15 changes: 15 additions & 0 deletions contrib/alloy-local.river → alloy/local.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,18 @@ loki.write "local" {
url = env("LOGS_ENDPOINT")
}
}

// Receive profiling data
pyroscope.receive_http "default" {
http {
listen_address = "0.0.0.0"
listen_port = 9999
}
forward_to = [pyroscope.write.local.receiver]
}

pyroscope.write "local" {
endpoint {
url = env("PROFILES_ENDPOINT")
}
}
13 changes: 7 additions & 6 deletions docker-compose-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ services:
environment:
QUICKPIZZA_OTLP_ENDPOINT: http://alloy:4318
QUICKPIZZA_TRUST_CLIENT_TRACEID: 1
QUICKPIZZA_PYROSCOPE_ENDPOINT: http://alloy:9999
# must be set with an .env file
QUICKPIZZA_GRAFANA_CLOUD_USER: "${QUICKPIZZA_GRAFANA_CLOUD_USER}"
QUICKPIZZA_GRAFANA_CLOUD_PASSWORD: "${QUICKPIZZA_GRAFANA_CLOUD_PASSWORD}"
QUICKPIZZA_PYROSCOPE_ENDPOINT: "${QUICKPIZZA_PYROSCOPE_ENDPOINT}"
QUICKPIZZA_CONF_FARO_URL: "${QUICKPIZZA_CONF_FARO_URL}"
# must be set with an .env file
QUICKPIZZA_CONF_FARO_APP_NAME: "${QUICKPIZZA_CONF_FARO_APP_NAME}"

# Namespace label in Faro. Default: quickpizza
# QUICKPIZZA_CONF_FARO_APP_NAMESPACE: quickpizza

# Enable logging. Possible values: error, warn, debug. Default: info
# QUICKPIZZA_LOG_LEVEL: debug
# Service name label in Pyroscope. Default: quickpizza
Expand All @@ -28,10 +26,13 @@ services:
alloy:
image: grafana/alloy:v1.9.1
volumes:
- "./contrib/alloy-cloud.river:/grafana-alloy.river:Z"
- "./alloy/cloud.alloy:/config.alloy:Z"
- "${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock"
command:
["run", "/grafana-alloy.river", "--server.http.listen-addr=0.0.0.0:12345"]
- run
- /config.alloy
- --server.http.listen-addr=0.0.0.0:12345
- --stability.level=public-preview
ports:
- "12345:12345"
environment:
Expand Down
11 changes: 8 additions & 3 deletions docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
QUICKPIZZA_OTLP_ENDPOINT: http://alloy:4318
QUICKPIZZA_TRUST_CLIENT_TRACEID: 1
QUICKPIZZA_PYROSCOPE_ENDPOINT: http://pyroscope:4040
QUICKPIZZA_PYROSCOPE_ENDPOINT: http://alloy:9999
# Enable logging. Possible values: error, warn, debug. Default: info
# QUICKPIZZA_LOG_LEVEL: debug
# Service name label in Pyroscope. Default: quickpizza
Expand Down Expand Up @@ -64,18 +64,23 @@ services:
alloy:
image: grafana/alloy:v1.9.1
volumes:
- "./contrib/alloy-local.river:/grafana-alloy.river:Z"
- "./alloy/local.alloy:/config.alloy:Z"
- "${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock"
command:
["run", "/grafana-alloy.river", "--server.http.listen-addr=0.0.0.0:12345"]
- run
- /config.alloy
- --server.http.listen-addr=0.0.0.0:12345
- --stability.level=public-preview
ports:
- "12345:12345"
environment:
QUICKPIZZA_HOST: quickpizza:3333
METRICS_ENDPOINT: http://prometheus:9090/api/v1/write
TRACES_ENDPOINT: http://tempo:4317
LOGS_ENDPOINT: http://loki:3100/loki/api/v1/push
PROFILES_ENDPOINT: http://pyroscope:4040
depends_on:
- prometheus
- quickpizza
- tempo
- pyroscope