Skip to content

Commit 3ccce08

Browse files
authored
Enable generating self-report metrics (#810)
* Enable generating self-report metrics Signed-off-by: Pete Wall <pete.wall@grafana.com>
1 parent f1eabc7 commit 3ccce08

File tree

124 files changed

+4946
-3117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4946
-3117
lines changed

charts/feature-annotation-autodiscovery/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ Scrape metrics from pods and services with the "{{.Values.annotations.scrape}}:
55
{{- end }}
66

77
{{- define "feature.annotationAutodiscovery.notes.actions" }}{{- end }}
8+
9+
{{- define "feature.annotationAutodiscovery.summary" -}}
10+
version: {{ .Chart.Version }}
11+
{{- end }}

charts/feature-application-observability/templates/_notes.tpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ Configure your applications to send telemetry data to:
2121
* http://{{ .Collector.ServiceName }}.{{ .Collector.Namespace }}.svc.cluster.local:{{ .Values.receivers.zipkin.port }} (Zipkin)
2222
{{ end }}
2323
{{- end }}
24+
25+
{{- define "feature.applicationObservability.summary" -}}
26+
{{- $receivers := list }}
27+
{{- if .Values.receivers.grpc.enabled }}{{- $receivers = append $receivers "otlpgrpc" }}{{ end }}
28+
{{- if .Values.receivers.http.enabled }}{{- $receivers = append $receivers "otlphttp" }}{{ end }}
29+
{{- if .Values.receivers.zipkin.enabled }}{{- $receivers = append $receivers "zipkin" }}{{ end }}
30+
version: {{ .Chart.Version }}
31+
protocols: {{ $receivers | join "," }}
32+
{{- end }}

charts/feature-cluster-events/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ Gather Kubernetes Cluster events{{- if .Values.namespaces }} from the namespaces
55
{{- end }}
66

77
{{- define "feature.clusterEvents.notes.actions" }}{{- end }}
8+
9+
{{- define "feature.clusterEvents.summary" -}}
10+
version: {{ .Chart.Version }}
11+
{{- end }}

charts/feature-cluster-metrics/templates/_notes.tpl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,28 @@ Scrape Kubernetes Cluster metrics
1818
{{- end }}
1919

2020
{{- define "feature.clusterMetrics.notes.actions" }}{{- end }}
21+
22+
{{- define "feature.clusterMetrics.summary" -}}
23+
{{- $sources := list }}
24+
{{- if .Values.controlPlane.enabled }}{{- $sources = append $sources "controlPlane" }}{{ end }}
25+
{{- if .Values.kubelet.enabled }}{{- $sources = append $sources "kubelet" }}{{ end }}
26+
{{- if .Values.kubeletResource.enabled }}{{- $sources = append $sources "kubeletResource" }}{{ end }}
27+
{{- if .Values.cadvisor.enabled }}{{- $sources = append $sources "cadvisor" }}{{ end }}
28+
{{- if .Values.apiServer.enabled }}{{- $sources = append $sources "apiServer" }}{{ end }}
29+
{{- if .Values.kubeControllerManager.enabled }}{{- $sources = append $sources "kubeControllerManager" }}{{ end }}
30+
{{- if .Values.kubeProxy.enabled }}{{- $sources = append $sources "kubeProxy" }}{{ end }}
31+
{{- if .Values.kubeScheduler.enabled }}{{- $sources = append $sources "kubeScheduler" }}{{ end }}
32+
{{- if (index .Values "kube-state-metrics").enabled }}{{- $sources = append $sources "kube-state-metrics" }}{{ end }}
33+
{{- if (index .Values "node-exporter").enabled }}{{- $sources = append $sources "node-exporter" }}{{ end }}
34+
{{- if (index .Values "windows-exporter").enabled }}{{- $sources = append $sources "windows-exporter" }}{{ end }}
35+
{{- if .Values.kepler.enabled }}{{- $sources = append $sources "kepler" }}{{ end }}
36+
37+
{{- $deployments := list }}
38+
{{- if (index .Values "kube-state-metrics").deploy }}{{- $deployments = append $deployments "kube-state-metrics" }}{{ end }}
39+
{{- if (index .Values "node-exporter").deploy }}{{- $deployments = append $deployments "node-exporter" }}{{ end }}
40+
{{- if (index .Values "windows-exporter").deploy }}{{- $deployments = append $deployments "windows-exporter" }}{{ end }}
41+
{{- if .Values.kepler.enabled }}{{- $deployments = append $deployments "kepler" }}{{ end }}
42+
version: {{ .Chart.Version }}
43+
sources: {{ $sources | join "," }}
44+
deployments: {{ $deployments | join "," }}
45+
{{- end }}

charts/feature-frontend-observability/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ Receive data from Frontend applications
55
{{- end }}
66

77
{{- define "feature.frontendObservability.notes.actions" }}{{- end }}
8+
9+
{{- define "feature.frontendObservability.summary" -}}
10+
version: {{ .Chart.Version }}
11+
{{- end }}

charts/feature-integrations/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ Gather data from service integrations
66
{{- end }}
77

88
{{- define "feature.integrations.notes.actions" }}{{- end }}
9+
10+
{{- define "feature.integrations.summary" -}}
11+
version: {{ .Chart.Version }}
12+
{{- end }}

charts/feature-pod-logs/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ Gather logs from Kubernetes Pods
66

77
{{- define "feature.podLogs.notes.actions" }}{{- end }}
88

9+
{{- define "feature.podLogs.summary" -}}
10+
version: {{ .Chart.Version }}
11+
method: {{ .Values.gatherMethod }}
12+
{{- end }}

charts/feature-profiling/templates/_notes.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ Gather profiles
55
{{- end }}
66

77
{{- define "feature.profiling.notes.actions" }}{{- end }}
8+
9+
{{- define "feature.profiling.summary" -}}
10+
version: {{ .Chart.Version }}
11+
method: {{ .Values.gatherMethod }}
12+
{{- end }}

charts/feature-prometheus-operator-objects/templates/_notes.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ Scrapes metrics from {{ include "english_list" $sources }}.
1313
{{- end }}
1414

1515
{{- define "feature.prometheusOperatorObjects.notes.actions" }}{{- end }}
16+
17+
{{- define "feature.prometheusOperatorObjects.summary" -}}
18+
version: {{ .Chart.Version }}
19+
{{- end }}

charts/k8s-monitoring/Chart.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ dependencies:
4242
repository: https://grafana.github.io/helm-charts
4343
version: 0.9.1
4444
digest: sha256:734d4c8f6076481eb580378daa65fe163c78e9e07a1a214cb4b2fed16441b4c9
45-
generated: "2024-10-16T09:29:39.056825-05:00"
45+
generated: "2024-10-21T17:06:40.407816+02:00"

charts/k8s-monitoring/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ podLogs:
291291
| prometheusOperatorObjects.destinations | list | `[]` | The destinations where metrics will be sent. If empty, all metrics-capable destinations will be used. |
292292
| prometheusOperatorObjects.enabled | bool | `false` | Enable gathering metrics from Prometheus Operator Objects. |
293293

294+
### Features - Self-reporting
295+
296+
| Key | Type | Default | Description |
297+
|-----|------|---------|-------------|
298+
| selfReporting | object | `{"enabled":true,"scrapeInterval":"1h"}` | Self-reporting creates a single metric and log that reports anonymized information about how this Helm chart was configured. It reports features enabled, destinations types used, and alloy instances enabled. It does not report any actual telemetry data, credentials or configuration, or send any data to any destination other than the ones configured above. |
299+
| selfReporting.enabled | bool | `true` | Enable Self-reporting. |
300+
| selfReporting.scrapeInterval | string | `"1h"` | How frequently to generate self-report metrics. This does utilize the global scrapeInterval setting. |
301+
294302
### Other Values
295303

296304
| Key | Type | Default | Description |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-logs.alloy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ loki.write "loki" {
1313
"k8s_cluster_name" = "bearer-token-example-cluster",
1414
}
1515
}
16+
1617
// Feature: Pod Logs
1718
declare "pod_logs" {
1819
argument "logs_destinations" {

charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-metrics.alloy

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ remote.kubernetes.secret "prometheus" {
4848
namespace = "default"
4949
}
5050

51-
5251
// Feature: Prometheus Operator Objects
5352
declare "prometheus_operator_objects" {
5453
argument "metrics_destinations" {
@@ -93,3 +92,37 @@ prometheus_operator_objects "feature" {
9392
prometheus.remote_write.prometheus.receiver,
9493
]
9594
}
95+
96+
// Self Reporting
97+
prometheus.exporter.unix "kubernetes_monitoring_telemetry" {
98+
set_collectors = ["textfile"]
99+
textfile {
100+
directory = "/etc/alloy"
101+
}
102+
}
103+
104+
discovery.relabel "kubernetes_monitoring_telemetry" {
105+
targets = prometheus.exporter.unix.kubernetes_monitoring_telemetry.targets
106+
rule {
107+
target_label = "instance"
108+
action = "replace"
109+
replacement = "ko"
110+
}
111+
rule {
112+
target_label = "job"
113+
action = "replace"
114+
replacement = "integrations/kubernetes/kubernetes_monitoring_telemetry"
115+
}
116+
}
117+
118+
prometheus.scrape "kubernetes_monitoring_telemetry" {
119+
job_name = "integrations/kubernetes/kubernetes_monitoring_telemetry"
120+
targets = discovery.relabel.kubernetes_monitoring_telemetry.output
121+
scrape_interval = "1h"
122+
clustering {
123+
enabled = true
124+
}
125+
forward_to = [
126+
prometheus.remote_write.prometheus.receiver,
127+
]
128+
}

charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-receiver.alloy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ remote.kubernetes.secret "tempo" {
110110
namespace = "tempo"
111111
}
112112

113-
114113
// Feature: Application Observability
115114
declare "application_observability" {
116115
argument "metrics_destinations" {

0 commit comments

Comments
 (0)