fix(matrix-synapse): add monitoring resources

This commit is contained in:
WrenIX 2024-02-14 00:03:10 +01:00
parent 465d04e3a8
commit f1b62fb5ad
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
8 changed files with 13678 additions and 4 deletions

View file

@ -4,9 +4,9 @@ name: matrix-synapse
description: Matrix reference homeserver description: Matrix reference homeserver
icon: https://matrix.org/images/matrix-logo.svg icon: https://matrix.org/images/matrix-logo.svg
type: application type: application
version: 0.0.1 version: 0.0.2
# renovate: image=ghcr.io/element-hq/synapse # renovate: image=ghcr.io/element-hq/synapse
appVersion: 1.100.0 appVersion: 1.101.0
maintainers: maintainers:
- name: WrenIX - name: WrenIX
url: https://wrenix.eu url: https://wrenix.eu

View file

@ -2,9 +2,9 @@
= matrix-synapse = matrix-synapse
image::https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square[Version: 0.0.1] image::https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square[Version: 0.0.2]
image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application] image::https://img.shields.io/badge/Version-application-informational?style=flat-square[Type: application]
image::https://img.shields.io/badge/AppVersion-1.100.0-informational?style=flat-square[AppVersion: 1.100.0] image::https://img.shields.io/badge/AppVersion-1.101.0-informational?style=flat-square[AppVersion: 1.101.0]
== Maintainers == Maintainers
.Maintainers .Maintainers
@ -137,6 +137,21 @@ helm uninstall matrix-synapse-release
| `nil` | `nil`
| if set it will overwrite all registry entries | if set it will overwrite all registry entries
| grafana.dashboards.annotations
| object
| `{}`
|
| grafana.dashboards.enabled
| bool
| `false`
|
| grafana.dashboards.labels.grafana_dashboard
| string
| `"1"`
|
| image.pullPolicy | image.pullPolicy
| string | string
| `"IfNotPresent"` | `"IfNotPresent"`
@ -272,6 +287,36 @@ helm uninstall matrix-synapse-release
| `"16Gi"` | `"16Gi"`
| |
| prometheus.podmonitor.enabled
| bool
| `false`
|
| prometheus.podmonitor.labels
| object
| `{}`
|
| prometheus.rules.additionalRules
| list
| `[]`
|
| prometheus.rules.defaults.enabled
| bool
| `true`
|
| prometheus.rules.enabled
| bool
| `false`
|
| prometheus.rules.labels
| object
| `{}`
|
| publicServerName | publicServerName
| string | string
| `nil` | `nil`

View file

@ -0,0 +1,4 @@
# Readme
## Changelog from monitoring resources
- Dashboard: https://github.com/element-hq/synapse/blob/v1.101.0/contrib/grafana/synapse.json

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,18 @@
{{- if .Values.grafana.dashboards.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "matrix-synapse.fullname" . }}-grafana-db
labels:
{{- include "matrix-synapse.labels" $ | nindent 4 }}
{{- with .Values.grafana.dashboards.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.grafana.dashboards.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{- ($.Files.Glob "grafana_dashboards/*.json" ).AsConfig | nindent 2 }}
{{- end }}

View file

@ -0,0 +1,19 @@
{{- if .Values.prometheus.podmonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "matrix-synapse.fullname" . }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
{{- with .Values.prometheus.podmonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "matrix-synapse.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: synapse
podMetricsEndpoints:
- port: metrics
path: "/_synapse/metrics"
{{- end }}

View file

@ -0,0 +1,97 @@
{{- if and ( .Values.prometheus.rules.enabled ) ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "matrix-synapse.fullname" . }}
{{- with .Values.prometheus.rules.namespace }}
namespace: {{ . | quote }}
{{- end }}
labels:
{{- include "matrix-synapse.labels" . | nindent 4 }}
{{- with .Values.prometheus.rules.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
groups:
{{- if .Values.prometheus.rules.defaults.enabled }}
- name: {{ template "matrix-synapse.name" . }}-Defaults
rules:
###
### Prometheus Console Only
### The following rules are only needed if you use the Prometheus Console
### in contrib/prometheus/consoles/synapse.html
###
- record: 'synapse_federation_client_sent'
labels:
type: "EDU"
expr: 'synapse_federation_client_sent_edus_total + 0'
- record: 'synapse_federation_client_sent'
labels:
type: "PDU"
expr: 'synapse_federation_client_sent_pdu_destinations_count_total + 0'
- record: 'synapse_federation_client_sent'
labels:
type: "Query"
expr: 'sum(synapse_federation_client_sent_queries) by (job)'
- record: 'synapse_federation_server_received'
labels:
type: "EDU"
expr: 'synapse_federation_server_received_edus_total + 0'
- record: 'synapse_federation_server_received'
labels:
type: "PDU"
expr: 'synapse_federation_server_received_pdus_total + 0'
- record: 'synapse_federation_server_received'
labels:
type: "Query"
expr: 'sum(synapse_federation_server_received_queries) by (job)'
- record: 'synapse_federation_transaction_queue_pending'
labels:
type: "EDU"
expr: 'synapse_federation_transaction_queue_pending_edus + 0'
- record: 'synapse_federation_transaction_queue_pending'
labels:
type: "PDU"
expr: 'synapse_federation_transaction_queue_pending_pdus + 0'
###
### End of 'Prometheus Console Only' rules block
###
###
### Grafana Only
### The following rules are only needed if you use the Grafana dashboard
### in contrib/grafana/synapse.json
###
- record: synapse_storage_events_persisted_by_source_type
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_type="remote"})
labels:
type: remote
- record: synapse_storage_events_persisted_by_source_type
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_entity="*client*",origin_type="local"})
labels:
type: local
- record: synapse_storage_events_persisted_by_source_type
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_entity!="*client*",origin_type="local"})
labels:
type: bridges
- record: synapse_storage_events_persisted_by_event_type
expr: sum without(origin_entity, origin_type) (synapse_storage_events_persisted_events_sep_total)
- record: synapse_storage_events_persisted_by_origin
expr: sum without(type) (synapse_storage_events_persisted_events_sep_total)
###
### End of 'Grafana Only' rules block
###
{{- end }}{{/* end-if .defaults.enabled */}}
{{- with .Values.prometheus.rules.additionalRules }}
- name: {{ template "matrix-synapse.name" $ }}-Additional
rules:
{{- toYaml . | nindent 4 }}
{{- end }}{{/* end-with additionalRules */}}
{{- end }}

View file

@ -911,3 +911,21 @@ serviceAccount:
annotations: {} annotations: {}
# eks.amazonaws.com/role-arn: arn:aws:iam::000000000000:role/matrix-synapse # eks.amazonaws.com/role-arn: arn:aws:iam::000000000000:role/matrix-synapse
# name: non-default-service-name # name: non-default-service-name
prometheus:
podmonitor:
enabled: false
labels: {}
rules:
enabled: false
labels: {}
defaults:
enabled: true
additionalRules: []
grafana:
dashboards:
enabled: false
labels:
grafana_dashboard: "1"
annotations: {}