mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 11:22:10 +08:00 
			
		
		
		
	Merge branch 'main' of github.com:openimsdk/open-im-server into fix/batch-insert-group-member
This commit is contained in:
		
						commit
						a89a57ebbd
					
				@ -11,11 +11,20 @@ templates:
 | 
				
			|||||||
  - /etc/alertmanager/email.tmpl
 | 
					  - /etc/alertmanager/email.tmpl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
route:
 | 
					route:
 | 
				
			||||||
  group_by: ['alertname']
 | 
					  group_by: [ 'alertname' ]
 | 
				
			||||||
  group_wait: 5s
 | 
					  group_wait: 5s
 | 
				
			||||||
  group_interval: 5s
 | 
					  group_interval: 5s
 | 
				
			||||||
  repeat_interval: 5m
 | 
					  repeat_interval: 5m
 | 
				
			||||||
  receiver: email
 | 
					  receiver: email
 | 
				
			||||||
 | 
					  routes:
 | 
				
			||||||
 | 
					    - matchers:
 | 
				
			||||||
 | 
					        - alertname = "XXX"
 | 
				
			||||||
 | 
					      group_by: [ 'instance' ]
 | 
				
			||||||
 | 
					      group_wait: 5s
 | 
				
			||||||
 | 
					      group_interval: 5s
 | 
				
			||||||
 | 
					      repeat_interval: 5m
 | 
				
			||||||
 | 
					      receiver: email
 | 
				
			||||||
 | 
					
 | 
				
			||||||
receivers:
 | 
					receivers:
 | 
				
			||||||
  - name: email
 | 
					  - name: email
 | 
				
			||||||
    email_configs:
 | 
					    email_configs:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5356
									
								
								config/grafana-template/Demo.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5356
									
								
								config/grafana-template/Demo.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -20,3 +20,25 @@ groups:
 | 
				
			|||||||
        annotations:
 | 
					        annotations:
 | 
				
			||||||
          summary: "Increase in MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter detected"
 | 
					          summary: "Increase in MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter detected"
 | 
				
			||||||
          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."
 | 
					          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."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: registrations_few
 | 
				
			||||||
 | 
					    rules:
 | 
				
			||||||
 | 
					      - alert: RegistrationsFew
 | 
				
			||||||
 | 
					        expr: increase(user_login_total[1h]) == 0
 | 
				
			||||||
 | 
					        for: 1m
 | 
				
			||||||
 | 
					        labels:
 | 
				
			||||||
 | 
					          severity: info
 | 
				
			||||||
 | 
					        annotations:
 | 
				
			||||||
 | 
					          summary: "Too few registrations within the time frame"
 | 
				
			||||||
 | 
					          description: "The number of registrations in the last hour is 0. There might be some issues."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - name: messages_few
 | 
				
			||||||
 | 
					    rules:
 | 
				
			||||||
 | 
					      - alert: MessagesFew
 | 
				
			||||||
 | 
					        expr: (increase(single_chat_msg_process_success_total[1h])+increase(group_chat_msg_process_success_total[1h])) == 0
 | 
				
			||||||
 | 
					        for: 1m
 | 
				
			||||||
 | 
					        labels:
 | 
				
			||||||
 | 
					          severity: info
 | 
				
			||||||
 | 
					        annotations:
 | 
				
			||||||
 | 
					          summary: "Too few messages within the time frame"
 | 
				
			||||||
 | 
					          description: "The number of messages sent in the last hour is 0. There might be some issues."
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,7 @@ import (
 | 
				
			|||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/internal/rpc/friend"
 | 
						"github.com/openimsdk/open-im-server/v3/internal/rpc/friend"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/config"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/config"
 | 
				
			||||||
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo"
 | 
				
			||||||
@ -310,6 +311,8 @@ func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterR
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						prommetrics.UserRegisterCounter.Add(float64(len(users)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s.webhookAfterUserRegister(ctx, &s.config.WebhooksConfig.AfterUserRegister, req)
 | 
						s.webhookAfterUserRegister(ctx, &s.config.WebhooksConfig.AfterUserRegister, req)
 | 
				
			||||||
	return resp, nil
 | 
						return resp, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								pkg/common/prommetrics/grpc_user.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								pkg/common/prommetrics/grpc_user.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					package prommetrics
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "github.com/prometheus/client_golang/prometheus"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var (
 | 
				
			||||||
 | 
						UserRegisterCounter = prometheus.NewCounter(prometheus.CounterOpts{
 | 
				
			||||||
 | 
							Name: "user_register_total",
 | 
				
			||||||
 | 
							Help: "The number of user login",
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
@ -52,6 +52,8 @@ func GetGrpcCusMetrics(registerName string, share *config.Share) []prometheus.Co
 | 
				
			|||||||
		return []prometheus.Collector{MsgOfflinePushFailedCounter}
 | 
							return []prometheus.Collector{MsgOfflinePushFailedCounter}
 | 
				
			||||||
	case share.RpcRegisterName.Auth:
 | 
						case share.RpcRegisterName.Auth:
 | 
				
			||||||
		return []prometheus.Collector{UserLoginCounter}
 | 
							return []prometheus.Collector{UserLoginCounter}
 | 
				
			||||||
 | 
						case share.RpcRegisterName.User:
 | 
				
			||||||
 | 
							return []prometheus.Collector{UserRegisterCounter}
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user