fix(grpc): get necessary information
All checks were successful
Gitea Build Check / Build (push) Successful in 51s
Gitea Build Check / Build (pull_request) Successful in 53s

getting data from database for the userSource
This commit is contained in:
SoXX 2024-09-04 14:17:00 +02:00
parent 601ce9eae7
commit 2c8d6bd682

View File

@ -160,8 +160,14 @@ func (s *server) GetUserMessages(ctx context.Context, message *gRPC.GetMessagesR
ctx, span := tracer.Start(ctx, "GetUserMessages") ctx, span := tracer.Start(ctx, "GetUserMessages")
defer span.End() defer span.End()
sourceID := models.UserSourceID(message.UserSourceId) userSourceID := models.UserSourceID(message.UserSourceId)
userSource := models.UserSource{BaseModel: models.BaseModel[models.UserSourceID]{ID: sourceID}}
userSource, err := database.GetUserSourceByID(ctx, userSourceID)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return nil, err
}
messages, err := s.getMessageExecution(ctx, userSource) messages, err := s.getMessageExecution(ctx, userSource)
if err != nil { if err != nil {
@ -180,6 +186,12 @@ func (s *server) GetUserMessages(ctx context.Context, message *gRPC.GetMessagesR
}) })
} }
span.SetAttributes(
attribute.String("user_source_id", string(userSource.ID)),
attribute.String("user_id", string(userSource.UserID)),
attribute.String("source_id", string(userSource.SourceID)),
)
return &response, err return &response, err
} }