Skip to content

Commit

Permalink
Enable generating self-report metrics (#810)
Browse files Browse the repository at this point in the history
* Enable generating self-report metrics
Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall authored Oct 22, 2024
1 parent f1eabc7 commit 3ccce08
Show file tree
Hide file tree
Showing 124 changed files with 4,946 additions and 3,117 deletions.
4 changes: 4 additions & 0 deletions charts/feature-annotation-autodiscovery/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ Scrape metrics from pods and services with the "{{.Values.annotations.scrape}}:
{{- end }}

{{- define "feature.annotationAutodiscovery.notes.actions" }}{{- end }}

{{- define "feature.annotationAutodiscovery.summary" -}}
version: {{ .Chart.Version }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/feature-application-observability/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ Configure your applications to send telemetry data to:
* http://{{ .Collector.ServiceName }}.{{ .Collector.Namespace }}.svc.cluster.local:{{ .Values.receivers.zipkin.port }} (Zipkin)
{{ end }}
{{- end }}

{{- define "feature.applicationObservability.summary" -}}
{{- $receivers := list }}
{{- if .Values.receivers.grpc.enabled }}{{- $receivers = append $receivers "otlpgrpc" }}{{ end }}
{{- if .Values.receivers.http.enabled }}{{- $receivers = append $receivers "otlphttp" }}{{ end }}
{{- if .Values.receivers.zipkin.enabled }}{{- $receivers = append $receivers "zipkin" }}{{ end }}
version: {{ .Chart.Version }}
protocols: {{ $receivers | join "," }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/feature-cluster-events/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ Gather Kubernetes Cluster events{{- if .Values.namespaces }} from the namespaces
{{- end }}

{{- define "feature.clusterEvents.notes.actions" }}{{- end }}

{{- define "feature.clusterEvents.summary" -}}
version: {{ .Chart.Version }}
{{- end }}
25 changes: 25 additions & 0 deletions charts/feature-cluster-metrics/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,28 @@ Scrape Kubernetes Cluster metrics
{{- end }}

{{- define "feature.clusterMetrics.notes.actions" }}{{- end }}

{{- define "feature.clusterMetrics.summary" -}}
{{- $sources := list }}
{{- if .Values.controlPlane.enabled }}{{- $sources = append $sources "controlPlane" }}{{ end }}
{{- if .Values.kubelet.enabled }}{{- $sources = append $sources "kubelet" }}{{ end }}
{{- if .Values.kubeletResource.enabled }}{{- $sources = append $sources "kubeletResource" }}{{ end }}
{{- if .Values.cadvisor.enabled }}{{- $sources = append $sources "cadvisor" }}{{ end }}
{{- if .Values.apiServer.enabled }}{{- $sources = append $sources "apiServer" }}{{ end }}
{{- if .Values.kubeControllerManager.enabled }}{{- $sources = append $sources "kubeControllerManager" }}{{ end }}
{{- if .Values.kubeProxy.enabled }}{{- $sources = append $sources "kubeProxy" }}{{ end }}
{{- if .Values.kubeScheduler.enabled }}{{- $sources = append $sources "kubeScheduler" }}{{ end }}
{{- if (index .Values "kube-state-metrics").enabled }}{{- $sources = append $sources "kube-state-metrics" }}{{ end }}
{{- if (index .Values "node-exporter").enabled }}{{- $sources = append $sources "node-exporter" }}{{ end }}
{{- if (index .Values "windows-exporter").enabled }}{{- $sources = append $sources "windows-exporter" }}{{ end }}
{{- if .Values.kepler.enabled }}{{- $sources = append $sources "kepler" }}{{ end }}

{{- $deployments := list }}
{{- if (index .Values "kube-state-metrics").deploy }}{{- $deployments = append $deployments "kube-state-metrics" }}{{ end }}
{{- if (index .Values "node-exporter").deploy }}{{- $deployments = append $deployments "node-exporter" }}{{ end }}
{{- if (index .Values "windows-exporter").deploy }}{{- $deployments = append $deployments "windows-exporter" }}{{ end }}
{{- if .Values.kepler.enabled }}{{- $deployments = append $deployments "kepler" }}{{ end }}
version: {{ .Chart.Version }}
sources: {{ $sources | join "," }}
deployments: {{ $deployments | join "," }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/feature-frontend-observability/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ Receive data from Frontend applications
{{- end }}

{{- define "feature.frontendObservability.notes.actions" }}{{- end }}

{{- define "feature.frontendObservability.summary" -}}
version: {{ .Chart.Version }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/feature-integrations/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Gather data from service integrations
{{- end }}

{{- define "feature.integrations.notes.actions" }}{{- end }}

{{- define "feature.integrations.summary" -}}
version: {{ .Chart.Version }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/feature-pod-logs/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Gather logs from Kubernetes Pods

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

{{- define "feature.podLogs.summary" -}}
version: {{ .Chart.Version }}
method: {{ .Values.gatherMethod }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/feature-profiling/templates/_notes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ Gather profiles
{{- end }}

{{- define "feature.profiling.notes.actions" }}{{- end }}

{{- define "feature.profiling.summary" -}}
version: {{ .Chart.Version }}
method: {{ .Values.gatherMethod }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Scrapes metrics from {{ include "english_list" $sources }}.
{{- end }}

{{- define "feature.prometheusOperatorObjects.notes.actions" }}{{- end }}

{{- define "feature.prometheusOperatorObjects.summary" -}}
version: {{ .Chart.Version }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/k8s-monitoring/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ dependencies:
repository: https://grafana.github.io/helm-charts
version: 0.9.1
digest: sha256:734d4c8f6076481eb580378daa65fe163c78e9e07a1a214cb4b2fed16441b4c9
generated: "2024-10-16T09:29:39.056825-05:00"
generated: "2024-10-21T17:06:40.407816+02:00"
8 changes: 8 additions & 0 deletions charts/k8s-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ podLogs:
| prometheusOperatorObjects.destinations | list | `[]` | The destinations where metrics will be sent. If empty, all metrics-capable destinations will be used. |
| prometheusOperatorObjects.enabled | bool | `false` | Enable gathering metrics from Prometheus Operator Objects. |

### Features - Self-reporting

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| 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. |
| selfReporting.enabled | bool | `true` | Enable Self-reporting. |
| selfReporting.scrapeInterval | string | `"1h"` | How frequently to generate self-report metrics. This does utilize the global scrapeInterval setting. |

### Other Values

| Key | Type | Default | Description |
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ loki.write "loki" {
"k8s_cluster_name" = "bearer-token-example-cluster",
}
}

// Feature: Pod Logs
declare "pod_logs" {
argument "logs_destinations" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ remote.kubernetes.secret "prometheus" {
namespace = "default"
}


// Feature: Prometheus Operator Objects
declare "prometheus_operator_objects" {
argument "metrics_destinations" {
Expand Down Expand Up @@ -93,3 +92,37 @@ prometheus_operator_objects "feature" {
prometheus.remote_write.prometheus.receiver,
]
}

// Self Reporting
prometheus.exporter.unix "kubernetes_monitoring_telemetry" {
set_collectors = ["textfile"]
textfile {
directory = "/etc/alloy"
}
}

discovery.relabel "kubernetes_monitoring_telemetry" {
targets = prometheus.exporter.unix.kubernetes_monitoring_telemetry.targets
rule {
target_label = "instance"
action = "replace"
replacement = "ko"
}
rule {
target_label = "job"
action = "replace"
replacement = "integrations/kubernetes/kubernetes_monitoring_telemetry"
}
}

prometheus.scrape "kubernetes_monitoring_telemetry" {
job_name = "integrations/kubernetes/kubernetes_monitoring_telemetry"
targets = discovery.relabel.kubernetes_monitoring_telemetry.output
scrape_interval = "1h"
clustering {
enabled = true
}
forward_to = [
prometheus.remote_write.prometheus.receiver,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ remote.kubernetes.secret "tempo" {
namespace = "tempo"
}


// Feature: Application Observability
declare "application_observability" {
argument "metrics_destinations" {
Expand Down
Loading

0 comments on commit 3ccce08

Please sign in to comment.