chore(tracing): Rename "tag_count" to "tag_aliases_count"

This commit is contained in:
SoXX 2024-08-12 10:07:29 +02:00
parent ca1e1a1da5
commit 098ecda869

View File

@ -69,10 +69,10 @@ func CreateTagAliasInBatch(ctx context.Context, tagsAliases []models.TagAlias, b
span.SetAttributes(
attribute.Int64("batch_size", int64(batchSize)),
attribute.Int64("tag_count", int64(len(tagsAliases))),
attribute.Int64("tag_aliases_count", int64(len(tagsAliases))),
)
span.AddEvent("Starting batch tag creation")
span.AddEvent("Starting batch tag alias creation")
if client == nil {
return utils.HandleError(ctx, span, logger, nil, &otterError.Database{Reason: otterError.DatabaseIsNotConnected})
@ -87,26 +87,26 @@ func CreateTagAliasInBatch(ctx context.Context, tagsAliases []models.TagAlias, b
}
logger.WithContext(ctx).WithFields(log.Fields{
"tag_alias_length": len(tagsAliases),
"tag_aliases_count": len(tagsAliases),
}).Debug("attempting to create tags aliases")
result := client.WithContext(ctx).CreateInBatches(&tagsAliases, batchSize)
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrDuplicatedKey) {
loggerFields := log.Fields{
"tag_alias_length": len(tagsAliases),
"tag_aliases_count": len(tagsAliases),
}
return utils.HandleError(ctx, span, logger, loggerFields, &otterError.Database{Reason: otterError.DuplicateKey})
}
loggerFields := log.Fields{
"tag_alias_length": len(tagsAliases),
"tag_aliases_count": len(tagsAliases),
}
return utils.HandleError(ctx, span, logger, loggerFields, result.Error)
}
logger.WithContext(ctx).WithFields(log.Fields{
"tag_alias_length": len(tagsAliases),
"tag_aliases_count": len(tagsAliases),
}).Debug("batch tags aliases created")
span.AddEvent("Batch tags aliases created successfully")