diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6f22a81f..4e0ca690 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -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 | @@ -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 @@ -88,11 +88,9 @@ footer: | ## Helpful Links - - - - + - + - - - - - - - - - [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system diff --git a/README.md b/README.md index 74e23d4b..f2aea9ad 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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 @@ -264,11 +264,9 @@ Use "lgtmp [command] --help" for more information about a command. ## Helpful Links -- -- +- +- - -- - - -- - [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system diff --git a/docker-compose/common/config/alloy/modules/provider/README.md b/docker-compose/common/config/alloy/modules/provider/README.md index 14d30ac4..d100d212 100644 --- a/docker-compose/common/config/alloy/modules/provider/README.md +++ b/docker-compose/common/config/alloy/modules/provider/README.md @@ -1,8 +1,36 @@ -# Alloy LGTMP Stack Receivers Provider Moudles +# Alloy Receivers Provider Moudle - +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" { @@ -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" { @@ -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"}, diff --git a/examples/README.md b/examples/README.md index 90f6f313..cef820d1 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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): - + ## 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 | @@ -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 @@ -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 diff --git a/examples/ghe-with-mixin/compose.yaml b/examples/ghe-with-mixin/compose.yaml index 95678c0b..b56d9a48 100644 --- a/examples/ghe-with-mixin/compose.yaml +++ b/examples/ghe-with-mixin/compose.yaml @@ -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 diff --git a/examples/ghe-with-simple-dashboards/README.md b/examples/ghe-with-simple-dashboards/README.md index 986ca417..a47389eb 100644 --- a/examples/ghe-with-simple-dashboards/README.md +++ b/examples/ghe-with-simple-dashboards/README.md @@ -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`: diff --git a/examples/ghe-with-simple-dashboards/compose.yaml b/examples/ghe-with-simple-dashboards/compose.yaml index 78e80836..b56d9a48 100644 --- a/examples/ghe-with-simple-dashboards/compose.yaml +++ b/examples/ghe-with-simple-dashboards/compose.yaml @@ -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 diff --git a/examples/github-exporter/README.md b/examples/github-exporter/README.md index 4d7354ce..860b2d08 100644 --- a/examples/github-exporter/README.md +++ b/examples/github-exporter/README.md @@ -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 diff --git a/examples/github-exporter/compose.yaml b/examples/github-exporter/compose.yaml index 06071af2..b4aaca68 100644 --- a/examples/github-exporter/compose.yaml +++ b/examples/github-exporter/compose.yaml @@ -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