dev/extending-sdk-with-missing-grpc-functions #8

Merged
SoXX merged 5 commits from dev/extending-sdk-with-missing-grpc-functions into main 2024-09-04 12:57:14 +00:00
Showing only changes of commit 2c8d6bd682 - Show all commits

View File

@ -160,8 +160,14 @@ func (s *server) GetUserMessages(ctx context.Context, message *gRPC.GetMessagesR
ctx, span := tracer.Start(ctx, "GetUserMessages")
defer span.End()
sourceID := models.UserSourceID(message.UserSourceId)
userSource := models.UserSource{BaseModel: models.BaseModel[models.UserSourceID]{ID: sourceID}}
userSourceID := models.UserSourceID(message.UserSourceId)
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)
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
}