fix(grpc): get necessary information
getting data from database for the userSource
This commit is contained in:
parent
601ce9eae7
commit
2c8d6bd682
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user