Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki module fix #37

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
efcd92b
windows-exporter metrics alloy configuration
Imshelledin21 Apr 10, 2024
1e9edee
typo fix
Imshelledin21 Apr 10, 2024
10ba957
more typo fix
Imshelledin21 Apr 10, 2024
c0d5430
update attribute name for enabling clustering
Imshelledin21 Apr 10, 2024
48b88bf
Making service component sql where clause argument optional
Imshelledin21 Apr 10, 2024
27f5275
fix for enabled collector array
Imshelledin21 Apr 10, 2024
09efc5f
Removing timeout attribute of prometheus.exporter.windows component
Imshelledin21 Apr 10, 2024
cd50274
textfile directory fix
Imshelledin21 Apr 10, 2024
1e89bae
changing windows exporter declare name to local
Imshelledin21 Apr 10, 2024
1e84961
Naming updates
Imshelledin21 Apr 10, 2024
0547ab7
file path escaping issues
Imshelledin21 Apr 10, 2024
36dff1e
as
Imshelledin21 Apr 10, 2024
169d2b0
AZXV
Imshelledin21 Apr 10, 2024
7d2f90d
asdg
Imshelledin21 Apr 10, 2024
48e29ba
asdg
Imshelledin21 Apr 10, 2024
9acf356
asdg
Imshelledin21 Apr 10, 2024
f94e721
asdg
Imshelledin21 Apr 10, 2024
3fc22fe
WE
Imshelledin21 Apr 10, 2024
bf5f3d6
asdg
Imshelledin21 Apr 10, 2024
94ad3f8
readme file
Imshelledin21 Apr 10, 2024
0a196e8
Updates to docs
Imshelledin21 Apr 10, 2024
f7109f6
docs updates
Imshelledin21 Apr 10, 2024
2443ab8
doc updates
Imshelledin21 Apr 10, 2024
5a76a26
asdg
Imshelledin21 Apr 10, 2024
7ef90f5
Update to system modules readme
Imshelledin21 Apr 10, 2024
5ee578c
helm chart templating for config maps based on alloy files
Imshelledin21 Apr 11, 2024
b974122
clean up
Imshelledin21 Apr 11, 2024
6a3d210
Merge branch 'main' of https://github.com/grafana/alloy-modules into …
Imshelledin21 Apr 11, 2024
9a2f3c3
workflow edit
Imshelledin21 Apr 11, 2024
68aab3a
Merge pull request #1 from Imshelledin21/helm-charting
Imshelledin21 Apr 11, 2024
311dae1
Update create-helm-config-files.sh
Imshelledin21 Apr 11, 2024
01c5480
test
Imshelledin21 Apr 11, 2024
8c35fef
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 11, 2024
726602c
working on pathing
Imshelledin21 Apr 11, 2024
fd41955
Updating Value Files for Helm Charts
actions-user Apr 11, 2024
d0821e1
fixing targets for discovery.relabel.ksm
Imshelledin21 Apr 17, 2024
5c32561
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
4e208a0
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
af308e9
fixing targets for prometheus.scrape "kube_state_metrics"
Imshelledin21 Apr 17, 2024
e62d34a
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
5efc884
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
8e1e0d2
typo on previous commit, targets not target
Imshelledin21 Apr 17, 2024
375319e
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
66c1152
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
5b31469
making targets an array
Imshelledin21 Apr 17, 2024
ba5f42c
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
71e6f62
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
4cd3101
undo
Imshelledin21 Apr 17, 2024
3de373b
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
edb60f8
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
ae5f3db
fixing arguments to include .value
Imshelledin21 Apr 17, 2024
a4e5f35
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Apr 17, 2024
35e2202
Updating Value Files for Helm Charts
actions-user Apr 17, 2024
26564fb
Merge branch 'main' of https://github.com/grafana/alloy-modules
Imshelledin21 May 28, 2024
a185ddb
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 May 28, 2024
1f1d7ef
Updating Value Files for Helm Charts
actions-user May 28, 2024
65ac71d
snmp exporter module
Imshelledin21 Jun 14, 2024
8539b7c
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Jun 14, 2024
52a8978
Updating Value Files for Helm Charts
actions-user Jun 14, 2024
c3d9e1a
added in configmap section
Imshelledin21 Jun 14, 2024
481fdbf
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Jun 14, 2024
0d4b0f4
Updating Value Files for Helm Charts
actions-user Jun 14, 2024
5f745ef
setting for VM
Imshelledin21 Jun 14, 2024
8450996
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Jun 14, 2024
2042a33
Updating Value Files for Helm Charts
actions-user Jun 14, 2024
a8f73f0
update to have target name as an argument
Imshelledin21 Jun 14, 2024
133f814
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Jun 14, 2024
b7b16ff
Updating Value Files for Helm Charts
actions-user Jun 14, 2024
9d4c88c
reverting
Imshelledin21 Jun 14, 2024
81b1f3b
Merge branch 'main' of https://github.com/Imshelledin21/alloy-modules
Imshelledin21 Jun 14, 2024
a8bbd78
Updating Value Files for Helm Charts
actions-user Jun 14, 2024
311cfdd
update loki default port name for discovery
Imshelledin21 Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/helm-chart-values-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: HelmChartValuesBuilder

on:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo contents
uses: actions/checkout@v2

Check failure on line 15 in .github/workflows/helm-chart-values-builder.yml

View workflow job for this annotation

GitHub Actions / runner / actionlint

[actionlint] reported by reviewdog 🐶 the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue [action] Raw Output: .github/workflows/helm-chart-values-builder.yml:15:15: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue [action]

- name: execute shell script
run: ./tools/create-helm-config-files.sh

- name: commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add -A
git diff-index --quiet HEAD || (git commit -a -m "Updating Value Files for Helm Charts" --allow-empty)

- name: push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
23 changes: 23 additions & 0 deletions helm/alloy-modules/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions helm/alloy-modules/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: alloy-modules
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
238 changes: 238 additions & 0 deletions helm/alloy-modules/configmaps/broker-rabbitmq-metrics.alloy
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
/*
Module: job-rabbitmq
Description: Scrapes rabbitmq

Note: Every argument except for "forward_to" is optional, and does have a defined default value. However, the values for these
arguments are not defined using the default = " ... " argument syntax, but rather using the coalesce(argument.value, " ... ").
This is because if the argument passed in from another consuming module is set to null, the default = " ... " syntax will
does not override the value passed in, where coalesce() will return the first non-null value.
*/
declare "kubernetes" {
// arguments for kubernetes discovery
argument "namespaces" {
comment = "The namespaces to look for targets in (default: [] is all namespaces)"
optional = true
}

argument "field_selectors" {
// Docs: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
comment = "The label selectors to use to find matching targets (default: [])"
optional = true
}

argument "label_selectors" {
// Docs: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
comment = "The label selectors to use to find matching targets (default: [\"app.kubernetes.io/name=prometheus-rabbitmq-exporter\"])"
optional = true
}

argument "port_name" {
comment = "The of the port to scrape metrics from (default: rabbitmq-exporter)"
optional = true
}

// rabbitmq service discovery for all of the pods
discovery.kubernetes "rabbitmq" {
role = "pod"

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-rabbitmq-exporter"]), ",")
}

namespaces {
names = coalesce(argument.namespaces.value, [])
}
}

// rabbitmq relabelings (pre-scrape)
discovery.relabel "kubernetes" {
targets = discovery.kubernetes.rabbitmq.targets

// keep only the specified metrics port name, and pods that are Running and ready
rule {
source_labels = [
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "rabbitmq-exporter") + "@Running@true@false"
action = "keep"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "namespace"
}

// set the pod label
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "pod"
}

// set the container label
rule {
source_labels = ["__meta_kubernetes_pod_container_name"]
target_label = "container"
}

// set a workload label
rule {
source_labels = [
"__meta_kubernetes_pod_controller_kind",
"__meta_kubernetes_pod_controller_name",
]
separator = "/"
target_label = "workload"
}
// remove the hash from the ReplicaSet
rule {
source_labels = ["workload"]
regex = "(ReplicaSet/.+)-.+"
target_label = "workload"
}

// set the app name if specified as metadata labels "app:" or "app.kubernetes.io/name:" or "k8s-app:"
rule {
action = "replace"
source_labels = [
"__meta_kubernetes_pod_label_app_kubernetes_io_name",
"__meta_kubernetes_pod_label_k8s_app",
"__meta_kubernetes_pod_label_app",
]
separator = ";"
regex = "^(?:;*)?([^;]+).*$"
replacement = "$1"
target_label = "app"
}

// set the component if specified as metadata labels "component:" or "app.kubernetes.io/component:" or "k8s-component:"
rule {
action = "replace"
source_labels = [
"__meta_kubernetes_pod_label_app_kubernetes_io_component",
"__meta_kubernetes_pod_label_k8s_component",
"__meta_kubernetes_pod_label_component",
]
regex = "^(?:;*)?([^;]+).*$"
replacement = "$1"
target_label = "component"
}

// set a source label
rule {
action = "replace"
replacement = "kubernetes"
target_label = "source"
}
}

export "output" {
value = discovery.relabel.kubernetes.output
}
}

declare "local" {
argument "port" {
comment = "The port to use (default: 9419)"
optional = true
}

// arguments for local (static)
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9419")),
"source" = "local",
},
]
}

export "output" {
value = discovery.relabel.local.output
}
}

declare "scrape" {
argument "targets" {
comment = "Must be a list() of targets"
}

argument "forward_to" {
comment = "Must be a list(MetricsReceiver) where collected logs should be forwarded to"
}

argument "job_label" {
comment = "The job label to add for all rabbitmq metric (default: integrations/rabbitmq)"
optional = true
}

argument "keep_metrics" {
comment = "A regular expression of metrics to keep (default: see below)"
optional = true
}

argument "drop_metrics" {
comment = "A regular expression of metrics to drop (default: see below)"
optional = true
}

argument "scrape_interval" {
comment = "How often to scrape metrics from the targets (default: 60s)"
optional = true
}

argument "scrape_timeout" {
comment = "How long before a scrape times out (default: 10s)"
optional = true
}

argument "max_cache_size" {
comment = "The maximum number of elements to hold in the relabeling cache (default: 100000). This should be at least 2x-5x your largest scrape target or samples appended rate."
optional = true
}

argument "clustering" {
// Docs: https://grafana.com/docs/agent/latest/flow/concepts/clustering/
comment = "Whether or not clustering should be enabled (default: false)"
optional = true
}

// rabbitmq scrape job
prometheus.scrape "rabbitmq" {
job_name = coalesce(argument.job_label.value, "integrations/rabbitmq")
forward_to = [prometheus.relabel.rabbitmq.receiver]
targets = argument.targets.value
scrape_interval = coalesce(argument.scrape_interval.value, "60s")
scrape_timeout = coalesce(argument.scrape_timeout.value, "10s")

clustering {
enabled = coalesce(argument.clustering.value, false)
}
}

// rabbitmq metric relabelings (post-scrape)
prometheus.relabel "rabbitmq" {
forward_to = argument.forward_to.value
max_cache_size = coalesce(argument.max_cache_size.value, 100000)

// drop metrics that match the drop_metrics regex
rule {
source_labels = ["__name__"]
regex = coalesce(argument.drop_metrics.value, "(^(go|process)_.+$)")
action = "drop"
}

// keep only metrics that match the keep_metrics regex
rule {
source_labels = ["__name__"]
regex = coalesce(argument.keep_metrics.value, "(up|rabbitmq_(commands_total|connections_total|current_(bytes|connections|items)|items_(evicted_total|total)|max_connections|read_bytes_total|up|uptime_seconds|version|written_bytes_total))")
action = "keep"
}
}
}
Loading
Loading