Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
From Agent to Alloy

Signed-off-by: Weifeng Wang <[email protected]>

Update README.md
  • Loading branch information
qclaogui committed Apr 12, 2024
1 parent 1eff797 commit 49c5cf2
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 32 deletions.
10 changes: 4 additions & 6 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ footer: |
| Port-mapping | Component | Description |
| --- | --- | --- |
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `12345:12345`, `4317`, `4318`, `6831` | [Alloy][1] | Eexpose `12345` port so we can directly access `alloy` inside container |
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
Expand All @@ -77,7 +77,7 @@ footer: |
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
| `39000:9000`, `2500`, `1100` | [Inbucket][8] | Expose `39000` port to use for the email testing server web interface. |
[1]: https://github.com/grafana/agent
[1]: https://github.com/grafana/alloy
[2]: https://github.com/grafana/loki
[3]: https://github.com/grafana/grafana
[4]: https://github.com/grafana/tempo
Expand All @@ -88,11 +88,9 @@ footer: |
## Helpful Links
- <https://grafana.com/docs/>
- <https://github.com/grafana/agent-modules>
- <https://grafana.com/docs/alloy/latest/>
- <https://github.com/grafana/alloy-modules>
- <https://github.com/docker/compose>
- <https://grafana.com/docs/agent/latest/flow/reference/components/>
- <https://github.com/k3d-io/k3d>
- <https://github.com/k3s-io/k3s>
- <https://github.com/grafana/grafana>
- [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Use "lgtmp [command] --help" for more information about a command.
| Port-mapping | Component | Description |
| --- | --- | --- |
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `12345:12345`, `4317`, `4318`, `6831` | [Alloy][1] | Eexpose `12345` port so we can directly access `alloy` inside container |
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
Expand All @@ -253,7 +253,7 @@ Use "lgtmp [command] --help" for more information about a command.
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
| `39000:9000`, `2500`, `1100` | [Inbucket][8] | Expose `39000` port to use for the email testing server web interface. |
[1]: https://github.com/grafana/agent
[1]: https://github.com/grafana/alloy
[2]: https://github.com/grafana/loki
[3]: https://github.com/grafana/grafana
[4]: https://github.com/grafana/tempo
Expand All @@ -264,11 +264,9 @@ Use "lgtmp [command] --help" for more information about a command.
## Helpful Links
- <https://grafana.com/docs/>
- <https://github.com/grafana/agent-modules>
- <https://grafana.com/docs/alloy/latest/>
- <https://github.com/grafana/alloy-modules>
- <https://github.com/docker/compose>
- <https://grafana.com/docs/agent/latest/flow/reference/components/>
- <https://github.com/k3d-io/k3d>
- <https://github.com/k3s-io/k3s>
- <https://github.com/grafana/grafana>
- [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system
83 changes: 73 additions & 10 deletions docker-compose/common/config/alloy/modules/provider/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
# Alloy LGTMP Stack Receivers Provider Moudles
# Alloy Receivers Provider Moudle

<https://grafana.com/docs/alloy/latest/concepts/modules/>
Provide the receivers of the collected data(`logs` `metrics` `traces` `profiles`).

## Self Hosted LGTMP Stack Provider
## Components

- [Self Hosted](#self_hosted)

- [Grafana Cloud](#grafana_cloud)

### `self_hosted`

Module to configure receivers for Self Hosted LGTMP Stack.

***Arguments***

| Name | Required | Default | Description |
| :------------------ | :------- | :---------------------- | :--------------------------------- |
| `metrics_endpoint` | _no_ | `http://mimir:8080` | Where to send collected `metrics`. |
| `logs_endpoint` | _no_ | `http://loki:3100` | Where to send collected `logs`. |
| `traces_endpoint` | _no_ | `tempo:4317` | Where to send collected `traces`. |
| `profiles_endpoint` | _no_ | `http://pyroscope:4040` | Where to send collected `profiles`.|

***Exports***

| Name | Type | Description |
| --------------------| ------------------------ | --------------------------------------------------------------------------- |
| `metrics_receiver` | `prometheus.Interceptor` | A value that other components can use to send metrics data to. |
| `logs_receiver` | `loki.LogsReceiver` | A value that other components can use to send logs data to. |
| `traces_receiver` | `otelcol.Consumer` | A value that other components can use to send trace data to. |
| `profiles_receiver` | `write.fanOutClient` | A value that other components can use to send profiling data to. |

Usage

```alloy
import.git "provider" {
Expand All @@ -12,29 +40,64 @@ import.git "provider" {
pull_frequency = "15m"
}
// get the receivers from docker compose
// get the receivers from provider
provider.self_hosted "compose" {
metrics_endpoint = "http://mimir:8080"
}
// get the receivers from kubernetes
// get the receivers from provider
provider.self_hosted "kubernetes" {
metrics_endpoint = "http://mimir.monitoring-system.svc.cluster.local:8080"
}
// scrape metrics and write to grafana cloud
// scrape metrics and write to metric receiver
prometheus.scrape "default" {
targets = [
{"__address__" = "127.0.0.1:12345"},
]
forward_to = [
provider.self_hosted.compose.metrics_receiver,
// provider.self_hosted.kubernetes.metrics_receiver,
provider.self_hosted.kubernetes.metrics_receiver,
]
}
```

## Grafana Cloud LGTMP Stack Provider
### `grafana_cloud`

Module to automatically configure receivers for Grafana Cloud.

To create a token:

1. Navigate to the [Grafana Cloud Portal](https://grafana.com/profile/org)
2. Go to either the `Access Policies` or `API Keys` page, located in the `Security` section
3. Create an Access Policy or API token with the correct permissions

The token must have permissions to read stack information. The setup of these permissions depends on the type of token:

- Access Policies need the `stacks:read` scope
- API Keys need at least the the `MetricsPublisher` role

***Arguments***

| Name | Required | Default | Description |
| :----------- | :------- | :------ | :------------------------------------------------- |
| `stack_name` | _yes_ | `N/A` | Name of your stack as shown in the account console |
| `token` | _yes_ | `N/A` | Access policy token or API Key. |

***Exports***

| Name | Type | Description |
| --------------------| ------------------------ | --------------------------------------------------------------------------- |
| `metrics_receiver` | `prometheus.Interceptor` | A value that other components can use to send metrics data to. |
| `logs_receiver` | `loki.LogsReceiver` | A value that other components can use to send logs data to. |
| `traces_receiver` | `otelcol.Consumer` | A value that other components can use to send trace data to. |
| `profiles_receiver` | `write.fanOutClient` | A value that other components can use to send profiling data to. |
| `stack_information` | `object` | Decoded representation of the [Stack info endpoint](https://grafana.com/docs/grafana-cloud/api-reference/cloud-api/#stacks). |

---

Usage

```alloy
import.git "provider" {
Expand All @@ -44,13 +107,13 @@ import.git "provider" {
pull_frequency = "15m"
}
// get the receivers provider
// get the receivers from provider
provider.grafana_cloud "stack_name" {
stack_name = env("GRAFANA_CLOUD_STACK_NAME")
token = env("GRAFANA_CLOUD_STACK_TOKEN")
}
// scrape metrics and write to grafana cloud
// scrape metrics and write to metric receiver
prometheus.scrape "default" {
targets = [
{"__address__" = "127.0.0.1:12345"},
Expand Down
10 changes: 5 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ This directory contains examples, including:

## Debug info

`grafana-agent` target scrape:
`alloy` target Auto Scrape by [label](../docker-compose/common/config/alloy/modules/compose/README.md):

<http://localhost:12345/component/module.file.metrics_primary/module.file.mf_label_auto_scrape/prometheus.scrape.pc_docker_metrics>
<http://localhost:12345/component/metrics.label_auto_scrape.default/prometheus.scrape.pc_docker_metrics>

## Grafana LGTMP Stack default port-mapping

| Port-mapping | Component | Description |
| --- | --- | --- |
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `12345:12345`, `4317`, `4318`, `6831` | [Alloy][1] | Eexpose `12345` port so we can directly access `alloy` inside container |
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
Expand All @@ -26,7 +26,7 @@ This directory contains examples, including:
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
| `39000:9000`, `2500`, `1100` | [Inbucket][8] | Expose `39000` port to use for the email testing server web interface. |

[1]: https://github.com/grafana/agent
[1]: https://github.com/grafana/alloy
[2]: https://github.com/grafana/loki
[3]: https://github.com/grafana/grafana
[4]: https://github.com/grafana/tempo
Expand All @@ -43,7 +43,7 @@ COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats

```shell
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
613d8d5e7e30 root-grafana-agent-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11
613d8d5e7e30 root-alloy-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11
53443e6d4c31 root-gateway-1 0.00% 8.102MiB / 1.889GiB 0.42% 497kB / 503kB 6.45MB / 20.5kB 3
750ace278979 root-mimir-1 1.06% 121.2MiB / 1.889GiB 6.27% 5.09MB / 888kB 111kB / 8.7MB 8
acb81816e078 root-loki-1 1.11% 83.13MiB / 1.889GiB 4.30% 157kB / 336kB 56.2MB / 340kB 8
Expand Down
2 changes: 1 addition & 1 deletion examples/ghe-with-mixin/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ services:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=grafana/agent
- REPOS=grafana/alloy
2 changes: 1 addition & 1 deletion examples/ghe-with-simple-dashboards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=grafana/agent
- REPOS=grafana/alloy
```
`compose.override.yaml`:
Expand Down
2 changes: 1 addition & 1 deletion examples/ghe-with-simple-dashboards/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ services:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=grafana/grafana
- REPOS=grafana/alloy
2 changes: 1 addition & 1 deletion examples/github-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=grafana/agent
- REPOS=grafana/alloy
```
## Try it
Expand Down
2 changes: 1 addition & 1 deletion examples/github-exporter/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ services:
metrics.agent.grafana.com/scrape: true
image: githubexporter/github-exporter:1.1.0
environment:
- REPOS=qclaogui/codelab-monitoring
- REPOS=grafana/alloy

0 comments on commit 49c5cf2

Please sign in to comment.