From a107c4000b3092bf255156a8f1fa311075b33206 Mon Sep 17 00:00:00 2001 From: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:25:01 -0700 Subject: [PATCH] Delete old tutorials remove old assets and move all up one level (#100) --- docs/sources/tutorials/_index.md | 6 +- .../tutorials/assets/docker-compose.yaml | 36 - .../tutorials/assets/flow_configs/agent.river | 19 - .../assets/flow_configs/example.river | 14 - .../assets/flow_configs/multiple-inputs.river | 25 - .../assets/flow_configs/relabel.river | 24 - docs/sources/tutorials/assets/generate.sh | 35 - .../assets/grafana/config/grafana.ini | 9 - .../dashboards-provisioning/dashboards.yaml | 14 - .../assets/grafana/dashboards/agent.json | 786 ------------------ .../grafana/dashboards/template.jsonnet | 14 - .../assets/grafana/datasources/datasource.yml | 15 - .../sources/tutorials/assets/mimir/mimir.yaml | 44 - docs/sources/tutorials/assets/runt.sh | 28 - docs/sources/tutorials/chaining.md | 85 -- .../collecting-prometheus-metrics.md | 100 --- docs/sources/tutorials/filtering-metrics.md | 55 -- .../first-components-and-stdlib/index.md | 0 .../tutorials/flow-by-example/_index.md | 12 - .../{flow-by-example => }/get-started.md | 0 .../logs-and-relabeling-basics/index.md | 0 .../processing-logs/index.md | 0 22 files changed, 3 insertions(+), 1318 deletions(-) delete mode 100644 docs/sources/tutorials/assets/docker-compose.yaml delete mode 100644 docs/sources/tutorials/assets/flow_configs/agent.river delete mode 100644 docs/sources/tutorials/assets/flow_configs/example.river delete mode 100644 docs/sources/tutorials/assets/flow_configs/multiple-inputs.river delete mode 100644 docs/sources/tutorials/assets/flow_configs/relabel.river delete mode 100644 docs/sources/tutorials/assets/generate.sh delete mode 100644 docs/sources/tutorials/assets/grafana/config/grafana.ini delete mode 100644 docs/sources/tutorials/assets/grafana/dashboards-provisioning/dashboards.yaml delete mode 100644 docs/sources/tutorials/assets/grafana/dashboards/agent.json delete mode 100644 docs/sources/tutorials/assets/grafana/dashboards/template.jsonnet delete mode 100644 docs/sources/tutorials/assets/grafana/datasources/datasource.yml delete mode 100644 docs/sources/tutorials/assets/mimir/mimir.yaml delete mode 100644 docs/sources/tutorials/assets/runt.sh delete mode 100644 docs/sources/tutorials/chaining.md delete mode 100644 docs/sources/tutorials/collecting-prometheus-metrics.md delete mode 100644 docs/sources/tutorials/filtering-metrics.md rename docs/sources/tutorials/{flow-by-example => }/first-components-and-stdlib/index.md (100%) delete mode 100644 docs/sources/tutorials/flow-by-example/_index.md rename docs/sources/tutorials/{flow-by-example => }/get-started.md (100%) rename docs/sources/tutorials/{flow-by-example => }/logs-and-relabeling-basics/index.md (100%) rename docs/sources/tutorials/{flow-by-example => }/processing-logs/index.md (100%) diff --git a/docs/sources/tutorials/_index.md b/docs/sources/tutorials/_index.md index 03760aa536..91fcbcffe0 100644 --- a/docs/sources/tutorials/_index.md +++ b/docs/sources/tutorials/_index.md @@ -1,12 +1,12 @@ --- -canonical: https://grafana.com/docs/alloy/latest/tutorials/ +canonical: https://grafana.com/docs/alloy/latest/tutorials/flow-by-example/ description: Learn how to use Grafana Alloy title: Tutorials -weight: 300 +weight: 100 --- # Tutorials -This section provides tutorials for learning how to use {{< param "PRODUCT_NAME" >}}. +This section provides a set of step-by-step tutorials that show how to use {{< param "PRODUCT_NAME" >}}. {{< section >}} diff --git a/docs/sources/tutorials/assets/docker-compose.yaml b/docs/sources/tutorials/assets/docker-compose.yaml deleted file mode 100644 index 1346a0861f..0000000000 --- a/docs/sources/tutorials/assets/docker-compose.yaml +++ /dev/null @@ -1,36 +0,0 @@ -version: '3' - -services: - mimir: - image: grafana/mimir:latest - volumes: - - ./mimir:/etc/mimir-config - entrypoint: - - /bin/mimir - - -config.file=/etc/mimir-config/mimir.yaml - ports: - - "9009:9009" - agent: - image: grafana/agent:main - ports: - - 12345:12345 - volumes: - - ./flow_configs:/etc/agent-config - entrypoint: - - /bin/grafana-agent - - run - - --server.http.listen-addr=0.0.0.0:12345 - - /etc/agent-config/$CONFIG_FILE - grafana: - image: grafana/grafana:8.3.3 - entrypoint: - - /usr/share/grafana/bin/grafana-server - - --homepath=/usr/share/grafana - - --config=/etc/grafana-config/grafana.ini - volumes: - - ./grafana/config:/etc/grafana-config - - ./grafana/datasources:/etc/grafana/provisioning/datasources - - ./grafana/dashboards-provisioning:/etc/grafana/provisioning/dashboards - - ./grafana/dashboards:/var/lib/grafana/dashboards - ports: - - "3000:3000" diff --git a/docs/sources/tutorials/assets/flow_configs/agent.river b/docs/sources/tutorials/assets/flow_configs/agent.river deleted file mode 100644 index 8aeb2bc920..0000000000 --- a/docs/sources/tutorials/assets/flow_configs/agent.river +++ /dev/null @@ -1,19 +0,0 @@ -// Create a prometheus.scrape component labeled "default." -prometheus.scrape "default" { - // Collect metrics from `http://localhost:12345/metrics`. - // The http:// protocol and /metrics path are implied by default - // but can be overridden. - targets = [{"__address__" = "localhost:12345"}] - - // Forward collected metrics to the receiver. forward_to - // is a common argument name used for forwarding Prometheus metrics. - // Receiver is an exported field of prometheus.remote_write.prom which - // can accept metrics. - forward_to = [prometheus.remote_write.prom.receiver] -} - -prometheus.remote_write "prom" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} diff --git a/docs/sources/tutorials/assets/flow_configs/example.river b/docs/sources/tutorials/assets/flow_configs/example.river deleted file mode 100644 index 26d2b86d68..0000000000 --- a/docs/sources/tutorials/assets/flow_configs/example.river +++ /dev/null @@ -1,14 +0,0 @@ -prometheus.exporter.unix "default" { - set_collectors = ["cpu", "diskstats"] -} - -prometheus.scrape "my_scrape_job" { - targets = prometheus.exporter.unix.default.targets - forward_to = [prometheus.remote_write.default.receiver] -} - -prometheus.remote_write "default" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} diff --git a/docs/sources/tutorials/assets/flow_configs/multiple-inputs.river b/docs/sources/tutorials/assets/flow_configs/multiple-inputs.river deleted file mode 100644 index 57505a2798..0000000000 --- a/docs/sources/tutorials/assets/flow_configs/multiple-inputs.river +++ /dev/null @@ -1,25 +0,0 @@ -prometheus.scrape "first" { - targets = [{"__address__" = "localhost:12345"}] - forward_to = [prometheus.relabel.service.receiver] -} - -prometheus.scrape "second" { - targets = [{"__address__" = "localhost:12345"}] - forward_to = [prometheus.relabel.service.receiver] -} - -prometheus.relabel "service" { - rule { - source_labels = ["__name__"] - regex = "(.+)" - replacement = "api_server" - target_label = "service" - } - forward_to = [prometheus.remote_write.prom.receiver] -} - -prometheus.remote_write "prom" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} diff --git a/docs/sources/tutorials/assets/flow_configs/relabel.river b/docs/sources/tutorials/assets/flow_configs/relabel.river deleted file mode 100644 index f0d9193fe0..0000000000 --- a/docs/sources/tutorials/assets/flow_configs/relabel.river +++ /dev/null @@ -1,24 +0,0 @@ -prometheus.scrape "default" { - targets = [{"__address__" = "localhost:12345"}] - forward_to = [prometheus.relabel.filter.receiver] -} - -// The prometheus.relabel component allows you to filter and mutate metrics. -// Here, we combine the metric name (from the __name__ label) with the string -// "api_server" into a new label called "service". The resulting mutated metrics -// are then forwarded to our prometheus.remote_write component. -prometheus.relabel "filter" { - rule { - source_labels = ["__name__"] - regex = "(.+)" - replacement = "api_server" - target_label = "service" - } - forward_to = [prometheus.remote_write.prom.receiver] -} - -prometheus.remote_write "prom" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} diff --git a/docs/sources/tutorials/assets/generate.sh b/docs/sources/tutorials/assets/generate.sh deleted file mode 100644 index 507e39e031..0000000000 --- a/docs/sources/tutorials/assets/generate.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# This script generates runt.sh script that pulls down the needed files and runs them for the tutorials themselves. -# This needs to be reran anytime new tutorials are added with new docker composes. -# The runt.sh file is meant to download all the needed files for the example and for them to be used. - -echo "#!/usr/bin/env bash" > runt.sh -echo "mkdir ./tutorials" >> runt.sh -echo "cd ./tutorials || exit" >> runt.sh - - -# Instead of `for find .` doing it this way due to https://www.shellcheck.net/wiki/SC2044. -while IFS= read -r -d '' i -do - # Ignore current directory, png and ds_store files. - if [[ $i == "." || $i == "./.DS_Store" || $i == *.png || $i == *.sh ]]; - then - continue - fi - # If this is a directory create the directory ignoring if it already exists (-p). - if [ -d "$i" ]; - then - echo "mkdir -p $i" >> runt.sh - else - # Trim the '.' off the beginning, the file is './assets/file.flow' and need to remove '.'. - trimName="${i:1}" - # TODO at some point change this to release. - echo "curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets$trimName -o $i" >> runt.sh - fi -done < <(find . -print0) - -# Always pull the newest. -# TODO at some point change this from main. -echo "docker pull grafana/agent:main " >> runt.sh -echo "CONFIG_FILE=\$1 docker-compose -f ./docker-compose.yaml up" >> runt.sh diff --git a/docs/sources/tutorials/assets/grafana/config/grafana.ini b/docs/sources/tutorials/assets/grafana/config/grafana.ini deleted file mode 100644 index ba1078c518..0000000000 --- a/docs/sources/tutorials/assets/grafana/config/grafana.ini +++ /dev/null @@ -1,9 +0,0 @@ -[analytics] -reporting_enabled = false -[auth.anonymous] -enabled = true -org_role = Admin -[explore] -enabled = true -[users] -default_theme = dark diff --git a/docs/sources/tutorials/assets/grafana/dashboards-provisioning/dashboards.yaml b/docs/sources/tutorials/assets/grafana/dashboards-provisioning/dashboards.yaml deleted file mode 100644 index c038adf8e3..0000000000 --- a/docs/sources/tutorials/assets/grafana/dashboards-provisioning/dashboards.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: 1 - -providers: -- name: 'dashboards' - orgId: 1 - folder: '' - folderUid: '' - type: file - disableDeletion: true - editable: true - updateIntervalSeconds: 10 - allowUiUpdates: false - options: - path: /var/lib/grafana/dashboards diff --git a/docs/sources/tutorials/assets/grafana/dashboards/agent.json b/docs/sources/tutorials/assets/grafana/dashboards/agent.json deleted file mode 100644 index 59afe87230..0000000000 --- a/docs/sources/tutorials/assets/grafana/dashboards/agent.json +++ /dev/null @@ -1,786 +0,0 @@ -{ - "annotations": { - "list": [ ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, - "links": [ ], - "refresh": "30s", - "rows": [ - { - "collapse": false, - "height": "250px", - "panels": [ - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 1, - "id": 1, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 12, - "stack": false, - "steppedLine": false, - "styles": [ - { - "alias": "Time", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "Time", - "type": "hidden" - }, - { - "alias": "Count", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "link": false, - "linkTargetBlank": false, - "linkTooltip": "Drill down", - "linkUrl": "", - "pattern": "Value #A", - "thresholds": [ ], - "type": "hidden", - "unit": "short" - }, - { - "alias": "Uptime", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "link": false, - "linkTargetBlank": false, - "linkTooltip": "Drill down", - "linkUrl": "", - "pattern": "Value #B", - "thresholds": [ ], - "type": "number", - "unit": "short" - }, - { - "alias": "Container", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "link": false, - "linkTargetBlank": false, - "linkTooltip": "Drill down", - "linkUrl": "", - "pattern": "container", - "thresholds": [ ], - "type": "number", - "unit": "short" - }, - { - "alias": "Pod", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "link": false, - "linkTargetBlank": false, - "linkTooltip": "Drill down", - "linkUrl": "", - "pattern": "pod", - "thresholds": [ ], - "type": "number", - "unit": "short" - }, - { - "alias": "Version", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "link": false, - "linkTargetBlank": false, - "linkTooltip": "Drill down", - "linkUrl": "", - "pattern": "version", - "thresholds": [ ], - "type": "number", - "unit": "short" - }, - { - "alias": "", - "colorMode": null, - "colors": [ ], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "pattern": "/.*/", - "thresholds": [ ], - "type": "string", - "unit": "short" - } - ], - "targets": [ - { - "expr": "count by (pod, container, version) (alloy_build_info{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"})", - "format": "table", - "instant": true, - "intervalFactor": 2, - "legendFormat": "", - "refId": "A", - "step": 10 - }, - { - "expr": "max by (pod, container) (time() - process_start_time_seconds{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"})", - "format": "table", - "instant": true, - "intervalFactor": 2, - "legendFormat": "", - "refId": "B", - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Agent Stats", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "transform": "table", - "type": "table", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - } - ], - "repeat": null, - "repeatIteration": null, - "repeatRowId": null, - "showTitle": true, - "title": "Agent Stats", - "titleSize": "h6" - }, - { - "collapse": false, - "height": "250px", - "panels": [ - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 1, - "id": 2, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 6, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "sum(rate(prometheus_target_sync_length_seconds_sum{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[5m])) by (pod, scrape_job) * 1e3", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{pod}}/{{scrape_job}}", - "legendLink": null, - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Target Sync", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "ms", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - }, - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 10, - "id": 3, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 0, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 6, - "stack": true, - "steppedLine": false, - "targets": [ - { - "expr": "sum by (pod) (prometheus_sd_discovered_targets{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"})", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{pod}}", - "legendLink": null, - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Targets", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - } - ], - "repeat": null, - "repeatIteration": null, - "repeatRowId": null, - "showTitle": true, - "title": "Prometheus Discovery", - "titleSize": "h6" - }, - { - "collapse": false, - "height": "250px", - "panels": [ - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 1, - "id": 4, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "rate(prometheus_target_interval_length_seconds_sum{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[5m])\n/\nrate(prometheus_target_interval_length_seconds_count{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[5m])\n* 1e3\n", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{pod}} {{interval}} configured", - "legendLink": null, - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Average Scrape Interval Duration", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "ms", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - }, - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 10, - "id": 5, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 0, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 4, - "stack": true, - "steppedLine": false, - "targets": [ - { - "expr": "sum by (job) (rate(prometheus_target_scrapes_exceeded_sample_limit_total{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[1m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "exceeded sample limit: {{job}}", - "legendLink": null, - "step": 10 - }, - { - "expr": "sum by (job) (rate(prometheus_target_scrapes_sample_duplicate_timestamp_total{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[1m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "duplicate timestamp: {{job}}", - "legendLink": null, - "step": 10 - }, - { - "expr": "sum by (job) (rate(prometheus_target_scrapes_sample_out_of_bounds_total{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[1m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "out of bounds: {{job}}", - "legendLink": null, - "step": 10 - }, - { - "expr": "sum by (job) (rate(prometheus_target_scrapes_sample_out_of_order_total{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[1m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "out of order: {{job}}", - "legendLink": null, - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Scrape failures", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - }, - { - "aliasColors": { }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "fill": 10, - "id": 6, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 0, - "links": [ ], - "nullPointMode": "null as zero", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ ], - "spaceLength": 10, - "span": 4, - "stack": true, - "steppedLine": false, - "targets": [ - { - "expr": "sum by (job, instance_group_name) (rate(prometheus_remote_write_wal_samples_appended_total{cluster=~\"$cluster\", namespace=~\"$namespace\", container=~\"$container\"}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{job}} {{instance_group_name}}", - "legendLink": null, - "step": 10 - } - ], - "thresholds": [ ], - "timeFrom": null, - "timeShift": null, - "title": "Appended Samples", - "tooltip": { - "shared": true, - "sort": 2, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [ ] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": 0, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - } - ], - "repeat": null, - "repeatIteration": null, - "repeatRowId": null, - "showTitle": true, - "title": "Prometheus Retrieval", - "titleSize": "h6" - } - ], - "schemaVersion": 14, - "style": "dark", - "tags": [ - "grafana-agent-mixin" - ], - "templating": { - "list": [ - { - "current": { - "text": "default", - "value": "default" - }, - "hide": 0, - "label": "Data Source", - "name": "datasource", - "options": [ ], - "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "allValue": ".+", - "current": { - "selected": true, - "text": "All", - "value": "$__all" - }, - "datasource": "$datasource", - "hide": 0, - "includeAll": true, - "label": "cluster", - "multi": true, - "name": "cluster", - "options": [ ], - "query": "label_values(alloy_build_info, cluster)", - "refresh": 1, - "regex": "", - "sort": 2, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false - }, - { - "allValue": ".+", - "current": { - "selected": true, - "text": "All", - "value": "$__all" - }, - "datasource": "$datasource", - "hide": 0, - "includeAll": true, - "label": "namespace", - "multi": true, - "name": "namespace", - "options": [ ], - "query": "label_values(alloy_build_info, namespace)", - "refresh": 1, - "regex": "", - "sort": 2, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false - }, - { - "allValue": ".+", - "current": { - "selected": true, - "text": "All", - "value": "$__all" - }, - "datasource": "$datasource", - "hide": 0, - "includeAll": true, - "label": "container", - "multi": true, - "name": "container", - "options": [ ], - "query": "label_values(alloy_build_info, container)", - "refresh": 1, - "regex": "", - "sort": 2, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false - }, - { - "allValue": "grafana-agent-.*", - "current": { - "selected": true, - "text": "All", - "value": "$__all" - }, - "datasource": "$datasource", - "hide": 0, - "includeAll": true, - "label": "pod", - "multi": true, - "name": "pod", - "options": [ ], - "query": "label_values(alloy_build_info{container=~\"$container\"}, pod)", - "refresh": 1, - "regex": "", - "sort": 2, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "timezone": "", - "title": "Agent", - "uid": "", - "version": 0 -} diff --git a/docs/sources/tutorials/assets/grafana/dashboards/template.jsonnet b/docs/sources/tutorials/assets/grafana/dashboards/template.jsonnet deleted file mode 100644 index edc4602189..0000000000 --- a/docs/sources/tutorials/assets/grafana/dashboards/template.jsonnet +++ /dev/null @@ -1,14 +0,0 @@ -local agentDashboards = import 'grafana-agent-mixin/dashboards.libsonnet'; -local agentDebugging = import 'grafana-agent-mixin/debugging.libsonnet'; - -local result = agentDashboards + agentDebugging { - files: { - [name]: $.grafanaDashboards[name] { - // Use local timezone for local testing - timezone: '', - } - for name in std.objectFields($.grafanaDashboards) - }, -}; - -result.files diff --git a/docs/sources/tutorials/assets/grafana/datasources/datasource.yml b/docs/sources/tutorials/assets/grafana/datasources/datasource.yml deleted file mode 100644 index d17bf25b33..0000000000 --- a/docs/sources/tutorials/assets/grafana/datasources/datasource.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: 1 - -deleteDatasources: - - name: Mimir - -datasources: -- name: Mimir - type: prometheus - access: proxy - orgId: 1 - url: http://mimir:9009/prometheus - basicAuth: false - isDefault: false - version: 1 - editable: false \ No newline at end of file diff --git a/docs/sources/tutorials/assets/mimir/mimir.yaml b/docs/sources/tutorials/assets/mimir/mimir.yaml deleted file mode 100644 index 2c83f96706..0000000000 --- a/docs/sources/tutorials/assets/mimir/mimir.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Do not use this configuration in production. -# It is for demonstration purposes only. -multitenancy_enabled: false - -blocks_storage: - backend: filesystem - bucket_store: - sync_dir: /tmp/mimir/tsdb-sync - filesystem: - dir: /tmp/mimir/data/tsdb - tsdb: - dir: /tmp/mimir/tsdb - -compactor: - data_dir: /tmp/mimir/compactor - sharding_ring: - kvstore: - store: memberlist - -distributor: - ring: - instance_addr: 127.0.0.1 - kvstore: - store: memberlist - -ingester: - ring: - instance_addr: 127.0.0.1 - kvstore: - store: memberlist - replication_factor: 1 - -ruler_storage: - backend: filesystem - filesystem: - dir: /tmp/mimir/rules - -server: - http_listen_port: 9009 - log_level: error - -store_gateway: - sharding_ring: - replication_factor: 1 diff --git a/docs/sources/tutorials/assets/runt.sh b/docs/sources/tutorials/assets/runt.sh deleted file mode 100644 index 5377d871b8..0000000000 --- a/docs/sources/tutorials/assets/runt.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -mkdir ./tutorials -cd ./tutorials || exit -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/docker-compose.yaml -o ./docker-compose.yaml -mkdir -p ./mimir -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/mimir/mimir.yaml -o ./mimir/mimir.yaml -mkdir -p ./flow_configs -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/agent.flow -o ./flow_configs/agent.flow -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/example.flow -o ./flow_configs/example.flow -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/relabel.alloy -o ./flow_configs/relabel.alloy -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/multiple-inputs.alloy -o ./flow_configs/multiple-inputs.alloy -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/README.md -o ./flow_configs/README.md -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/relabel.flow -o ./flow_configs/relabel.flow -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/multiple-inputs.flow -o ./flow_configs/multiple-inputs.flow -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/agent.alloy -o ./flow_configs/agent.alloy -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/flow_configs/example.alloy -o ./flow_configs/example.alloy -mkdir -p ./grafana -mkdir -p ./grafana/datasources -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/datasources/datasource.yml -o ./grafana/datasources/datasource.yml -mkdir -p ./grafana/dashboards-provisioning -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/dashboards-provisioning/dashboards.yaml -o ./grafana/dashboards-provisioning/dashboards.yaml -mkdir -p ./grafana/config -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/config/grafana.ini -o ./grafana/config/grafana.ini -mkdir -p ./grafana/dashboards -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/dashboards/template.jsonnet -o ./grafana/dashboards/template.jsonnet -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/dashboards/agent.json -o ./grafana/dashboards/agent.json -docker pull grafana/agent:main -CONFIG_FILE=$1 docker-compose -f ./docker-compose.yaml up diff --git a/docs/sources/tutorials/chaining.md b/docs/sources/tutorials/chaining.md deleted file mode 100644 index e8094c5244..0000000000 --- a/docs/sources/tutorials/chaining.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -canonical: https://grafana.com/docs/alloy/latest/tutorials/chaining/ -description: Learn how to chain Prometheus components -menuTitle: Chain Prometheus components -title: Chain Prometheus components -weight: 400 ---- - -# Chain Prometheus components - -This tutorial shows how to use [multiple-inputs.alloy][] to send data to several different locations. This tutorial uses the same base as [Filtering metrics][]. - -A new concept introduced in {{< param "PRODUCT_NAME" >}} is chaining components together in a composable pipeline. -This promotes the reusability of components while offering flexibility. - -## Prerequisites - -* [Docker](https://www.docker.com/products/docker-desktop) - -## Run the example - -Run the following - -```bash -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/runt.sh -O && bash ./runt.sh multiple-inputs.alloy -``` - -The `runt.sh` script does: - -1. Downloads the configurations necessary for Mimir, Grafana, and {{< param "PRODUCT_NAME" >}}. -1. Downloads the docker image for {{< param "PRODUCT_NAME" >}} explicitly. -1. Runs the `docker-compose up` command to bring all the services up. - -Allow {{< param "PRODUCT_NAME" >}} to run for two minutes, then navigate to [Grafana][] to see {{< param "PRODUCT_NAME" >}} scrape metrics. -The [node_exporter][] metrics also show up now. - -There are two scrapes each sending metrics to one filter. Note the `job` label lists the full name of the scrape component. - -## Multiple outputs - -```alloy -prometheus.scrape "agent" { - targets = [{"__address__" = "localhost:12345"}] - forward_to = [prometheus.relabel.service.receiver] -} - -prometheus.exporter.unix "default" { - set_collectors = ["cpu", "diskstats"] -} - -prometheus.scrape "unix" { - targets = prometheus.exporter.unix.default.targets - forward_to = [prometheus.relabel.service.receiver] -} - -prometheus.relabel "service" { - rule { - source_labels = ["__name__"] - regex = "(.+)" - replacement = "api_server" - target_label = "service" - } - forward_to = [prometheus.remote_write.prom.receiver] -} - -prometheus.remote_write "prom" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} -``` - -In the {{< param "PRODUCT_NAME" >}} block, `prometheus.relabel.service` is being forwarded metrics from two sources `prometheus.scrape.agent` and `prometheus.exporter.unix default`. -This allows for a single relabel component to be used with any number of inputs. - -## Adding another relabel - -In `multiple-input.alloy` add a new `prometheus.relabel` component that adds a `version` label with the value of `v2` to all metrics after the `prometheus.relabel.service`. - -![Add a new label with the value v2](/media/docs/agent/screenshot-grafana-agent-chaining-scrape-v2.png) - -[multiple-inputs.alloy]: ../assets/flow_configs/multiple-inputs.alloy -[Filtering metrics]: ../filtering-metrics/ -[Grafana]: http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Mimir%22,%7B%22refId%22:%22A%22,%22instant%22:true,%22range%22:true,%22exemplar%22:true,%22expr%22:%22alloy_build_info%7B%7D%22%7D%5D -[node_exporter]: http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Mimir%22,%7B%22refId%22:%22A%22,%22instant%22:true,%22range%22:true,%22exemplar%22:true,%22expr%22:%22node_cpu_seconds_total%22%7D%5D diff --git a/docs/sources/tutorials/collecting-prometheus-metrics.md b/docs/sources/tutorials/collecting-prometheus-metrics.md deleted file mode 100644 index 57efe4df26..0000000000 --- a/docs/sources/tutorials/collecting-prometheus-metrics.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -canonical: https://grafana.com/docs/alloy/latest/tutorials/collecting-prometheus-metrics/ -description: Learn how to collect Prometheus metrics -menuTitle: Collect Prometheus metrics -title: Collect Prometheus metrics -weight: 200 ---- - -# Collect Prometheus metrics - -{{< param "PRODUCT_NAME" >}} is a telemetry collector with the primary goal of moving telemetry data from one location to another. -In this tutorial, you'll set up {{< param "PRODUCT_NAME" >}}. - -## Prerequisites - -* [Docker][] - -## Run the example - -Run the following command in a terminal window: - -```bash -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/runt.sh -O && bash ./runt.sh agent.alloy -``` - -The `runt.sh` script does: - -1. Downloads the configurations necessary for Mimir, Grafana, and {{< param "PRODUCT_NAME" >}}. -1. Downloads the docker image for {{< param "PRODUCT_NAME" >}} explicitly. -1. Runs the docker-compose up command to bring all the services up. - -Allow {{< param "PRODUCT_NAME" >}} to run for two minutes, then navigate to [Grafana][]. - -![Dashboard showing alloy_build_info metrics](/media/docs/agent/screenshot-grafana-agent-collect-metrics-build-info.png) - -This example scrapes the {{< param "PRODUCT_NAME" >}} `http://localhost:12345/metrics` endpoint and pushes those metrics to the Mimir instance. - -Navigate to `http://localhost:12345/graph` to view the {{< param "PRODUCT_NAME" >}} UI. - -![The User Interface](/media/docs/agent/screenshot-grafana-agent-collect-metrics-graph.png) - -{{< param "PRODUCT_NAME" >}} displays the component pipeline in a dependency graph. -See [Scraping component](#scraping-component) and [Remote Write component](#remote-write-component) for details about the components used in this configuration. -Click the nodes to navigate to the associated component page. There, you can view the state, health information, and, if applicable, the debug information. - -![Component information](/media/docs/agent/screenshot-grafana-agent-collect-metrics-comp-info.png) - -## Scraping component - -The [`prometheus.scrape`][prometheus.scrape] component is responsible for scraping the metrics of a particular endpoint and passing them on to another component. - -```alloy -// prometheus.scrape is the name of the component and "default" is its label. -prometheus.scrape "default" { - // Tell the scraper to scrape at http://localhost:12345/metrics. - // The http:// and metrics are implied but able to be overwritten. - targets = [{"__address__" = "localhost:12345"}] - // Forward the scrape results to the receiver. In general, - // Flow uses forward_to to tell which receiver to send results to. - // The forward_to is an argument of prometheus.scrape.default and - // the receiver is an exported field of prometheus.remote_write.prom. - forward_to = [prometheus.remote_write.prom.receiver] -} -``` - -The `prometheus.scrape "default"` annotation indicates the name of the component, `prometheus.scrape`, and its label, `default`. -All components must have a unique combination of name and if applicable label. - -The `targets` [attribute][] is an [argument][]. `targets` is a list of labels that specify the target via the special key `__address__`. -The scraper is targeting the {{< param "PRODUCT_NAME" >}} `/metrics` endpoint. Both `http` and `/metrics` are implied but can be overridden. - -The `forward_to` attribute is an argument that references the [export][] of the `prometheus.remote_write.prom` component. -This is where the scraper will send the metrics for further processing. - -## Remote Write component - -The [`prometheus.remote_write`][prometheus.remote_write] component is responsible for writing the metrics to a Prometheus-compatible endpoint (Mimir). - -```alloy -prometheus.remote_write "prom" { - endpoint { - url = "http://mimir:9009/api/v1/push" - } -} -``` - -## Running without Docker - -To try out {{< param "PRODUCT_NAME" >}} without using Docker: -1. Download {{< param "PRODUCT_NAME" >}}. -1. Run the {{< param "PRODUCT_NAME" >}} with `alloy run `. - - -[Docker]: https://www.docker.com/products/docker-desktop -[Grafana]: http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Mimir%22,%7B%22refId%22:%22A%22,%22instant%22:true,%22range%22:true,%22exemplar%22:true,%22expr%22:%22alloy_build_info%7B%7D%22%7D%5D -[prometheus.scrape]: ../../reference/components/prometheus.scrape/ -[attribute]: ../../concepts/config-language/#attributes -[argument]: ../../concepts/components/ -[export]: ../../concepts/components/ -[prometheus.remote_write]: ../../reference/components/prometheus.remote_write/ diff --git a/docs/sources/tutorials/filtering-metrics.md b/docs/sources/tutorials/filtering-metrics.md deleted file mode 100644 index 1afe57ae1a..0000000000 --- a/docs/sources/tutorials/filtering-metrics.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -canonical: https://grafana.com/docs/alloy/latest/tutorials/filtering-metrics/ -description: Learn how to filter Prometheus metrics -menuTitle: Filter Prometheus metrics -title: Filter Prometheus metrics -weight: 300 ---- - -# Filter Prometheus metrics - -In this tutorial, you'll add a new component [prometheus.relabel][] using [relabel.alloy][] to filter metrics. -This tutorial uses the same base as [Collect Prometheus metrics][]. - -## Prerequisites - -* [Docker][] - -## Run the example - -The `prometheus.relabel` component is used to drop, add, or filter metrics. - -Run the following: - -```bash -curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/runt.sh -O && bash ./runt.sh relabel.alloy -``` - -The `runt.sh` script does: - -1. Downloads the configurations necessary for Mimir, Grafana and {{< param "PRODUCT_NAME" >}}. -1. Downloads the docker image for {{< param "PRODUCT_NAME" >}} explicitly. -1. Runs the docker-compose up command to bring all the services up. - - -Allow {{< param "PRODUCT_NAME" >}} to run for two minutes, then navigate to [Grafana][] page and the `service` label will be there with the `api_server` value. - -![Dashboard showing api_server](/media/docs/agent/screenshot-grafana-agent-filtering-metrics-filter.png) - -## What's happening? - -1. The Prometheus scraper is sending the metrics to the filter. -1. The filter is adding a new label named `service` with the value `api_server`. -1. The filter is then sending metrics to the remote_write endpoint. - -## Update the service value - -Open the `relabel.alloy` file that was downloaded and change the name of the service to `api_server_v2`, then run `bash ./runt.sh relabel.alloy`. Allow {{< param "PRODUCT_NAME" >}} to run for two minutes, then navigate to the [Grafana][] page, and the new label will be updated. The old value `api_server` may still show up in the graph but hovering over the lines will show that that value stopped being scraped and was replaced with `api_server_v2`. - -![Updated dashboard showing api_server_v2](/media/docs/agent/screenshot-grafana-agent-filtering-metrics-transition.png) - -[Docker]: https://www.docker.com/products/docker-desktop -[Grafana]: http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Mimir%22,%7B%22refId%22:%22A%22,%22instant%22:true,%22range%22:true,%22exemplar%22:true,%22expr%22:%22alloy_build_info%7B%7D%22%7D%5D -[relabel.alloy]: ../assets/flow_configs/relabel.alloy/ -[prometheus.relabel]: ../../reference/components/prometheus.relabel/ -[Collect Prometheus metrics]: ../collecting-prometheus-metrics diff --git a/docs/sources/tutorials/flow-by-example/first-components-and-stdlib/index.md b/docs/sources/tutorials/first-components-and-stdlib/index.md similarity index 100% rename from docs/sources/tutorials/flow-by-example/first-components-and-stdlib/index.md rename to docs/sources/tutorials/first-components-and-stdlib/index.md diff --git a/docs/sources/tutorials/flow-by-example/_index.md b/docs/sources/tutorials/flow-by-example/_index.md deleted file mode 100644 index 0e204774bd..0000000000 --- a/docs/sources/tutorials/flow-by-example/_index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -canonical: https://grafana.com/docs/alloy/latest/tutorials/flow-by-example/ -description: Learn how to use Grafana Alloy -title: Alloy by example -weight: 100 ---- - -# {{% param "PRODUCT_NAME" %}} by example - -This section provides a set of step-by-step tutorials that show how to use {{< param "PRODUCT_NAME" >}}. - -{{< section >}} diff --git a/docs/sources/tutorials/flow-by-example/get-started.md b/docs/sources/tutorials/get-started.md similarity index 100% rename from docs/sources/tutorials/flow-by-example/get-started.md rename to docs/sources/tutorials/get-started.md diff --git a/docs/sources/tutorials/flow-by-example/logs-and-relabeling-basics/index.md b/docs/sources/tutorials/logs-and-relabeling-basics/index.md similarity index 100% rename from docs/sources/tutorials/flow-by-example/logs-and-relabeling-basics/index.md rename to docs/sources/tutorials/logs-and-relabeling-basics/index.md diff --git a/docs/sources/tutorials/flow-by-example/processing-logs/index.md b/docs/sources/tutorials/processing-logs/index.md similarity index 100% rename from docs/sources/tutorials/flow-by-example/processing-logs/index.md rename to docs/sources/tutorials/processing-logs/index.md