From 92dc36f480acde7aaf12490e890504dfd7fc4a66 Mon Sep 17 00:00:00 2001 From: x-shadow-man <1494445739@qq.com> Date: Fri, 22 Jul 2022 09:40:54 +0800 Subject: [PATCH 01/31] config perf --- config/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.yaml b/config/config.yaml index c552a954d..145cccb62 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -72,7 +72,7 @@ kafka: serverip: 0.0.0.0 #作为rpc时,注册到etcd的地址,单机默认即可,如果是集群部署,需要修改(具体使用内网地址还是外网地址,要依情况而定,目的是api/gateway能访问到) -rpcRegisterIP: 127.0.0.1 +rpcRegisterIP: #默认即可 listenIP: 0.0.0.0 From 456e2f569306a6834ae857b9ab2f8cd196ee6d47 Mon Sep 17 00:00:00 2001 From: x-shadow-man <1494445739@qq.com> Date: Mon, 25 Jul 2022 10:24:21 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=A7=A3=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.yaml b/config/config.yaml index 145cccb62..b96bbaa2a 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -71,7 +71,7 @@ kafka: #如果是单机模式,用0.0.0.0或者不填,默认即可 serverip: 0.0.0.0 -#作为rpc时,注册到etcd的地址,单机默认即可,如果是集群部署,需要修改(具体使用内网地址还是外网地址,要依情况而定,目的是api/gateway能访问到) +#作为rpc时,注册到etcd的地址,单机或内网集群调用默认为空即可(会默认注册本机ip),如果需要注册外网ip,需要修改(目的是api/gateway能访问到) rpcRegisterIP: #默认即可 listenIP: 0.0.0.0 From 5e09e3e07284be4d4aaf24b97fb73dd38d9fb45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=B0=8F?= Date: Thu, 11 Aug 2022 17:34:57 +0800 Subject: [PATCH 03/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8Daws=20s3=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index d92f6c9ea..c2b033599 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -130,15 +130,14 @@ credential: #腾讯cos,发送图片、视频、文件时需要,请自行申 stsDurationSeconds: 3600 OssRoleArn: "acs:ram::xxx:role/xxx" aws: - accessKeyID: ******************** #AssumeRole用户关联的accessKeyID - accessKeySecret: **************************************** #AssumeRole用户关联的accessKeySecrect - region: ap-southeast-1 #分区 - bucket: ouyang #桶 - finalHost: ouyang.s3.ap-southeast-1.amazonaws.com #对外Host - roleArn: arn:aws:iam::192209831083:role/AWS_S3_FOR_OUYANG #RoleArn - externalId: AssumeRoleExtend #角色扩展Id - roleSessionName: Required-AWS-ID-OPENIM #角色SESSION名称 - + accessKeyID: AKIASZQEZISVRBN4UEWJ #AssumeRole用户关联的accessKeyID + accessKeySecret: eBS3RyCRD8yUa7I7EGPbxjyBlKtdzN5a6tDnY/wZ #AssumeRole用户关联的accessKeySecrect + region: ap-southeast-1 #分区 + bucket: ouyang #桶 + finalHost: ouyang.s3.ap-southeast-1.amazonaws.com #对外Host + roleArn: arn:aws:iam::192209831083:role/AWS_S3_FOR_OUYANG #RoleArn + externalId: AssumeRoleExtend #角色扩展Id + roleSessionName: Required-AWS-ID-OPENIM #角色SESSION名称 dtm: serverURL: 127.0.0.1:10007 From 5cb3b8cfbf2f64cfa510cd6281a64e3e90c785e3 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 11 Aug 2022 17:49:22 +0800 Subject: [PATCH 04/31] submodule update --- cmd/Open-IM-SDK-Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/Open-IM-SDK-Core b/cmd/Open-IM-SDK-Core index 5e8d3f536..7ce9f1484 160000 --- a/cmd/Open-IM-SDK-Core +++ b/cmd/Open-IM-SDK-Core @@ -1 +1 @@ -Subproject commit 5e8d3f5366700f00db7db2905da27189b9353630 +Subproject commit 7ce9f14846f90b42777577774feb869f149da067 From 73118ce447b7e9934d9fe2c59c7176076749c66b Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Fri, 12 Aug 2022 21:49:54 +0800 Subject: [PATCH 05/31] config recover --- config/config.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index 7192bf255..998a486c5 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -46,9 +46,9 @@ kafka: ws2mschat: addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可 topic: "ws2ms_chat" #用于mongo和mysql保存消息 -# ws2mschatoffline: -# addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可 -# topic: "ws2ms_chat_offline" #原为离线用户消息处理,目前暂时弃用 + ws2mschatoffline: + addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可 + topic: "ws2ms_chat_offline" #原为离线用户消息处理,目前暂时弃用 msgtomongo: addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可 topic: "msg_to_mongo" @@ -63,6 +63,7 @@ kafka: + #---------------Internal service configuration---------------------# # The service ip default is empty, From 8cf7282f468f229046bcee3ad7a9889b1b14e969 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 24 Aug 2022 18:12:00 +0800 Subject: [PATCH 06/31] add version --- config/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.yaml b/config/config.yaml index 7236c9c32..5fbfe7492 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -2,7 +2,7 @@ # The class cannot be named by Pascal or camel case. # If it is not used, the corresponding structure will not be set, # and it will not be read naturally. -serverversion: 2.3.0 +serverversion: 2.3.1 #---------------Infrastructure configuration---------------------# etcd: etcdSchema: openim #默认即可 From 4001897338d4a1423330f5fb8c1ee331c27371c2 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 25 Aug 2022 14:02:18 +0800 Subject: [PATCH 07/31] compose file update --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index aeac41995..115c49f9e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -126,7 +126,7 @@ services: # STORE_PORT: 3306 open_im_server: - image: openim/open_im_server:v2.3.0 + image: openim/open_im_server:v2.3.1 container_name: open_im_server volumes: - ./logs:/Open-IM-Server/logs From 4a2a9eb9978421838f9a6ca41e6ca2ff5a05c245 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 7 Sep 2022 16:41:18 +0800 Subject: [PATCH 08/31] fcm push modify --- internal/push/fcm/push.go | 15 +++++++++++++++ pkg/common/db/RedisModel.go | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/internal/push/fcm/push.go b/internal/push/fcm/push.go index 48da67f11..8a739335a 100644 --- a/internal/push/fcm/push.go +++ b/internal/push/fcm/push.go @@ -6,6 +6,7 @@ import ( "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "context" + go_redis "github.com/go-redis/redis/v8" "path/filepath" "strconv" @@ -85,6 +86,20 @@ func (f *Fcm) Push(accounts []string, title, detailContent, operationID string, if err == nil { apns.Payload.Aps.Badge = &unreadCountSum } else { + log.Error(operationID, "IncrUserBadgeUnreadCountSum redis err", err.Error(), uid) + Fail++ + continue + } + } else { + unreadCountSum, err := db.DB.GetUserBadgeUnreadCountSum(uid) + if err == nil && unreadCountSum != 0 { + apns.Payload.Aps.Badge = &unreadCountSum + } else if err == go_redis.Nil || unreadCountSum == 0 { + zero := 1 + apns.Payload.Aps.Badge = &zero + } else { + log.Error(operationID, "GetUserBadgeUnreadCountSum redis err", err.Error(), uid) + Fail++ continue } } diff --git a/pkg/common/db/RedisModel.go b/pkg/common/db/RedisModel.go index 95786fe6d..efd0db9a3 100644 --- a/pkg/common/db/RedisModel.go +++ b/pkg/common/db/RedisModel.go @@ -429,3 +429,8 @@ func (d *DataBases) SetUserBadgeUnreadCountSum(uid string, value int) error { key := userBadgeUnreadCountSum + uid return d.RDB.Set(context.Background(), key, value, 0).Err() } +func (d *DataBases) GetUserBadgeUnreadCountSum(uid string) (int, error) { + key := userBadgeUnreadCountSum + uid + seq, err := d.RDB.Get(context.Background(), key).Result() + return utils.StringToInt(seq), err +} From d00b265347b196185f29d99b821dd56dbb4325df Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 7 Sep 2022 16:53:53 +0800 Subject: [PATCH 09/31] prome --- go.mod | 3 ++- go.sum | 24 ++++++++++++++++++++++++ internal/cms_api/prome.go | 14 ++++++++++++++ internal/cms_api/router.go | 7 ++++++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 internal/cms_api/prome.go diff --git a/go.mod b/go.mod index 94d0db4d2..eb00c505f 100644 --- a/go.mod +++ b/go.mod @@ -38,6 +38,7 @@ require ( github.com/olivere/elastic/v7 v7.0.23 github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.13.0 // indirect github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.8.1 @@ -62,7 +63,7 @@ require ( golang.org/x/tools v0.1.11 // indirect google.golang.org/api v0.59.0 google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.28.0 + google.golang.org/protobuf v1.28.1 gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/ini.v1 v1.66.2 // indirect diff --git a/go.sum b/go.sum index 00cee68d9..74c81cccd 100644 --- a/go.sum +++ b/go.sum @@ -125,6 +125,7 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= @@ -202,9 +203,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -428,6 +431,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= @@ -492,18 +496,29 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM= @@ -726,9 +741,12 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1 golang.org/x/net v0.0.0-20210427231257-85d9c07bbe3a/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220622184535-263ec571b305 h1:dAgbJ2SP4jD6XYfMNLVj0BF21jo2PjChrtGaAvF5M3I= @@ -750,6 +768,7 @@ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4TupZy7bf4sxFZnN2ZOcvUE= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -762,6 +781,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -830,6 +851,7 @@ golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 h1:wEZYwx+kK+KlZ0hpvP2Ls1Xr4+RWnlzGFwPP0aiDjIU= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1056,6 +1078,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= diff --git a/internal/cms_api/prome.go b/internal/cms_api/prome.go new file mode 100644 index 000000000..dfe96d626 --- /dev/null +++ b/internal/cms_api/prome.go @@ -0,0 +1,14 @@ +package cms_api + +import ( + "github.com/gin-gonic/gin" + "github.com/prometheus/client_golang/prometheus/promhttp" +) + +func prometheusHandler() gin.HandlerFunc { + h := promhttp.Handler() + + return func(c *gin.Context) { + h.ServeHTTP(c.Writer, c.Request) + } +} diff --git a/internal/cms_api/router.go b/internal/cms_api/router.go index 7636eee8c..c5ff5aab2 100644 --- a/internal/cms_api/router.go +++ b/internal/cms_api/router.go @@ -64,9 +64,14 @@ func NewGinRouter() *gin.Engine { { messageCMSRouterGroup.POST("/get_chat_logs", messageCMS.GetChatLogs) } - friendCMSRouterGroup := r2.Group("friend") + friendCMSRouterGroup := r2.Group("/friend") { friendCMSRouterGroup.POST("/get_friends", friend.GetUserFriends) } + + prometheusRouterGroup := r2.Group("/prometheus") + { + prometheusRouterGroup.GET("/metrics", prometheusHandler()) + } return baseRouter } From 95910f5c1785c270b2f9ea243aabd329609d046e Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 01:27:05 +0800 Subject: [PATCH 10/31] prome --- config/config.yaml | 1 + docker-compose.yaml | 43 ++++++++++++++++------ docker-compose_cfg/datasource-compose.yaml | 13 +++++++ docker-compose_cfg/prometheus-compose.yml | 13 +++++++ 4 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 docker-compose_cfg/datasource-compose.yaml create mode 100644 docker-compose_cfg/prometheus-compose.yml diff --git a/config/config.yaml b/config/config.yaml index 55a96f0b8..e51f3e3f9 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -757,3 +757,4 @@ demo: rtc: signalTimeout: 35 + diff --git a/docker-compose.yaml b/docker-compose.yaml index 115c49f9e..4f0c5bd65 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -112,18 +112,7 @@ services: MINIO_ROOT_PASSWORD: key12345 restart: always command: minio server /data --console-address ':9090' - # - # dtm: - # image: yedf/dtm - # ports: - # - 36789:36789 - # - 36790:36790 - # environment: - # STORE_DRIVER: mysql - # STORE_HOST: localhost - # STORE_USER: root - # STORE_PASSWORD: '' - # STORE_PORT: 3306 + open_im_server: image: openim/open_im_server:v2.3.1 @@ -147,3 +136,33 @@ services: options: max-size: "1g" max-file: "2" + + prometheus: + image: prom/prometheus + volumes: + - ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml + container_name: prometheus + networks: + webnet: + aliases: + - "prometheus" + ports: + - "10007:9090" + depends_on: + - open_im_server + + grafana: + image: grafana/grafana + volumes: + - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json + - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml + - ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml + container_name: grafana + networks: + webnet: + aliases: + - "grafana" + ports: + - "10008:3000" + depends_on: + - prometheus \ No newline at end of file diff --git a/docker-compose_cfg/datasource-compose.yaml b/docker-compose_cfg/datasource-compose.yaml new file mode 100644 index 000000000..3738b74d8 --- /dev/null +++ b/docker-compose_cfg/datasource-compose.yaml @@ -0,0 +1,13 @@ +#more datasource-compose.yaml +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + access: proxy + orgId: 1 + url: http://127.0.0.1:10007 + basicAuth: false + isDefault: true + version: 1 + editable: true \ No newline at end of file diff --git a/docker-compose_cfg/prometheus-compose.yml b/docker-compose_cfg/prometheus-compose.yml new file mode 100644 index 000000000..d61add2fb --- /dev/null +++ b/docker-compose_cfg/prometheus-compose.yml @@ -0,0 +1,13 @@ +#more prometheus-compose.yml +global: + scrape_interval: 15s + evaluation_interval: 15s + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:10007'] + - job_name: 'openIM-server' + static_configs: + - targets: ['localhost:10006/cms/prometheus/'] + \ No newline at end of file From b1f1ec5fbb7d36d9567ecdf39b0628cb502ef429 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 01:31:00 +0800 Subject: [PATCH 11/31] prome --- docker-compose.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 4f0c5bd65..576456d37 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -142,10 +142,6 @@ services: volumes: - ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml container_name: prometheus - networks: - webnet: - aliases: - - "prometheus" ports: - "10007:9090" depends_on: @@ -158,10 +154,6 @@ services: - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml - ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml container_name: grafana - networks: - webnet: - aliases: - - "grafana" ports: - "10008:3000" depends_on: From c80b4c1d32f24998c797256ac816eacf0539e079 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 01:46:30 +0800 Subject: [PATCH 12/31] prome --- docker-compose.yaml | 12 +++++++----- docker-compose_cfg/prometheus-compose.yml | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 576456d37..1fc8279aa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -140,21 +140,23 @@ services: prometheus: image: prom/prometheus volumes: - - ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml + - ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml + - ./components/prometheus_data:/prometheus container_name: prometheus ports: - - "10007:9090" + - 10007:9090 depends_on: - open_im_server grafana: image: grafana/grafana volumes: - - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json - - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml + # - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json + # - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml - ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml + - ./components/grafana_data:/var/lib/grafana container_name: grafana ports: - - "10008:3000" + - 10008:3000 depends_on: - prometheus \ No newline at end of file diff --git a/docker-compose_cfg/prometheus-compose.yml b/docker-compose_cfg/prometheus-compose.yml index d61add2fb..c8bd84763 100644 --- a/docker-compose_cfg/prometheus-compose.yml +++ b/docker-compose_cfg/prometheus-compose.yml @@ -8,6 +8,7 @@ scrape_configs: static_configs: - targets: ['localhost:10007'] - job_name: 'openIM-server' + metrics_path: /cms/prometheus/metrics static_configs: - - targets: ['localhost:10006/cms/prometheus/'] + - targets: ['localhost:10006'] \ No newline at end of file From 783a4d33b4a0a7739bae340aa302989dcd6df655 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 01:54:19 +0800 Subject: [PATCH 13/31] prome --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1fc8279aa..5ee18a5d6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -141,7 +141,7 @@ services: image: prom/prometheus volumes: - ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml - - ./components/prometheus_data:/prometheus + # - ./components/prometheus_data:/prometheus container_name: prometheus ports: - 10007:9090 @@ -154,7 +154,7 @@ services: # - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json # - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml - ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml - - ./components/grafana_data:/var/lib/grafana + # - ./components/grafana_data:/var/lib/grafana container_name: grafana ports: - 10008:3000 From db38a64a3081c61481fb6e54961dfc22509652e4 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 02:08:14 +0800 Subject: [PATCH 14/31] prome --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 5ee18a5d6..73cbf32f6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -157,6 +157,6 @@ services: # - ./components/grafana_data:/var/lib/grafana container_name: grafana ports: - - 10008:3000 + - 40003:3000 depends_on: - prometheus \ No newline at end of file From 947609a3b3f5e4c6fb14507bbe9cf916d6f5074d Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 02:08:41 +0800 Subject: [PATCH 15/31] prome --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 73cbf32f6..5ee18a5d6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -157,6 +157,6 @@ services: # - ./components/grafana_data:/var/lib/grafana container_name: grafana ports: - - 40003:3000 + - 10008:3000 depends_on: - prometheus \ No newline at end of file From 602ac1ffb868b9ae758086b022a5a8c300549dff Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 02:15:21 +0800 Subject: [PATCH 16/31] prome --- internal/cms_api/router.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cms_api/router.go b/internal/cms_api/router.go index c5ff5aab2..de4ebbd75 100644 --- a/internal/cms_api/router.go +++ b/internal/cms_api/router.go @@ -18,6 +18,10 @@ func NewGinRouter() *gin.Engine { baseRouter := gin.Default() router := baseRouter.Group("/cms") router.Use(middleware.CorsHandler()) + prometheusRouterGroup := router.Group("/prometheus") + { + prometheusRouterGroup.GET("/metrics", prometheusHandler()) + } adminRouterGroup := router.Group("/admin") { adminRouterGroup.POST("/login", admin.AdminLogin) @@ -69,9 +73,5 @@ func NewGinRouter() *gin.Engine { friendCMSRouterGroup.POST("/get_friends", friend.GetUserFriends) } - prometheusRouterGroup := r2.Group("/prometheus") - { - prometheusRouterGroup.GET("/metrics", prometheusHandler()) - } return baseRouter } From 26c65d0da8cbdc872c39c962fecd3e0b6c938c72 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 02:19:23 +0800 Subject: [PATCH 17/31] prome --- docker-compose.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 5ee18a5d6..ebfe62e9f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -147,6 +147,7 @@ services: - 10007:9090 depends_on: - open_im_server + network_mode: "host" grafana: image: grafana/grafana @@ -159,4 +160,5 @@ services: ports: - 10008:3000 depends_on: - - prometheus \ No newline at end of file + - prometheus + network_mode: "host" \ No newline at end of file From 9cc08251851b243b8fd1898e4261bd0d28bc748a Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 8 Sep 2022 02:32:59 +0800 Subject: [PATCH 18/31] prome --- docker-compose.yaml | 4 +- docker-compose_cfg/grafana.ini | 1285 ++++++++++++++++++++++++++++++++ 2 files changed, 1287 insertions(+), 2 deletions(-) create mode 100644 docker-compose_cfg/grafana.ini diff --git a/docker-compose.yaml b/docker-compose.yaml index ebfe62e9f..506f77c34 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -147,7 +147,6 @@ services: - 10007:9090 depends_on: - open_im_server - network_mode: "host" grafana: image: grafana/grafana @@ -155,10 +154,11 @@ services: # - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json # - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml - ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml + - ./docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini # - ./components/grafana_data:/var/lib/grafana container_name: grafana ports: - - 10008:3000 + - 10008:10008 depends_on: - prometheus network_mode: "host" \ No newline at end of file diff --git a/docker-compose_cfg/grafana.ini b/docker-compose_cfg/grafana.ini new file mode 100644 index 000000000..fd4892050 --- /dev/null +++ b/docker-compose_cfg/grafana.ini @@ -0,0 +1,1285 @@ +##################### Grafana Configuration Defaults ##################### +# +# Do not modify this file in grafana installs +# + +# possible values : production, development +app_mode = production + +# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty +instance_name = ${HOSTNAME} + +# force migration will run migrations that might cause dataloss +force_migration = false + +#################################### Paths ############################### +[paths] +# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) +data = data + +# Temporary files in `data` directory older than given duration will be removed +temp_data_lifetime = 24h + +# Directory where grafana can store logs +logs = data/log + +# Directory where grafana will automatically scan and look for plugins +plugins = data/plugins + +# folder that contains provisioning config files that grafana will apply on startup and while running. +provisioning = conf/provisioning + +#################################### Server ############################## +[server] +# Protocol (http, https, h2, socket) +protocol = http + +# The ip address to bind to, empty will bind to all interfaces +http_addr = + +# The http port to use +http_port = 10008 + +# The public facing domain name used to access grafana from a browser +domain = localhost + +# Redirect to correct domain if host header does not match domain +# Prevents DNS rebinding attacks +enforce_domain = false + +# The full public facing url +root_url = %(protocol)s://%(domain)s:%(http_port)s/ + +# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. +serve_from_sub_path = false + +# Log web requests +router_logging = false + +# the path relative working path +static_root_path = public + +# enable gzip +enable_gzip = false + +# https certs & key file +cert_file = +cert_key = + +# Unix socket path +socket = /tmp/grafana.sock + +# CDN Url +cdn_url = + +# Sets the maximum time in minutes before timing out read of an incoming request and closing idle connections. +# `0` means there is no timeout for reading the request. +read_timeout = 0 + +#################################### Database ############################ +[database] +# You can configure the database connection by specifying type, host, name, user and password +# as separate properties or as on string using the url property. + +# Either "mysql", "postgres" or "sqlite3", it's your choice +type = sqlite3 +host = 127.0.0.1:3306 +name = grafana +user = root +# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" +password = +# Use either URL or the previous fields to configure the database +# Example: mysql://user:secret@host:port/database +url = + +# Max idle conn setting default is 2 +max_idle_conn = 2 + +# Max conn setting default is 0 (mean not set) +max_open_conn = + +# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) +conn_max_lifetime = 14400 + +# Set to true to log the sql calls and execution times. +log_queries = + +# For "postgres", use either "disable", "require" or "verify-full" +# For "mysql", use either "true", "false", or "skip-verify". +ssl_mode = disable + +# Database drivers may support different transaction isolation levels. +# Currently, only "mysql" driver supports isolation levels. +# If the value is empty - driver's default isolation level is applied. +# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE". +isolation_level = + +ca_cert_path = +client_key_path = +client_cert_path = +server_cert_name = + +# For "sqlite3" only, path relative to data_path setting +path = grafana.db + +# For "sqlite3" only. cache mode setting used for connecting to the database +cache_mode = private + +# For "mysql" only if migrationLocking feature toggle is set. How many seconds to wait before failing to lock the database for the migrations, default is 0. +locking_attempt_timeout_sec = 0 + +#################################### Cache server ############################# +[remote_cache] +# Either "redis", "memcached" or "database" default is "database" +type = database + +# cache connectionstring options +# database: will use Grafana primary database. +# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. +# memcache: 127.0.0.1:11211 +connstr = + +#################################### Data proxy ########################### +[dataproxy] + +# This enables data proxy logging, default is false +logging = false + +# How long the data proxy waits to read the headers of the response before timing out, default is 30 seconds. +# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set. +timeout = 30 + +# How long the data proxy waits to establish a TCP connection before timing out, default is 10 seconds. +dialTimeout = 10 + +# How many seconds the data proxy waits before sending a keepalive request. +keep_alive_seconds = 30 + +# How many seconds the data proxy waits for a successful TLS Handshake before timing out. +tls_handshake_timeout_seconds = 10 + +# How many seconds the data proxy will wait for a server's first response headers after +# fully writing the request headers if the request has an "Expect: 100-continue" +# header. A value of 0 will result in the body being sent immediately, without +# waiting for the server to approve. +expect_continue_timeout_seconds = 1 + +# Optionally limits the total number of connections per host, including connections in the dialing, +# active, and idle states. On limit violation, dials will block. +# A value of zero (0) means no limit. +max_conns_per_host = 0 + +# The maximum number of idle connections that Grafana will keep alive. +max_idle_connections = 100 + +# How many seconds the data proxy keeps an idle connection open before timing out. +idle_conn_timeout_seconds = 90 + +# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request. +send_user_header = false + +# Limit the amount of bytes that will be read/accepted from responses of outgoing HTTP requests. +response_limit = 0 + +# Limits the number of rows that Grafana will process from SQL data sources. +row_limit = 1000000 + +#################################### Analytics ########################### +[analytics] +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. +# No ip addresses are being tracked, only simple counters to track +# running instances, dashboard and error counts. It is very helpful to us. +# Change this option to false to disable reporting. +reporting_enabled = true + +# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs +reporting_distributor = grafana-labs + +# Set to false to disable all checks to https://grafana.com +# for new versions of grafana. The check is used +# in some UI views to notify that a grafana update exists. +# This option does not cause any auto updates, nor send any information +# only a GET request to https://raw.githubusercontent.com/grafana/grafana/main/latest.json to get the latest version. +check_for_updates = true + +# Set to false to disable all checks to https://grafana.com +# for new versions of plugins. The check is used +# in some UI views to notify that a plugin update exists. +# This option does not cause any auto updates, nor send any information +# only a GET request to https://grafana.com to get the latest versions. +check_for_plugin_updates = true + +# Google Analytics universal tracking code, only enabled if you specify an id here +google_analytics_ua_id = + +# Google Tag Manager ID, only enabled if you specify an id here +google_tag_manager_id = + +# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set +rudderstack_write_key = + +# Rudderstack data plane url, enabled only if rudderstack_write_key is also set +rudderstack_data_plane_url = + +# Rudderstack SDK url, optional, only valid if rudderstack_write_key and rudderstack_data_plane_url is also set +rudderstack_sdk_url = + +# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config +rudderstack_config_url = + +# Application Insights connection string. Specify an URL string to enable this feature. +application_insights_connection_string = + +# Optional. Specifies an Application Insights endpoint URL where the endpoint string is wrapped in backticks ``. +application_insights_endpoint_url = + +# Controls if the UI contains any links to user feedback forms +feedback_links_enabled = true + +#################################### Security ############################ +[security] +# disable creation of admin user on first start of grafana +disable_initial_admin_creation = false + +# default admin user, created on startup +admin_user = admin + +# default admin password, can be changed before first start of grafana, or in profile settings +admin_password = admin + +# default admin email, created on startup +admin_email = admin@localhost + +# used for signing +secret_key = SW2YcwTIb9zpOOhoPsMm + +# current key provider used for envelope encryption, default to static value specified by secret_key +encryption_provider = secretKey.v1 + +# list of configured key providers, space separated (Enterprise only): e.g., awskms.v1 azurekv.v1 +available_encryption_providers = + +# disable gravatar profile images +disable_gravatar = false + +# data source proxy whitelist (ip_or_domain:port separated by spaces) +data_source_proxy_whitelist = + +# disable protection against brute force login attempts +disable_brute_force_login_protection = false + +# set to true if you host Grafana behind HTTPS. default is false. +cookie_secure = false + +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" +cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,