add getPrometheus url api

pull/1337/head
lin.huang 2 years ago
parent 6a83403e57
commit 60c092308d

@ -383,6 +383,7 @@ callback:
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh # The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
prometheus: prometheus:
enable: true enable: true
prometheusUrl: "https://openim.prometheus"
apiPrometheusPort: [20100] apiPrometheusPort: [20100]
userPrometheusPort: [ 20110 ] userPrometheusPort: [ 20110 ]
friendPrometheusPort: [ 20120 ] friendPrometheusPort: [ 20120 ]

@ -383,6 +383,7 @@ callback:
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh # The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
prometheus: prometheus:
enable: ${PROMETHEUS_ENABLE} enable: ${PROMETHEUS_ENABLE}
prometheusUrl: ${PROMETHEUS_URL}
apiPrometheusPort: [${API_PROM_PORT}] apiPrometheusPort: [${API_PROM_PORT}]
userPrometheusPort: [ ${USER_PROM_PORT} ] userPrometheusPort: [ ${USER_PROM_PORT} ]
friendPrometheusPort: [ ${FRIEND_PROM_PORT} ] friendPrometheusPort: [ ${FRIEND_PROM_PORT} ]

@ -143,6 +143,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
// Third service // Third service
thirdGroup := r.Group("/third", ParseToken) thirdGroup := r.Group("/third", ParseToken)
{ {
thirdGroup.GET("/prometheus", GetPrometheus)
t := NewThirdApi(*thirdRpc) t := NewThirdApi(*thirdRpc)
thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken) thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken)
thirdGroup.POST("/set_app_badge", t.SetAppBadge) thirdGroup.POST("/set_app_badge", t.SetAppBadge)

@ -15,6 +15,7 @@
package api package api
import ( import (
config2 "github.com/openimsdk/open-im-server/v3/pkg/common/config"
"math/rand" "math/rand"
"net/http" "net/http"
"strconv" "strconv"
@ -118,3 +119,7 @@ func (o *ThirdApi) DeleteLogs(c *gin.Context) {
func (o *ThirdApi) SearchLogs(c *gin.Context) { func (o *ThirdApi) SearchLogs(c *gin.Context) {
a2r.Call(third.ThirdClient.SearchLogs, o.Client, c) a2r.Call(third.ThirdClient.SearchLogs, o.Client, c)
} }
func GetPrometheus(c *gin.Context) {
c.Redirect(http.StatusFound, config2.Config.Prometheus.PrometheusUrl)
}

@ -262,19 +262,20 @@ type configStruct struct {
} `yaml:"callback"` } `yaml:"callback"`
Prometheus struct { Prometheus struct {
Enable bool `yaml:"enable"` Enable bool `yaml:"enable"`
ApiPrometheusPort []int `yaml:"apiPrometheusPort"` PrometheusUrl string `yaml:"prometheusUrl"`
UserPrometheusPort []int `yaml:"userPrometheusPort"` ApiPrometheusPort []int `yaml:"apiPrometheusPort"`
FriendPrometheusPort []int `yaml:"friendPrometheusPort"` UserPrometheusPort []int `yaml:"userPrometheusPort"`
MessagePrometheusPort []int `yaml:"messagePrometheusPort"` FriendPrometheusPort []int `yaml:"friendPrometheusPort"`
MessageGatewayPrometheusPort []int `yaml:"messageGatewayPrometheusPort"` MessagePrometheusPort []int `yaml:"messagePrometheusPort"`
GroupPrometheusPort []int `yaml:"groupPrometheusPort"` MessageGatewayPrometheusPort []int `yaml:"messageGatewayPrometheusPort"`
AuthPrometheusPort []int `yaml:"authPrometheusPort"` GroupPrometheusPort []int `yaml:"groupPrometheusPort"`
PushPrometheusPort []int `yaml:"pushPrometheusPort"` AuthPrometheusPort []int `yaml:"authPrometheusPort"`
ConversationPrometheusPort []int `yaml:"conversationPrometheusPort"` PushPrometheusPort []int `yaml:"pushPrometheusPort"`
RtcPrometheusPort []int `yaml:"rtcPrometheusPort"` ConversationPrometheusPort []int `yaml:"conversationPrometheusPort"`
MessageTransferPrometheusPort []int `yaml:"messageTransferPrometheusPort"` RtcPrometheusPort []int `yaml:"rtcPrometheusPort"`
ThirdPrometheusPort []int `yaml:"thirdPrometheusPort"` MessageTransferPrometheusPort []int `yaml:"messageTransferPrometheusPort"`
ThirdPrometheusPort []int `yaml:"thirdPrometheusPort"`
} `yaml:"prometheus"` } `yaml:"prometheus"`
Notification notification `yaml:"notification"` Notification notification `yaml:"notification"`
} }

@ -338,6 +338,7 @@ def "IOS_PRODUCTION" "false" # IOS生产
###################### Prometheus 配置信息 ###################### ###################### Prometheus 配置信息 ######################
def "PROMETHEUS_ENABLE" "false" # 是否启用 Prometheus def "PROMETHEUS_ENABLE" "false" # 是否启用 Prometheus
def "PROMETHEUS_URL" "/prometheus"
# Api 服务的 Prometheus 端口 # Api 服务的 Prometheus 端口
readonly API_PROM_PORT=${API_PROM_PORT:-'20100'} readonly API_PROM_PORT=${API_PROM_PORT:-'20100'}
# User 服务的 Prometheus 端口 # User 服务的 Prometheus 端口

Loading…
Cancel
Save