Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
30 changes: 15 additions & 15 deletions stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Expects a dict with keys: global, service
{{- $service := .service -}}
{{- $metricsQuery := printf "sum(rate(nginx_ingress_controller_requests{namespace=\"%s\", service=\"%s\", status=~\"2..\"}[5m]))\n/\nsum(rate(nginx_ingress_controller_requests{namespace=\"%s\", service=\"%s\"}[5m])) * 100" $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 12)
"options" (dict
"legend" (dict
Expand All @@ -373,7 +373,7 @@ Expects a dict with keys: global, service
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $metricsQuery
"legendFormat" "__auto"
Expand All @@ -396,7 +396,7 @@ Expects a dict with keys: global, service
{{- $service := .service -}}
{{- $metricsQuery := printf "sum(rate(nginx_ingress_controller_requests{namespace=\"%s\", service=\"%s\", status!~\"2..\"}[5m])) by (status)" $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 12)
"options" (dict
"legend" (dict
Expand All @@ -414,7 +414,7 @@ Expects a dict with keys: global, service
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $metricsQuery
"legendFormat" "{{status}}"
Expand All @@ -437,7 +437,7 @@ Expects a dict with keys: global, service
{{- $service := .service -}}
{{- $metricsQuery := printf "increase(kube_pod_container_status_restarts_total{namespace=\"%s\", pod=~\"%s-.*\"}[5m])" $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 12)
"options" (dict
"legend" (dict
Expand All @@ -455,7 +455,7 @@ Expects a dict with keys: global, service
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $metricsQuery
"legendFormat" "{{pod}}"
Expand All @@ -478,7 +478,7 @@ Expects a dict with keys: global, service
{{- $service := .service -}}
{{- $metricsQuery := printf "sum(rate(nginx_ingress_controller_request_duration_seconds_sum{namespace=\"%s\", status=\"200\", service=\"%s\"}[5m]))\n/\nsum(rate(nginx_ingress_controller_request_duration_seconds_count{namespace=\"%s\", status=\"200\", service=\"%s\"}[5m]))" $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) $global.Values.global.argoBuildEnv.appNamespace (include "service.fullname" $service) -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 12)
"options" (dict
"legend" (dict
Expand All @@ -496,7 +496,7 @@ Expects a dict with keys: global, service
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $metricsQuery
"legendFormat" "__auto"
Expand All @@ -522,7 +522,7 @@ Expects a dict with keys: global, cronJob
{{- $successQuery := printf "count((kube_job_status_succeeded{namespace=\"%s\", job_name=~\"%s-.*\"} UNLESS kube_job_status_succeeded{namespace=\"%s\", job_name=~\"%s-.*\"} offset $__interval) == 1)" $namespace $cronJobFullname $namespace $cronJobFullname -}}
{{- $failureQuery := printf "count((kube_job_status_failed{namespace=\"%s\", job_name=~\"%s-.*\"} UNLESS kube_job_status_failed{namespace=\"%s\", job_name=~\"%s-.*\"} offset $__interval) == 1)" $namespace $cronJobFullname $namespace $cronJobFullname -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 12)
"options" (dict
"legend" (dict
Expand All @@ -549,15 +549,15 @@ Expects a dict with keys: global, cronJob
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $successQuery
"legendFormat" "Success"
"range" true
"refId" "A"
)
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $failureQuery
"legendFormat" "Failure"
Expand Down Expand Up @@ -646,7 +646,7 @@ Expects a dict with keys: global, cronJob
{{- $namespace := $global.Values.global.argoBuildEnv.appNamespace -}}
{{- $lastSuccessQuery := printf "max(kube_job_status_completion_time{namespace=\"%s\", job_name=~\"%s-.*\"} > 0) * 1000" $namespace $cronJobFullname -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 6)
"options" (dict
"colorMode" "value"
Expand All @@ -664,7 +664,7 @@ Expects a dict with keys: global, cronJob
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $lastSuccessQuery
"legendFormat" "Last Successful Run"
Expand Down Expand Up @@ -714,7 +714,7 @@ Expects a dict with keys: global, cronJob
{{- $namespace := $global.Values.global.argoBuildEnv.appNamespace -}}
{{- $avgDurationQuery := printf "avg(kube_job_status_completion_time{namespace=\"%s\", job_name=~\"%s-.*\"} - kube_job_status_start_time{namespace=\"%s\", job_name=~\"%s-.*\"})" $namespace $cronJobFullname $namespace $cronJobFullname -}}
{{- $panelDict := dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"gridPos" (dict "h" 8 "w" 6)
"options" (dict
"colorMode" "value"
Expand All @@ -732,7 +732,7 @@ Expects a dict with keys: global, cronJob
"pluginVersion" "12.1.0"
"targets" (list
(dict
"datasource" (dict "type" "prometheus" "uid" "prometheus")
"datasource" (dict "type" "prometheus" "uid" "amp")
"editorMode" "code"
"expr" $avgDurationQuery
"legendFormat" "Average Duration"
Expand Down
47 changes: 46 additions & 1 deletion stack/templates/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,50 @@
{{ $globalValues := dict "Chart" $global.Chart "Release" $global.Release "Capabilities" $global.Capabilities "Values" $global.Values.global }}
{{- with $globalValues }}
{{- if .Values.grafanaDashboard.enabled -}}
{{- $rootFolderName := printf "argus-%s" .Values.argusMetadata.stackName }}
{{- $rootFolderTitle := "Argus" }}
{{- $appFolderName := printf "%s-%s" .Values.argusMetadata.appName .Values.argusMetadata.stackName }}
{{- $appFolderTitle := .Values.argusMetadata.appName -}}
{{- $envFolderName := printf "%s-%s-%s" .Values.argusMetadata.appName .Values.argusMetadata.envName .Values.argusMetadata.stackName }}
{{- $envFolderTitle := .Values.argusMetadata.envName -}}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaFolder
metadata:
name: {{ $rootFolderName }}
spec:
allowCrossNamespaceImport: true
resyncPeriod: 30s
instanceSelector:
matchLabels:
name: central-grafana
title: {{ $rootFolderTitle }}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaFolder
metadata:
name: {{ $appFolderName }}
spec:
allowCrossNamespaceImport: true
resyncPeriod: 30s
instanceSelector:
matchLabels:
name: central-grafana
title: {{ $appFolderTitle }}
parentFolderRef: {{ $rootFolderName }}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaFolder
metadata:
name: {{ $envFolderName }}
spec:
allowCrossNamespaceImport: true
resyncPeriod: 30s
instanceSelector:
matchLabels:
name: central-grafana
title: {{ $envFolderTitle }}
parentFolderRef: {{ $appFolderName }}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
Expand All @@ -12,7 +56,8 @@ spec:
resyncPeriod: 30s
instanceSelector:
matchLabels:
app: grafana
name: central-grafana
folderRef: {{ $envFolderName }}
json: |
{{- include "stack.grafanaDashboard.json" $global | nindent 4 }}
---
Expand Down
Loading