SDK v3 #8

Merged
SoXX merged 77 commits from dev/issue-5 into main 2024-08-14 13:27:35 +00:00
Showing only changes of commit 3fadaac69a - Show all commits

View File

@ -16,14 +16,6 @@ func CreateUserSource(ctx context.Context, userSource models.UserSource) (models
ctx, span, localLogger := utils.SetupTracing(ctx, tracer, "CreateUserSource")
defer span.End()
localLogger = localLogger.WithFields(log.Fields{
"user_source_id": userSource.ID,
})
span.SetAttributes(
attribute.String("user_source_id", string(userSource.SourceID)),
)
utils.HandleEvent(span, localLogger, "Starting user source creation")
if client == nil {
@ -38,10 +30,25 @@ func CreateUserSource(ctx context.Context, userSource models.UserSource) (models
return models.UserSource{}, utils.HandleError(ctx, span, localLogger, result.Error)
}
localLogger = localLogger.WithFields(log.Fields{
"user_source_id": userSource.ID,
})
span.SetAttributes(
attribute.String("user_source_id", string(userSource.SourceID)),
)
utils.HandleEvent(span, localLogger, "User source created successfully")
return userSource, nil
}
// UpdateUserSource updates the user source information in the database.
// Only a few parameter can be updated:
// - AccountID
// - ScrapeTimeInterval
// - AccountUsername
// - LastScrapeTime
// - AccountValidate
func UpdateUserSource(ctx context.Context, userSource models.UserSource) error {
ctx, span, localLogger := utils.SetupTracing(ctx, tracer, "UpdateUserSource")
defer span.End()