From 7c82690aac84309be5fe869e2c35afcf042bb5ab Mon Sep 17 00:00:00 2001 From: Weifeng Wang Date: Tue, 16 Apr 2024 11:42:16 +0800 Subject: [PATCH] Move out alloy modules Signed-off-by: Weifeng Wang --- README.md | 2 +- alloy-modules/README.md | 9 ++++ .../compose/README.md | 19 ++++++-- alloy-modules/compose/integrations/README.md | 9 ++++ .../compose/integrations/cadvisor.alloy | 0 .../compose/integrations/memcached.alloy | 0 .../compose/integrations/node-exporter.alloy | 0 .../compose/jobs/minio.alloy | 0 .../compose/logs/keep-labels.alloy | 0 .../compose/logs/labels-scrape.alloy | 0 .../compose/metrics/integrations-scrape.alloy | 0 .../compose/metrics/jobs-scrape.alloy | 0 .../compose/metrics/labels-probe.alloy | 0 .../compose/metrics/labels-scrape.alloy | 0 .../compose/profiles/labels-scrape.alloy | 0 .../traces/process-and-transform.alloy | 0 alloy-modules/kubernetes/README.md | 12 ++++++ .../provider/README.md | 43 +++++++++---------- .../provider/grafana_cloud.alloy | 0 .../provider/self_hosted.alloy | 2 +- compose.override.yaml | 2 +- .../common/compose-include/alloy.yaml | 2 +- .../common/compose-include/loki.yaml | 2 +- .../common/compose-include/minio.yaml | 2 +- .../common/compose-include/tempo.yaml | 2 +- .../common/config/alloy/all-in-one.alloy | 19 +++++--- docker-compose/common/config/alloy/logs.alloy | 19 +++++--- .../common/config/alloy/metrics.alloy | 15 +++++-- .../common/config/alloy/profiles.alloy | 15 +++++-- .../common/config/alloy/traces.alloy | 15 +++++-- .../microservices-mode/logs/compose.yaml | 4 +- .../microservices-mode/metrics/compose.yaml | 2 +- .../microservices-mode/profiles/compose.yaml | 4 +- .../microservices-mode/traces/compose.yaml | 2 +- .../monolithic-mode/all-in-one/compose.yaml | 8 ++-- .../read-write-mode/logs/compose.yaml | 2 +- .../read-write-mode/metrics/compose.yaml | 2 +- examples/ghe-with-mixin/compose.yaml | 2 +- .../ghe-with-simple-dashboards/compose.yaml | 2 +- examples/github-exporter/compose.yaml | 2 +- examples/grafana-oncall/compose.yaml | 2 +- 41 files changed, 153 insertions(+), 68 deletions(-) create mode 100644 alloy-modules/README.md rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/README.md (91%) create mode 100644 alloy-modules/compose/integrations/README.md rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/integrations/cadvisor.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/integrations/memcached.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/integrations/node-exporter.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/jobs/minio.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/logs/keep-labels.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/logs/labels-scrape.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/metrics/integrations-scrape.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/metrics/jobs-scrape.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/metrics/labels-probe.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/metrics/labels-scrape.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/profiles/labels-scrape.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/compose/traces/process-and-transform.alloy (100%) create mode 100644 alloy-modules/kubernetes/README.md rename {docker-compose/common/config/alloy/modules => alloy-modules}/provider/README.md (68%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/provider/grafana_cloud.alloy (100%) rename {docker-compose/common/config/alloy/modules => alloy-modules}/provider/self_hosted.alloy (98%) diff --git a/README.md b/README.md index c6e600ec..a0330a27 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ include: # include is available in Docker Compose version 2.20 and later, and Do services: github-exporter: - labels: # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + labels: # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md metrics.grafana.com/scrape: true image: githubexporter/github-exporter:1.1.0 environment: diff --git a/alloy-modules/README.md b/alloy-modules/README.md new file mode 100644 index 00000000..0072a329 --- /dev/null +++ b/alloy-modules/README.md @@ -0,0 +1,9 @@ +# Alloy Modules + +[Modules](https://grafana.com/docs/alloy/latest/concepts/modules/) are a way to create Grafana [Alloy](https://grafana.com/docs/alloy/latest/) configurations which can be loaded as a component. Modules are a great way to parameterize a configuration to create reusable pipelines. + +## Modules + +- [Docker Compose](compose/) +- [Kubernetes](kubernetes/) +- [Grafana LGTMP Stack Provider](provider/) diff --git a/docker-compose/common/config/alloy/modules/compose/README.md b/alloy-modules/compose/README.md similarity index 91% rename from docker-compose/common/config/alloy/modules/compose/README.md rename to alloy-modules/compose/README.md index 840805a0..e5be20b1 100644 --- a/docker-compose/common/config/alloy/modules/compose/README.md +++ b/alloy-modules/compose/README.md @@ -1,6 +1,17 @@ -# Docker Compose `labels_scrape` Components +# Alloy Modules - Docker Compose -## Logs +## Modules + +- [Logs](logs/) +- [Traces](traces/) +- [Metrics](metrics/) +- [Profiles](profiles/) +- [Jobs](jobs/) +- [Integrations](integrations/) + +## Compose `labels_scrape` Component for [`Logs`](logs/labels-scrape.alloy), [`Metrics`](metrics/labels-scrape.alloy) and [`Profiles`](profiles/labels-scrape.alloy) + +### Logs The following service labels are supported: @@ -11,7 +22,7 @@ The following service labels are supported: --- -## Metrics +### Metrics The following service labels are supported for gathering of metrics for docker compose services: @@ -28,7 +39,7 @@ The following service labels are supported for gathering of metrics for docker c --- -## Profiles +### Profiles The following service labels are supported for docker compose services: diff --git a/alloy-modules/compose/integrations/README.md b/alloy-modules/compose/integrations/README.md new file mode 100644 index 00000000..6c06064f --- /dev/null +++ b/alloy-modules/compose/integrations/README.md @@ -0,0 +1,9 @@ +# Integrations Components + +Docker Compose Integrations Components + +## Components + +- [cadvisor](cadvisor.alloy) +- [memcached](memcached.alloy) +- [node_exporter](node_exporter.alloy) diff --git a/docker-compose/common/config/alloy/modules/compose/integrations/cadvisor.alloy b/alloy-modules/compose/integrations/cadvisor.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/integrations/cadvisor.alloy rename to alloy-modules/compose/integrations/cadvisor.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/integrations/memcached.alloy b/alloy-modules/compose/integrations/memcached.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/integrations/memcached.alloy rename to alloy-modules/compose/integrations/memcached.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/integrations/node-exporter.alloy b/alloy-modules/compose/integrations/node-exporter.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/integrations/node-exporter.alloy rename to alloy-modules/compose/integrations/node-exporter.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/jobs/minio.alloy b/alloy-modules/compose/jobs/minio.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/jobs/minio.alloy rename to alloy-modules/compose/jobs/minio.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/logs/keep-labels.alloy b/alloy-modules/compose/logs/keep-labels.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/logs/keep-labels.alloy rename to alloy-modules/compose/logs/keep-labels.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/logs/labels-scrape.alloy b/alloy-modules/compose/logs/labels-scrape.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/logs/labels-scrape.alloy rename to alloy-modules/compose/logs/labels-scrape.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/metrics/integrations-scrape.alloy b/alloy-modules/compose/metrics/integrations-scrape.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/metrics/integrations-scrape.alloy rename to alloy-modules/compose/metrics/integrations-scrape.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/metrics/jobs-scrape.alloy b/alloy-modules/compose/metrics/jobs-scrape.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/metrics/jobs-scrape.alloy rename to alloy-modules/compose/metrics/jobs-scrape.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/metrics/labels-probe.alloy b/alloy-modules/compose/metrics/labels-probe.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/metrics/labels-probe.alloy rename to alloy-modules/compose/metrics/labels-probe.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/metrics/labels-scrape.alloy b/alloy-modules/compose/metrics/labels-scrape.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/metrics/labels-scrape.alloy rename to alloy-modules/compose/metrics/labels-scrape.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/profiles/labels-scrape.alloy b/alloy-modules/compose/profiles/labels-scrape.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/profiles/labels-scrape.alloy rename to alloy-modules/compose/profiles/labels-scrape.alloy diff --git a/docker-compose/common/config/alloy/modules/compose/traces/process-and-transform.alloy b/alloy-modules/compose/traces/process-and-transform.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/compose/traces/process-and-transform.alloy rename to alloy-modules/compose/traces/process-and-transform.alloy diff --git a/alloy-modules/kubernetes/README.md b/alloy-modules/kubernetes/README.md new file mode 100644 index 00000000..82561660 --- /dev/null +++ b/alloy-modules/kubernetes/README.md @@ -0,0 +1,12 @@ +# Alloy Modules - Kubernetes(WIP) + +## Modules + +- [Logs](logs/) +- [Traces](traces/) +- [Metrics](metrics/) +- [Profiles](profiles/) +- [Jobs](jobs/) +- [Integrations](integrations/) + +## Kubernetes `annotations_scrape` Component for [`Logs`](logs/annotations-scrape.alloy), [`Metrics`](metrics/annotations-scrape.alloy) and [`Profiles`](profiles/annotations-scrape.alloy) diff --git a/docker-compose/common/config/alloy/modules/provider/README.md b/alloy-modules/provider/README.md similarity index 68% rename from docker-compose/common/config/alloy/modules/provider/README.md rename to alloy-modules/provider/README.md index 18dabd01..6a26e0da 100644 --- a/docker-compose/common/config/alloy/modules/provider/README.md +++ b/alloy-modules/provider/README.md @@ -3,9 +3,8 @@ Provide the receivers of the collected data(`logs` `metrics` `traces` `profiles`). ## Components - -- [self_hosted_stack](#self_hosted_stack) -- [grafana_cloud](#grafana_cloud) + - [`self_hosted_stack`](#self_hosted_stack) + - [`grafana_cloud`](#grafana_cloud) ### `self_hosted_stack` @@ -13,17 +12,17 @@ Module to configure receivers for Self Hosted LGTMP Stack. ***Arguments*** -| Name | Required | Default | Description | -| :---------------------- | :------- | :-------------------------------------- | :--------------------------------- | -| `metrics_endpoint_url` | _no_ | `http://mimir:8080/api/v1/push` | Where to send collected `metrics`. | -| `logs_endpoint_url` | _no_ | `http://loki:3100/loki/api/v1/push` | Where to send collected `logs`. | -| `traces_endpoint_url` | _no_ | `http://tempo:4318` | Where to send collected `traces`. | -| `profiles_endpoint_url` | _no_ | `http://pyroscope:4040` | Where to send collected `profiles`.| +| Name | Required | Default | Description | +|:------------------------|:---------|:------------------------------------|:------------------------------------| +| `metrics_endpoint_url` | _no_ | `http://mimir:8080/api/v1/push` | Where to send collected `metrics`. | +| `logs_endpoint_url` | _no_ | `http://loki:3100/loki/api/v1/push` | Where to send collected `logs`. | +| `traces_endpoint_url` | _no_ | `http://tempo:4318` | Where to send collected `traces`. | +| `profiles_endpoint_url` | _no_ | `http://pyroscope:4040` | Where to send collected `profiles`. | ***Exports*** -| Name | Type | Description | -| --------------------| ------------------------ | ---------------------------------------------------------------- | +| 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. | @@ -35,8 +34,8 @@ Module to configure receivers for Self Hosted LGTMP Stack. import.git "provider" { repository = "https://github.com/qclaogui/codelab-monitoring.git" revision = "main" - path = "docker-compose/common/config/alloy/modules/provider" - pull_frequency = "15m" + path = "alloy-modules/provider" + pull_frequency = "24h" } // get the receivers from provider @@ -80,18 +79,18 @@ The token must have permissions to read stack information. The setup of these pe ***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. | +| 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). | ***Example*** @@ -100,8 +99,8 @@ The token must have permissions to read stack information. The setup of these pe import.git "provider" { repository = "https://github.com/qclaogui/codelab-monitoring.git" revision = "main" - path = "docker-compose/common/config/alloy/modules/provider" - pull_frequency = "15m" + path = "alloy-modules/provider" + pull_frequency = "24h" } // get the receivers from provider diff --git a/docker-compose/common/config/alloy/modules/provider/grafana_cloud.alloy b/alloy-modules/provider/grafana_cloud.alloy similarity index 100% rename from docker-compose/common/config/alloy/modules/provider/grafana_cloud.alloy rename to alloy-modules/provider/grafana_cloud.alloy diff --git a/docker-compose/common/config/alloy/modules/provider/self_hosted.alloy b/alloy-modules/provider/self_hosted.alloy similarity index 98% rename from docker-compose/common/config/alloy/modules/provider/self_hosted.alloy rename to alloy-modules/provider/self_hosted.alloy index 03b8cc7a..5acddacc 100644 --- a/docker-compose/common/config/alloy/modules/provider/self_hosted.alloy +++ b/alloy-modules/provider/self_hosted.alloy @@ -1,6 +1,6 @@ /************************************************ * Component: self_hosted_stack -* Description: Self Hosteded Receiver Provider +* Description: Self Hosted Receiver Provider *************************************************/ declare "self_hosted_stack" { diff --git a/compose.override.yaml b/compose.override.yaml index 363d0a3e..325d7ff7 100644 --- a/compose.override.yaml +++ b/compose.override.yaml @@ -1,5 +1,5 @@ -# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md +# https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md x-labels: &profiles-labels profiles.grafana.com/cpu.scrape: true profiles.grafana.com/memory.scrape: true diff --git a/docker-compose/common/compose-include/alloy.yaml b/docker-compose/common/compose-include/alloy.yaml index 09037392..104d1cc9 100644 --- a/docker-compose/common/compose-include/alloy.yaml +++ b/docker-compose/common/compose-include/alloy.yaml @@ -6,7 +6,7 @@ services: - source: alloy_config_file target: /etc/alloy/config.alloy volumes: - - ../config/alloy/modules:/etc/alloy/modules + - ../../../alloy-modules:/etc/alloy/modules - /var/run/docker.sock:/var/run/docker.sock:ro - /var/lib/docker:/var/lib/docker:ro - /:/rootfs:ro diff --git a/docker-compose/common/compose-include/loki.yaml b/docker-compose/common/compose-include/loki.yaml index 98e13452..2a44022d 100644 --- a/docker-compose/common/compose-include/loki.yaml +++ b/docker-compose/common/compose-include/loki.yaml @@ -12,7 +12,7 @@ services: - -config.expand-env=true healthcheck: test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ] - interval: 2s + interval: 3s timeout: 1s retries: 15 # expose 33100 port so we can directly access loki inside container diff --git a/docker-compose/common/compose-include/minio.yaml b/docker-compose/common/compose-include/minio.yaml index b2f14987..17e2cacb 100644 --- a/docker-compose/common/compose-include/minio.yaml +++ b/docker-compose/common/compose-include/minio.yaml @@ -1,7 +1,7 @@ services: minio: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: logs.grafana.com/scrape: false metrics.grafana.com/scrape: true diff --git a/docker-compose/common/compose-include/tempo.yaml b/docker-compose/common/compose-include/tempo.yaml index 95774c35..1eac45c5 100644 --- a/docker-compose/common/compose-include/tempo.yaml +++ b/docker-compose/common/compose-include/tempo.yaml @@ -13,7 +13,7 @@ services: - -config.expand-env=true healthcheck: test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3200/ready || exit 1" ] - interval: 2s + interval: 3s timeout: 1s retries: 15 # expose 33200 port so we can directly access tempo inside container diff --git a/docker-compose/common/config/alloy/all-in-one.alloy b/docker-compose/common/config/alloy/all-in-one.alloy index eb310e32..1127e18d 100644 --- a/docker-compose/common/config/alloy/all-in-one.alloy +++ b/docker-compose/common/config/alloy/all-in-one.alloy @@ -6,6 +6,15 @@ logging { /******************************************** * Grafana LGTMP Stack Receiver Provider ********************************************/ +// // git remote +// import.git "provider" { +// repository = "https://github.com/qclaogui/codelab-monitoring.git" +// revision = "main" +// path = "alloy-modules/provider" +// pull_frequency = "24h" +// } + +// local file import.file "provider" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider" } @@ -25,18 +34,18 @@ import.file "metrics" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics" } -metrics.labels_scrape "all" { +metrics.labels_scrape "compose" { label_prefix = "metrics.grafana.com" forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.jobs_scrape "all" { +metrics.jobs_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.integrations_scrape "all" { +metrics.integrations_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } @@ -48,13 +57,13 @@ import.file "logs" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/logs" } -logs.labels_scrape "all" { +logs.labels_scrape "compose" { label_prefix = "logs.grafana.com" forward_to = [logs.keep_labels.default.receiver] } // logs Processing And Transformation -logs.keep_labels "default" { +logs.keep_labels "compose" { forward_to = [provider.self_hosted_stack.compose.logs_receiver] } diff --git a/docker-compose/common/config/alloy/logs.alloy b/docker-compose/common/config/alloy/logs.alloy index 015f930d..3bc714b1 100644 --- a/docker-compose/common/config/alloy/logs.alloy +++ b/docker-compose/common/config/alloy/logs.alloy @@ -6,6 +6,15 @@ logging { /******************************************** * Grafana LGTMP Stack Receiver Provider ********************************************/ +// // git remote +// import.git "provider" { +// repository = "https://github.com/qclaogui/codelab-monitoring.git" +// revision = "main" +// path = "alloy-modules/provider" +// pull_frequency = "24h" +// } + +// local file import.file "provider" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider" } @@ -23,13 +32,13 @@ import.file "logs" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/logs" } -logs.labels_scrape "all" { +logs.labels_scrape "compose" { label_prefix = "logs.grafana.com" forward_to = [logs.keep_labels.default.receiver] } // logs Processing And Transformation -logs.keep_labels "default" { +logs.keep_labels "compose" { forward_to = [provider.self_hosted_stack.compose.logs_receiver] } @@ -40,18 +49,18 @@ import.file "metrics" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics" } -metrics.labels_scrape "all" { +metrics.labels_scrape "compose" { label_prefix = "metrics.grafana.com" forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.jobs_scrape "all" { +metrics.jobs_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.integrations_scrape "all" { +metrics.integrations_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } diff --git a/docker-compose/common/config/alloy/metrics.alloy b/docker-compose/common/config/alloy/metrics.alloy index 13c640db..c3b0ed50 100644 --- a/docker-compose/common/config/alloy/metrics.alloy +++ b/docker-compose/common/config/alloy/metrics.alloy @@ -6,6 +6,15 @@ logging { /******************************************** * Grafana LGTMP Stack Receiver Provider ********************************************/ +// // git remote +// import.git "provider" { +// repository = "https://github.com/qclaogui/codelab-monitoring.git" +// revision = "main" +// path = "alloy-modules/provider" +// pull_frequency = "24h" +// } + +// local file import.file "provider" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider" } @@ -22,18 +31,18 @@ import.file "metrics" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics" } -metrics.labels_scrape "all" { +metrics.labels_scrape "compose" { label_prefix = "metrics.grafana.com" forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.jobs_scrape "all" { +metrics.jobs_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.integrations_scrape "all" { +metrics.integrations_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } diff --git a/docker-compose/common/config/alloy/profiles.alloy b/docker-compose/common/config/alloy/profiles.alloy index 047596b0..58a07ec8 100644 --- a/docker-compose/common/config/alloy/profiles.alloy +++ b/docker-compose/common/config/alloy/profiles.alloy @@ -6,6 +6,15 @@ logging { /******************************************** * Grafana LGTMP Stack Receiver Provider ********************************************/ +// // git remote +// import.git "provider" { +// repository = "https://github.com/qclaogui/codelab-monitoring.git" +// revision = "main" +// path = "alloy-modules/provider" +// pull_frequency = "24h" +// } + +// local file import.file "provider" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider" } @@ -35,18 +44,18 @@ import.file "metrics" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics" } -metrics.labels_scrape "all" { +metrics.labels_scrape "compose" { label_prefix = "metrics.grafana.com" forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.jobs_scrape "all" { +metrics.jobs_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.integrations_scrape "all" { +metrics.integrations_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } diff --git a/docker-compose/common/config/alloy/traces.alloy b/docker-compose/common/config/alloy/traces.alloy index e544509f..73301ac3 100644 --- a/docker-compose/common/config/alloy/traces.alloy +++ b/docker-compose/common/config/alloy/traces.alloy @@ -6,6 +6,15 @@ logging { /******************************************** * Grafana LGTMP Stack Receiver Provider ********************************************/ +// // git remote +// import.git "provider" { +// repository = "https://github.com/qclaogui/codelab-monitoring.git" +// revision = "main" +// path = "alloy-modules/provider" +// pull_frequency = "24h" +// } + +// local file import.file "provider" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/provider" } @@ -46,18 +55,18 @@ import.file "metrics" { filename = coalesce(env("ALLOY_MODULES_FOLDER"), "/etc/alloy/modules") + "/compose/metrics" } -metrics.labels_scrape "all" { +metrics.labels_scrape "compose" { label_prefix = "metrics.grafana.com" forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.jobs_scrape "all" { +metrics.jobs_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } -metrics.integrations_scrape "all" { +metrics.integrations_scrape "compose" { forward_to = [provider.self_hosted_stack.compose.metrics_receiver] scrape_interval = "15s" } diff --git a/docker-compose/microservices-mode/logs/compose.yaml b/docker-compose/microservices-mode/logs/compose.yaml index 0f174c99..7717e740 100644 --- a/docker-compose/microservices-mode/logs/compose.yaml +++ b/docker-compose/microservices-mode/logs/compose.yaml @@ -14,7 +14,7 @@ include: - path: ../../common/compose-include/grafana.yaml - path: ../../common/compose-include/alloy.yaml -# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md +# https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md x-labels: &loki-labels logs.grafana.com/log-format: json @@ -31,7 +31,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false logs.grafana.com/log-format: nginx diff --git a/docker-compose/microservices-mode/metrics/compose.yaml b/docker-compose/microservices-mode/metrics/compose.yaml index 161735d4..553302f4 100644 --- a/docker-compose/microservices-mode/metrics/compose.yaml +++ b/docker-compose/microservices-mode/metrics/compose.yaml @@ -25,7 +25,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: - metrics.grafana.com/scrape=false depends_on: { distributor: { condition: service_healthy }, ruler: { condition: service_healthy } } diff --git a/docker-compose/microservices-mode/profiles/compose.yaml b/docker-compose/microservices-mode/profiles/compose.yaml index 75e936ff..c8187562 100644 --- a/docker-compose/microservices-mode/profiles/compose.yaml +++ b/docker-compose/microservices-mode/profiles/compose.yaml @@ -14,7 +14,7 @@ include: - path: ../../common/compose-include/grafana.yaml - path: ../../common/compose-include/alloy.yaml -# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md +# https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md x-labels: &profiles-labels profiles.grafana.com/cpu.scrape: true profiles.grafana.com/memory.scrape: true @@ -33,7 +33,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false depends_on: { distributor: { condition: service_healthy } } diff --git a/docker-compose/microservices-mode/traces/compose.yaml b/docker-compose/microservices-mode/traces/compose.yaml index 63844084..92aa1841 100644 --- a/docker-compose/microservices-mode/traces/compose.yaml +++ b/docker-compose/microservices-mode/traces/compose.yaml @@ -34,7 +34,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false depends_on: { distributor: { condition: service_healthy } } diff --git a/docker-compose/monolithic-mode/all-in-one/compose.yaml b/docker-compose/monolithic-mode/all-in-one/compose.yaml index 814e050d..066ae814 100644 --- a/docker-compose/monolithic-mode/all-in-one/compose.yaml +++ b/docker-compose/monolithic-mode/all-in-one/compose.yaml @@ -13,7 +13,7 @@ include: - path: ../../common/compose-include/grafana.yaml - path: ../../common/compose-include/alloy.yaml -# https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md +# https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md x-labels: &profiles-labels profiles.grafana.com/cpu.scrape: true profiles.grafana.com/memory.scrape: true @@ -29,8 +29,8 @@ x-environment: &jaeger-environment # docs: https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck x-healthcheck: &status-healthcheck interval: 3s - timeout: 2s - retries: 10 + timeout: 1s + retries: 15 configs: alloy_config_file: @@ -136,7 +136,7 @@ services: - mimir-memberlist mimirtool: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false image: ${MIMIRTOOL_IMAGE:-docker.io/grafana/mimirtool:2.12.0} diff --git a/docker-compose/read-write-mode/logs/compose.yaml b/docker-compose/read-write-mode/logs/compose.yaml index a866320b..5993680e 100644 --- a/docker-compose/read-write-mode/logs/compose.yaml +++ b/docker-compose/read-write-mode/logs/compose.yaml @@ -27,7 +27,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false depends_on: { loki-write: { condition: service_healthy } } diff --git a/docker-compose/read-write-mode/metrics/compose.yaml b/docker-compose/read-write-mode/metrics/compose.yaml index 81c90354..6416f755 100644 --- a/docker-compose/read-write-mode/metrics/compose.yaml +++ b/docker-compose/read-write-mode/metrics/compose.yaml @@ -25,7 +25,7 @@ configs: services: gateway: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: false depends_on: { mimir-write: { condition: service_healthy }, mimir-backend: { condition: service_healthy } } diff --git a/examples/ghe-with-mixin/compose.yaml b/examples/ghe-with-mixin/compose.yaml index e1fb7e4c..205e68c0 100644 --- a/examples/ghe-with-mixin/compose.yaml +++ b/examples/ghe-with-mixin/compose.yaml @@ -22,7 +22,7 @@ include: services: github-exporter: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: true image: githubexporter/github-exporter:1.1.0 diff --git a/examples/ghe-with-simple-dashboards/compose.yaml b/examples/ghe-with-simple-dashboards/compose.yaml index e1fb7e4c..205e68c0 100644 --- a/examples/ghe-with-simple-dashboards/compose.yaml +++ b/examples/ghe-with-simple-dashboards/compose.yaml @@ -22,7 +22,7 @@ include: services: github-exporter: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: true image: githubexporter/github-exporter:1.1.0 diff --git a/examples/github-exporter/compose.yaml b/examples/github-exporter/compose.yaml index 2015b608..fe2eab55 100644 --- a/examples/github-exporter/compose.yaml +++ b/examples/github-exporter/compose.yaml @@ -24,7 +24,7 @@ include: services: github-exporter: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: true image: githubexporter/github-exporter:1.1.0 diff --git a/examples/grafana-oncall/compose.yaml b/examples/grafana-oncall/compose.yaml index 76d67097..d97a8928 100644 --- a/examples/grafana-oncall/compose.yaml +++ b/examples/grafana-oncall/compose.yaml @@ -52,7 +52,7 @@ x-environment: &oncall-environment services: engine: - # https://github.com/qclaogui/codelab-monitoring/blob/main/docker-compose/common/config/alloy/modules/compose/README.md + # https://github.com/qclaogui/codelab-monitoring/blob/main/alloy-modules/compose/README.md labels: metrics.grafana.com/scrape: true # metrics are exposed on path /metrics/ and not on /metrics