Skip to content

Commit

Permalink
update config in charts, support specify id when upgrade route (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-sun-star authored Jun 12, 2024
1 parent c76879f commit b7e605f
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ data:
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
continue: true
receiver: 'local'
receivers:
- name: 'local'
Expand Down
2 changes: 2 additions & 0 deletions charts/oceanbase-dashboard/templates/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
value: {{ .Values.userCredentials | default (nospace (cat .Release.Name "-user-credentials")) }}
- name: USER_NAMESPACE
value: {{ .Values.userNamespace | default .Release.Namespace }}
- name: CONFIG_NAMESPACE
value: {{ .Values.configNamespace | default .Release.Namespace }}
- name: PROMETHEUS_CONFIG
value: {{ .Release.Name }}-prometheus-server-conf
- name: PROMETHEUS_RULE_CONFIG
Expand Down
50 changes: 25 additions & 25 deletions charts/oceanbase-dashboard/templates/prom-rule-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
name: {{ .Release.Name }}-prometheus-rules-conf
data:
prometheus.rules: |-
groups:
{{`groups:
- name: ob-rule
rules:
- alert: cluster_active_session
Expand All @@ -18,7 +18,7 @@ data:
instance_type: obcluster
rule_name: cluster_active_session
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has {{ $value }} active sessions on observer {{ $labels.svr_ip }}.'
summary: 'Too much active sessions for cluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -29,7 +29,7 @@ data:
instance_type: obcluster
rule_name: inactive_server
rule_type: builtin
serverity: critical
severity: critical
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has {{ $value }} inactive observers.'
summary: 'Found inactive observer in cluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -40,7 +40,7 @@ data:
instance_type: obcluster
rule_name: index_fail
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has {{ $value }} index fail tables.'
summary: 'Found index fail table in cluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -51,7 +51,7 @@ data:
instance_type: obcluster
rule_name: frozen_version_check
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has {{ $value }} delta versions between merged and frozen data.'
summary: 'Frozen version is too much larger than merged version.'
Expand All @@ -62,7 +62,7 @@ data:
instance_type: obcluster
rule_name: cluster_merge_error
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} merge error.'
summary: 'Cluster {{ $labels.ob_cluster_name }} merge error.'
Expand All @@ -73,7 +73,7 @@ data:
instance_type: obcluster
rule_name: cluster_merge_timeout
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} merge timeout.'
summary: 'Cluster {{ $labels.ob_cluster_name }} merge timeout.'
Expand All @@ -84,7 +84,7 @@ data:
instance_type: obcluster
rule_name: cluster_no_frozen
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has not frozen for {{ $value }} seconds.'
summary: 'Cluster {{ $labels.ob_cluster_name }} has not frozen for a long time.'
Expand All @@ -95,7 +95,7 @@ data:
instance_type: obcluster
rule_name: cluster_no_merge
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Cluster {{ $labels.ob_cluster_name }} has not merge for {{ $value }} seconds.'
summary: 'Cluster {{ $labels.ob_cluster_name }} has not merge for a long time.'
Expand All @@ -106,7 +106,7 @@ data:
instance_type: obtenant
rule_name: tenant_active_session
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} has {{ $value }} active sessions on observer {{ $labels.svr_ip }}.'
summary: 'Too much active sessions for tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -117,7 +117,7 @@ data:
instance_type: obtenant
rule_name: tenant_compaction_error
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} compaction error.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} compaction error.'
Expand All @@ -128,7 +128,7 @@ data:
instance_type: obtenant
rule_name: tenant_cpu_usage
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} on observer {{ $labels.svr_ip }} cpu usage {{ $value }}%.'
summary: 'High cpu usage detected for tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -139,7 +139,7 @@ data:
instance_type: obtenant
rule_name: tenant_log_disk_used_percent
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} on observer {{ $labels.svr_ip }} log used percent {{ $value }} is over threshold.'
summary: 'High log disk used percent detected for tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -150,7 +150,7 @@ data:
instance_type: obtenant
rule_name: tenant_log_stream_downgrade
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} downgrade log stream count is {{ $value }}.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found log stream downgrade.'
Expand All @@ -161,7 +161,7 @@ data:
instance_type: obtenant
rule_name: tenant_no_compaction
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} has not compact for {{ $value }} seconds.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} has not compact for a long time.'
Expand All @@ -172,7 +172,7 @@ data:
instance_type: obtenant
rule_name: tenant_no_frozen
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} has not frozen for {{ $value }} seconds.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} has not frozen for a long time.'
Expand All @@ -183,7 +183,7 @@ data:
instance_type: obtenant
rule_name: tenant_partition_leader_absent
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found {{ $value }} partition leader absent.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found partition leader absent.'
Expand All @@ -194,7 +194,7 @@ data:
instance_type: obtenant
rule_name: tenant_partition_replica_absent
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found {{ $value }} partition replica absent.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found partition replica absent.'
Expand All @@ -205,7 +205,7 @@ data:
instance_type: obtenant
rule_name: tenant_task_timeout
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found task not finished for {{ $value }} seconds.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} found task not finished for a long time.'
Expand All @@ -216,7 +216,7 @@ data:
instance_type: obtenant
rule_name: standby_tenant_sync_delay
rule_type: builtin
serverity: caution
severity: caution
annotations:
description: 'Standby tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} sync delay {{ $value }} seconds.'
summary: 'Standby tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} sync delay too long.'
Expand All @@ -227,7 +227,7 @@ data:
instance_type: obtenant
rule_name: standby_tenant_sync_error
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Standby tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} sync error.'
summary: 'Standby tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} sync error.'
Expand All @@ -238,7 +238,7 @@ data:
instance_type: obtenant
rule_name: tenant_memstore_percent
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} on observer {{ $labels.svr_ip }} memstore percent {{ $value }} is over threshold.'
summary: 'High memstore used ratio detected for tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -249,7 +249,7 @@ data:
instance_type: obtenant
rule_name: tenant_active_memstore_percent
rule_type: builtin
serverity: warning
severity: warning
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} on observer {{ $labels.svr_ip }} active memstore percent {{ $value }} is over threshold.'
summary: 'High active memstore used ratio detected for tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }}.'
Expand All @@ -260,7 +260,7 @@ data:
instance_type: obtenant
rule_name: tenant_thread_used_percent
rule_type: builtin
serverity: caution
severity: caution
annotations:
description: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} thread used percent is {{ $value }}.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} used too much thread.'
summary: 'Tenant {{ $labels.tenant_name }} of obcluster {{ $labels.ob_cluster_name }} used too much thread.'`}}
3 changes: 2 additions & 1 deletion charts/oceanbase-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ adminPassword:

userCredentials:
userNamespace:
configNamespace:

service:
type: NodePort
port: 80
port: 80
4 changes: 2 additions & 2 deletions internal/dashboard/business/alarm/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func DeleteRoute(ctx context.Context, id string) error {
return updateAlertManagerConfig(ctx, config)
}

func CreateOrUpdateRoute(ctx context.Context, r *route.Route) error {
func CreateOrUpdateRoute(ctx context.Context, r *route.RouteParam) error {
config, err := getAlertmanagerConfig(ctx)
if err != nil {
return errors.Wrap(err, errors.ErrExternal, "Failed to get config")
}
configRoutes := make([]*amconfig.Route, 0)
for _, amroute := range config.Route.Routes {
if route.NewRoute(amroute).Hash() == r.Hash() {
if route.NewRoute(amroute).Hash() == r.Id {
continue
}
configRoutes = append(configRoutes, amroute)
Expand Down
Loading

0 comments on commit b7e605f

Please sign in to comment.