Skip to content

Commit c0a0b4d

Browse files
authored
Merge pull request #3059 from icey-yu/fix-pro
fix: add autoSetPort && prometheus port discovery
2 parents 7912ac0 + 89503aa commit c0a0b4d

39 files changed

+674
-252
lines changed

.env

+5
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ OPENIM_ADMIN_FRONT_IMAGE=openim/openim-admin-front:release-v1.8.4
1515
#OPENIM_ADMIN_FRONT_IMAGE=registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-admin-front:release-v1.8.4
1616

1717
DATA_DIR=./
18+
19+
PROMETHEUS_PORT=19091
20+
ALERTMANAGER_PORT=19093
21+
GRAFANA_PORT=13000
22+
NODE_EXPORTER_PORT=19100

config/openim-api.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ api:
1010
prometheus:
1111
# Whether to enable prometheus
1212
enable: true
13+
# autoSetPorts indicates whether to automatically set the ports
14+
autoSetPorts: true
1315
# Prometheus listening ports, must match the number of api.ports
16+
# It will only take effect when autoSetPorts is set to false.
1417
ports: [ 12002 ]
1518
# This address can be accessed via a browser
1619
grafanaURL: http://127.0.0.1:13000/

config/openim-msggateway.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
rpc:
22
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
3-
registerIP:
3+
registerIP:
4+
# autoSetPorts indicates whether to automatically set the ports
5+
autoSetPorts: true
46
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
7+
# It will only take effect when autoSetPorts is set to false.
58
ports: [ 10140, 10141, 10142, 10143, 10144, 10145, 10146, 10147, 10148, 10149, 10150, 10151, 10152, 10153, 10154, 10155 ]
69

710
prometheus:
811
# Enable or disable Prometheus monitoring
912
enable: true
1013
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
14+
# It will only take effect when autoSetPorts is set to false.
1115
ports: [ 12140, 12141, 12142, 12143, 12144, 12145, 12146, 12147, 12148, 12149, 12150, 12151, 12152, 12153, 12154, 12155 ]
1216

1317
# IP address that the RPC/WebSocket service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP

config/openim-msgtransfer.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
prometheus:
22
# Enable or disable Prometheus monitoring
33
enable: true
4+
# autoSetPorts indicates whether to automatically set the ports
5+
autoSetPorts: true
46
# List of ports that Prometheus listens on; each port corresponds to an instance of monitoring. Ensure these are managed accordingly
5-
# Because four instances have been launched, four ports need to be specified
7+
# It will only take effect when autoSetPorts is set to false.
68
ports: [ 12020, 12021, 12022, 12023, 12024, 12025, 12026, 12027, 12028, 12029, 12030, 12031, 12032, 12033, 12034, 12035 ]

config/openim-push.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10170, 10171, 10172, 10173, 10174, 10175, 10176, 10177, 10178, 10179, 10180, 10181, 10182, 10183, 10184, 10185 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12170, 12171, 12172, 12173, 12174, 12175, 12176, 12177, 12178, 12179, 12180, 12182, 12183, 12184, 12185, 12186 ]
1418

1519
maxConcurrentWorkers: 3

config/openim-rpc-auth.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10200 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12200 ]
1418

1519
tokenPolicy:

config/openim-rpc-conversation.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10220 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12220 ]

config/openim-rpc-friend.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10240 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12240 ]

config/openim-rpc-group.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10260 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12260 ]
1418

1519

config/openim-rpc-msg.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10280 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12280 ]
1418

1519

config/openim-rpc-third.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ rpc:
33
registerIP:
44
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
55
listenIP: 0.0.0.0
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
68
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10300 ]
811

912
prometheus:
1013
# Enable or disable Prometheus monitoring
1114
enable: true
1215
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12300 ]
1418

1519

config/openim-rpc-user.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ rpc:
33
registerIP:
44
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, if blank, the internal network IP is automatically obtained by default
55
listenIP: 0.0.0.0
6-
# Listening ports; if multiple are configured, multiple instances will be launched, and must be consistent with the number of prometheus.ports
6+
# autoSetPorts indicates whether to automatically set the ports
7+
autoSetPorts: true
8+
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
9+
# It will only take effect when autoSetPorts is set to false.
710
ports: [ 10320 ]
811

912
prometheus:
1013
# Whether to enable prometheus
1114
enable: true
1215
# Prometheus listening ports, must be consistent with the number of rpc.ports
16+
# It will only take effect when autoSetPorts is set to false.
1317
ports: [ 12320 ]

config/prometheus.yml

+80-47
Original file line numberDiff line numberDiff line change
@@ -26,61 +26,94 @@ scrape_configs:
2626
- job_name: node_exporter
2727
static_configs:
2828
- targets: [ internal_ip:20500 ]
29+
2930
- job_name: openimserver-openim-api
30-
static_configs:
31-
- targets: [ internal_ip:12002 ]
32-
labels:
33-
namespace: default
31+
http_sd_configs:
32+
- url: "http://internal_ip:10002/prometheus_discovery/api"
33+
# static_configs:
34+
# - targets: [ internal_ip:12002 ]
35+
# labels:
36+
# namespace: default
37+
3438
- job_name: openimserver-openim-msggateway
35-
static_configs:
36-
- targets: [ internal_ip:12140 ]
37-
# - targets: [ internal_ip:12140, internal_ip:12141, internal_ip:12142, internal_ip:12143, internal_ip:12144, internal_ip:12145, internal_ip:12146, internal_ip:12147, internal_ip:12148, internal_ip:12149, internal_ip:12150, internal_ip:12151, internal_ip:12152, internal_ip:12153, internal_ip:12154, internal_ip:12155 ]
38-
labels:
39-
namespace: default
39+
http_sd_configs:
40+
- url: "http://internal_ip:10002/prometheus_discovery/msg_gateway"
41+
# static_configs:
42+
# - targets: [ internal_ip:12140 ]
43+
# # - targets: [ internal_ip:12140, internal_ip:12141, internal_ip:12142, internal_ip:12143, internal_ip:12144, internal_ip:12145, internal_ip:12146, internal_ip:12147, internal_ip:12148, internal_ip:12149, internal_ip:12150, internal_ip:12151, internal_ip:12152, internal_ip:12153, internal_ip:12154, internal_ip:12155 ]
44+
# labels:
45+
# namespace: default
46+
4047
- job_name: openimserver-openim-msgtransfer
41-
static_configs:
42-
- targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027 ]
43-
# - targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027, internal_ip:12028, internal_ip:12029, internal_ip:12030, internal_ip:12031, internal_ip:12032, internal_ip:12033, internal_ip:12034, internal_ip:12035 ]
44-
labels:
45-
namespace: default
48+
http_sd_configs:
49+
- url: "http://internal_ip:10002/prometheus_discovery/msg_transfer"
50+
# static_configs:
51+
# - targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027 ]
52+
# # - targets: [ internal_ip:12020, internal_ip:12021, internal_ip:12022, internal_ip:12023, internal_ip:12024, internal_ip:12025, internal_ip:12026, internal_ip:12027, internal_ip:12028, internal_ip:12029, internal_ip:12030, internal_ip:12031, internal_ip:12032, internal_ip:12033, internal_ip:12034, internal_ip:12035 ]
53+
# labels:
54+
# namespace: default
55+
4656
- job_name: openimserver-openim-push
47-
static_configs:
48-
- targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177 ]
49-
# - targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177, internal_ip:12178, internal_ip:12179, internal_ip:12180, internal_ip:12182, internal_ip:12183, internal_ip:12184, internal_ip:12185, internal_ip:12186 ]
50-
labels:
51-
namespace: default
57+
http_sd_configs:
58+
- url: "http://internal_ip:10002/prometheus_discovery/push"
59+
# static_configs:
60+
# - targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177 ]
61+
## - targets: [ internal_ip:12170, internal_ip:12171, internal_ip:12172, internal_ip:12173, internal_ip:12174, internal_ip:12175, internal_ip:12176, internal_ip:12177, internal_ip:12178, internal_ip:12179, internal_ip:12180, internal_ip:12182, internal_ip:12183, internal_ip:12184, internal_ip:12185, internal_ip:12186 ]
62+
# labels:
63+
# namespace: default
64+
5265
- job_name: openimserver-openim-rpc-auth
53-
static_configs:
54-
- targets: [ internal_ip:12200 ]
55-
labels:
56-
namespace: default
66+
http_sd_configs:
67+
- url: "http://internal_ip:10002/prometheus_discovery/auth"
68+
# static_configs:
69+
# - targets: [ internal_ip:12200 ]
70+
# labels:
71+
# namespace: default
72+
5773
- job_name: openimserver-openim-rpc-conversation
58-
static_configs:
59-
- targets: [ internal_ip:12220 ]
60-
labels:
61-
namespace: default
74+
http_sd_configs:
75+
- url: "http://internal_ip:10002/prometheus_discovery/conversation"
76+
# static_configs:
77+
# - targets: [ internal_ip:12220 ]
78+
# labels:
79+
# namespace: default
80+
6281
- job_name: openimserver-openim-rpc-friend
63-
static_configs:
64-
- targets: [ internal_ip:12240 ]
65-
labels:
66-
namespace: default
82+
http_sd_configs:
83+
- url: "http://internal_ip:10002/prometheus_discovery/friend"
84+
# static_configs:
85+
# - targets: [ internal_ip:12240 ]
86+
# labels:
87+
# namespace: default
88+
6789
- job_name: openimserver-openim-rpc-group
68-
static_configs:
69-
- targets: [ internal_ip:12260 ]
70-
labels:
71-
namespace: default
90+
http_sd_configs:
91+
- url: "http://internal_ip:10002/prometheus_discovery/group"
92+
# static_configs:
93+
# - targets: [ internal_ip:12260 ]
94+
# labels:
95+
# namespace: default.
96+
7297
- job_name: openimserver-openim-rpc-msg
73-
static_configs:
74-
- targets: [ internal_ip:12280 ]
75-
labels:
76-
namespace: default
98+
http_sd_configs:
99+
- url: "http://internal_ip:10002/prometheus_discovery/msg"
100+
# static_configs:
101+
# - targets: [ internal_ip:12280 ]
102+
# labels:
103+
# namespace: default
104+
77105
- job_name: openimserver-openim-rpc-third
78-
static_configs:
79-
- targets: [ internal_ip:12300 ]
80-
labels:
81-
namespace: default
106+
http_sd_configs:
107+
- url: "http://internal_ip:10002/prometheus_discovery/third"
108+
# static_configs:
109+
# - targets: [ internal_ip:12300 ]
110+
# labels:
111+
# namespace: default
112+
82113
- job_name: openimserver-openim-rpc-user
83-
static_configs:
84-
- targets: [ internal_ip:12320 ]
85-
labels:
86-
namespace: default
114+
http_sd_configs:
115+
- url: "http://internal_ip:10002/prometheus_discovery/user"
116+
# static_configs:
117+
# - targets: [ internal_ip:12320 ]
118+
# labels:
119+
# namespace: default

0 commit comments

Comments
 (0)