-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Support for Alloy Module Imports Resolves #537 * Added extraConfig Import Example * Added Loki Metrics to Allow List (#535) * Added Loki Metrics to Allow List * Regenerated Output * Regenerated Docs * Update Grafana Alloy (#546) Signed-off-by: Pete Wall <pete.wall@grafana.com> * Always call tpl outside of with blocks to preserve backwards compatibility (#554) Signed-off-by: Pete Wall <pete.wall@grafana.com> * Added schema * Renamed modules.alias to modules.name * Added Support for Journal Logs (#545) * Added Support for Journal Logs Resolves #544 * Fixed formatting * Added Loki Metrics to Allow List (#535) * Added Loki Metrics to Allow List * Regenerated Output * Regenerated Docs * Added Support for Journal Logs Resolves #544 * Added CI Test * Fixed Formatting * Updated Test Queries * Regenerated Documentation * Removed Journal from Test Kind nodes do not have systemd * Update Grafana Alloy (#546) Signed-off-by: Pete Wall <pete.wall@grafana.com> * Added Support for Journal Logs Resolves #544 * Revert "Updated Test Queries" This reverts commit 8de520c. * Regenerated --------- Signed-off-by: Pete Wall <pete.wall@grafana.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Added Support for Alloy Module Imports Resolves #537 * Added extraConfig Import Example * Added schema * Renamed modules.alias to modules.name * Generated Outputs --------- Signed-off-by: Pete Wall <pete.wall@grafana.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Pete Wall <pete.wall@grafana.com>
- Loading branch information
1 parent
ccaebc5
commit ead04cc
Showing
20 changed files
with
105,296 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
charts/k8s-monitoring/templates/alloy_config/_alloy-modules.alloy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
{{ define "alloy.config.alloyMetricModules" }} | ||
// Alloy Modules | ||
{{- $connections := .Values.metrics.alloyModules.connections }} | ||
{{- /* Determine the default connection */}} | ||
{{- $defaultConnection := dict }} | ||
{{- range $connections }} | ||
{{- if .default }} | ||
{{- $defaultConnection = . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- $extraRelabelingRules := .Values.metrics.extraRelabelingRules | default "" }} | ||
{{- $extraMetricRelabelingRules := .Values.metrics.extraMetricRelabelingRules | default "" }} | ||
{{- $defaultMaxCacheSize := .Values.metrics.maxCacheSize }} | ||
{{- $defaultScrapeInterval := .Values.metrics.scrapeInterval }} | ||
{{- $clustering := .Values.alloy.alloy.clustering.enabled }} | ||
|
||
{{- range $module := .Values.metrics.alloyModules.modules }} | ||
{{- $moduleName := $module.name }} | ||
{{- /* Find the connection for the module or use the default */}} | ||
{{- $moduleConnection := $defaultConnection }} | ||
{{- range $conn := $connections }} | ||
{{- if and $module.connection (eq $conn.alias $module.connection) }} | ||
{{- $moduleConnection = $conn }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
// {{ $moduleName }}: import the module | ||
import.git "module_{{ $moduleName }}" { | ||
repository = "{{ $moduleConnection.repository }}" | ||
revision = "{{ $moduleConnection.revision }}" | ||
path = "{{ $module.path }}" | ||
pull_frequency = "{{ $moduleConnection.pull_frequency }}" | ||
|
||
{{- with $moduleConnection.basic_auth }} | ||
basic_auth { | ||
{{ if .username }}username = "{{ .username }}"{{ end }} | ||
{{ if .password }}password = "{{ .password }}"{{ end }} | ||
{{ if .password_file }}password_file = "{{ .password_file }}"{{ end }} | ||
} | ||
{{- end }} | ||
|
||
{{- with $moduleConnection.ssh_key }} | ||
ssh_key { | ||
{{ if .username }}username = "{{ .username }}"{{ end }} | ||
{{ if .key }}key = "{{ .key }}"{{ end }} | ||
{{ if .key_file }}key_file = "{{ .key_file }}"{{ end }} | ||
{{ if .passphrase }}passphrase = "{{ .passphrase }}"{{ end }} | ||
} | ||
{{- end }} | ||
} | ||
|
||
// {{ $moduleName }}: call the targets component | ||
module_{{ $moduleName }}.kubernetes "targets" { | ||
{{- if $module.targets }} | ||
{{- range $key, $value := $module.targets }} | ||
{{ $key }} = {{ if kindIs "slice" $value }}[{{ range $index, $item := $value }}"{{ $item }}"{{ if lt $index (sub (len $value) 1) }}, {{ end }}{{ end }}]{{ else }}"{{ $value }}"{{ end }} | ||
{{- end }} | ||
{{- end }} | ||
} | ||
|
||
// {{ $moduleName }}: additional service discovery relabelings | ||
discovery.relabel "module_{{ $moduleName }}" { | ||
targets = module_{{ $moduleName }}.kubernetes.targets.output | ||
// global discovery relabelings | ||
{{- if $extraRelabelingRules }} | ||
{{ $extraRelabelingRules | indent 2 }} | ||
{{- end }} | ||
// {{ $moduleName }}: additional discovery relabelings | ||
{{- if $module.extraRelabelingRules }} | ||
{{ $module.extraRelabelingRules | indent 2 }} | ||
{{- end }} | ||
} | ||
|
||
// {{ $moduleName }}: call the scrape component | ||
module_{{ $moduleName }}.scrape "metrics" { | ||
targets = discovery.relabel.module_{{ $moduleName }}.output | ||
forward_to = [prometheus.relabel.module_{{ $moduleName }}.receiver] | ||
clustering = {{ $clustering }} | ||
scrape_interval = "{{ if and (hasKey $module "scrape") (hasKey $module.scrape "scrape_interval") }}{{ index $module.scrape "scrape_interval" }}{{- else }}{{ $defaultScrapeInterval }}{{- end }}" | ||
{{- if $module.scrape }} | ||
{{- range $key, $value := $module.scrape }} | ||
{{- if not (eq $key "scrape_interval") }} | ||
{{ $key }} = {{ if kindIs "slice" $value }}[{{ range $index, $item := $value }}"{{ $item }}"{{ if lt $index (sub (len $value) 1) }}, {{ end }}{{ end }}]{{ else }}"{{ $value }}"{{ end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
} | ||
|
||
// {{ $moduleName }}: additional metric relabelings | ||
prometheus.relabel "module_{{ $moduleName }}" { | ||
max_cache_size = {{ if and (hasKey $module "scrape") (hasKey $module.scrape "max_cache_size") }}{{ index $module.scrape "max_cache_size" | int }}{{- else }}{{ $defaultMaxCacheSize | int }}{{- end }} | ||
// global metric relabelings | ||
{{- if $extraMetricRelabelingRules }} | ||
{{ $extraMetricRelabelingRules | indent 2 }} | ||
{{- end }} | ||
// additional {{ $moduleName }} module specific metric relabelings | ||
{{- if $module.extraMetricRelabelingRules }} | ||
{{ $module.extraMetricRelabelingRules | indent 2 }} | ||
{{- end }} | ||
forward_to = [prometheus.relabel.metrics_service.receiver] | ||
} | ||
{{- end }} | ||
{{ end }} |
Oops, something went wrong.