Skip to content

Commit 19b0bb2

Browse files
authored
feat: enhance configuration files with detailed comments for better clarity (#3706)
1 parent 7cc4ac8 commit 19b0bb2

15 files changed

Lines changed: 74 additions & 69 deletions

config/alertmanager.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1+
# Global Alertmanager runtime and SMTP settings.
12
global:
2-
resolve_timeout: 5m
3-
smtp_from: alert@openim.io
4-
smtp_smarthost: smtp.163.com:465
5-
smtp_auth_username: alert@openim.io
6-
smtp_auth_password: YOURAUTHPASSWORD
7-
smtp_require_tls: false
8-
smtp_hello: xxx
3+
resolve_timeout: 5m # Wait time before an alert is considered resolved when no further updates are received.
4+
smtp_from: alert@openim.io # Sender address displayed in alert emails.
5+
smtp_smarthost: smtp.163.com:465 # SMTP relay endpoint in host:port format.
6+
smtp_auth_username: alert@openim.io # SMTP authentication username (commonly the same as smtp_from).
7+
smtp_auth_password: YOURAUTHPASSWORD # SMTP authorization token or app password.
8+
smtp_require_tls: false # Set to true when your SMTP provider requires STARTTLS.
9+
smtp_hello: xxx # HELO/EHLO identity presented to the SMTP server.
910

1011
templates:
11-
- /etc/alertmanager/email.tmpl
12+
- /etc/alertmanager/email.tmpl # Go template file used to render HTML email content.
1213

14+
# Root routing tree for all incoming alerts.
1315
route:
14-
group_by: [ 'alertname' ]
15-
group_wait: 5s
16-
group_interval: 5s
17-
repeat_interval: 5m
18-
receiver: email
16+
group_by: [ 'alertname' ] # Alerts sharing this label value are batched into one notification.
17+
group_wait: 5s # Initial delay before sending the first notification for a new alert group.
18+
group_interval: 5s # Minimum interval between notifications for the same alert group.
19+
repeat_interval: 5m # Reminder interval while an alert group remains firing.
20+
receiver: email # Default receiver when no child route matches.
1921
routes:
2022
- matchers:
21-
- alertname = "XXX"
22-
group_by: [ 'instance' ]
23+
- alertname = "XXX" # Example matcher; replace with a real alert name or remove this route.
24+
group_by: [ 'instance' ] # Override grouping for this specific route.
2325
group_wait: 5s
2426
group_interval: 5s
2527
repeat_interval: 5m
2628
receiver: email
2729

2830
receivers:
29-
- name: email
31+
- name: email # Receiver name referenced by route.receiver.
3032
email_configs:
31-
- to: 'alert@example.com'
32-
html: '{{ template "email.to.html" . }}'
33-
headers: { Subject: "[OPENIM-SERVER]Alarm" }
34-
send_resolved: true
33+
- to: 'alert@example.com' # Recipient mailbox for alert notifications.
34+
html: '{{ template "email.to.html" . }}' # Rendered with the template declared in email.tmpl.
35+
headers: { Subject: "[OPENIM-SERVER]Alarm" } # Custom email subject line.
36+
send_resolved: true # Also send a notification when the alert recovers.

config/email.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{{/* OpenIM Alertmanager email template.
2+
This template renders both firing and resolved alerts.
3+
Each alert entry reads labels and annotations from Prometheus rule definitions. */}}
14
{{ define "email.to.html" }}
25
{{ if eq .Status "firing" }}
36
{{ range .Alerts }}

config/instance-down-rules.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1+
# Default Prometheus alert groups for OpenIM.
12
groups:
2-
- name: instance_down
3+
- name: instance_down # Fires when a monitored target remains unreachable.
34
rules:
45
- alert: InstanceDown
5-
expr: up == 0
6-
for: 1m
6+
expr: up == 0 # The built-in "up" metric is 0 when the latest scrape fails.
7+
for: 1m # Trigger only if the condition remains true for more than 1 minute.
78
labels:
8-
severity: critical
9+
severity: critical # Used by Alertmanager for routing and notification priority.
910
annotations:
1011
summary: "Instance {{ $labels.instance }} down"
11-
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes."
12+
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minute."
1213

13-
- name: database_insert_failure_alerts
14+
- name: database_insert_failure_alerts # Detects failures when persisting messages to Redis or MongoDB.
1415
rules:
1516
- alert: DatabaseInsertFailed
16-
expr: (increase(msg_insert_redis_failed_total[5m]) > 0) or (increase(msg_insert_mongo_failed_total[5m]) > 0)
17-
for: 1m
17+
expr: (increase(msg_insert_redis_failed_total[5m]) > 0) or (increase(msg_insert_mongo_failed_total[5m]) > 0) # Any positive increase indicates write failures occurred in the last 5 minutes.
18+
for: 1m # Avoid firing on very short spikes.
1819
labels:
1920
severity: critical
2021
annotations:
2122
summary: "Increase in MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter detected"
22-
description: "Either MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter has increased in the last 5 minutes, indicating failures in message insert operations to Redis or MongoDB,maybe the redis or mongodb is crash."
23+
description: "Either MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter increased in the last 5 minutes, indicating message insert failures to Redis or MongoDB and a possible backend outage."
2324

24-
- name: registrations_few
25+
- name: registrations_few # Operational early-warning rule for unusually low login/registration activity.
2526
rules:
2627
- alert: RegistrationsFew
27-
expr: increase(user_login_total[1h]) == 0
28+
expr: increase(user_login_total[1h]) == 0 # No successful login/registration events observed in 1 hour.
2829
for: 1m
2930
labels:
3031
severity: info
3132
annotations:
3233
summary: "Too few registrations within the time frame"
3334
description: "The number of registrations in the last hour is 0. There might be some issues."
3435

35-
- name: messages_few
36+
- name: messages_few # Operational early-warning rule for unusually low messaging activity.
3637
rules:
3738
- alert: MessagesFew
38-
expr: (increase(single_chat_msg_process_success_total[1h])+increase(group_chat_msg_process_success_total[1h])) == 0
39+
expr: (increase(single_chat_msg_process_success_total[1h])+increase(group_chat_msg_process_success_total[1h])) == 0 # No successful single or group messages observed in 1 hour.
3940
for: 1m
4041
labels:
4142
severity: info

config/openim-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ api:
88

99

1010
prometheus:
11-
# Whether to enable prometheus
11+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
1212
enable: true
1313
# autoSetPorts indicates whether to automatically set the ports
1414
autoSetPorts: true

config/openim-msggateway.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rpc:
99
ports:
1010

1111
prometheus:
12-
# Enable or disable Prometheus monitoring
12+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
1313
enable: true
1414
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
1515
# It will only take effect when autoSetPorts is set to false.

config/openim-msgtransfer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
prometheus:
2-
# Enable or disable Prometheus monitoring
2+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
33
enable: true
44
# autoSetPorts indicates whether to automatically set the ports
55
autoSetPorts: true

config/openim-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ circuitBreaker:
2828
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
2929

3030
prometheus:
31-
# Enable or disable Prometheus monitoring
31+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
3232
enable: false
3333
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
3434
# It will only take effect when autoSetPorts is set to false.

config/openim-rpc-auth.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rpc:
1111
ports:
1212

1313
prometheus:
14-
# Enable or disable Prometheus monitoring
14+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
1515
enable: true
1616
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
1717
# It will only take effect when autoSetPorts is set to false.

config/openim-rpc-conversation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rpc:
1111
ports:
1212

1313
prometheus:
14-
# Enable or disable Prometheus monitoring
14+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
1515
enable: true
1616
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
1717
# It will only take effect when autoSetPorts is set to false.

config/openim-rpc-friend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rpc:
1111
ports:
1212

1313
prometheus:
14-
# Enable or disable Prometheus monitoring
14+
# Enable Prometheus metrics exposure for this service; set to true to allow scraping.
1515
enable: true
1616
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
1717
# It will only take effect when autoSetPorts is set to false.

0 commit comments

Comments
 (0)