mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 00:55:59 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
# Conflicts: # internal/msgtransfer/init.go # internal/msgtransfer/online_history_msg_handler.go # internal/msgtransfer/online_msg_to_mongo_handler.go # pkg/common/db/controller/msg.go # pkg/proto/msg/msg.pb.go # pkg/proto/msg/msg.proto
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
||||
sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/jinzhu/copier"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
|
||||
|
||||
@@ -3,6 +3,7 @@ package kafka
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
log "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
prome "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
|
||||
)
|
||||
@@ -66,7 +67,7 @@ func GetContextWithMQHeader(header []*sarama.RecordHeader) context.Context {
|
||||
return mcontext.WithMustInfoCtx(values) // TODO
|
||||
}
|
||||
func (p *Producer) SendMessage(ctx context.Context, key string, m proto.Message) (int32, int64, error) {
|
||||
log.ZDebug(ctx, "SendMessage", "key ", key, "msg", m.String())
|
||||
log.ZDebug(ctx, "SendMessage", "key ", key, "msg", m)
|
||||
kMsg := &sarama.ProducerMessage{}
|
||||
kMsg.Topic = p.topic
|
||||
kMsg.Key = sarama.StringEncoder(key)
|
||||
|
||||
@@ -59,6 +59,10 @@ var (
|
||||
GrpcRequestFailedCounter prometheus.Counter
|
||||
|
||||
SendMsgCounter prometheus.Counter
|
||||
|
||||
// conversation
|
||||
ConversationCreateSuccessCounter prometheus.Counter
|
||||
ConversationCreateFailedCounter prometheus.Counter
|
||||
)
|
||||
|
||||
func NewUserLoginCounter() {
|
||||
@@ -424,3 +428,23 @@ func NewMsgOfflinePushFailedCounter() {
|
||||
Help: "The number of msg failed offline pushed",
|
||||
})
|
||||
}
|
||||
|
||||
func NewConversationCreateSuccessCounter() {
|
||||
if ConversationCreateSuccessCounter != nil {
|
||||
return
|
||||
}
|
||||
ConversationCreateSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "conversation_push_success",
|
||||
Help: "The number of conversation successful pushed",
|
||||
})
|
||||
}
|
||||
|
||||
func NewConversationCreateFailedCounter() {
|
||||
if ConversationCreateFailedCounter != nil {
|
||||
return
|
||||
}
|
||||
ConversationCreateFailedCounter = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "conversation_push_failed",
|
||||
Help: "The number of conversation failed pushed",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user