Skip to content

Commit 60fdfb5

Browse files
kidkidkidCoda-bot
andcommitted
feat: [Coda] enhance spans.go with complete annotation integration from commercial version
(LogID: 202509101633310100911112096963473) Co-Authored-By: Coda <coda@bytedance.com>
1 parent 1b491a9 commit 60fdfb5

File tree

2 files changed

+358
-140
lines changed

2 files changed

+358
-140
lines changed

backend/modules/observability/infra/repo/ck/annotation.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,19 @@ func (a *AnnotationCkDaoImpl) buildSingleSql(ctx context.Context, db *gorm.DB, t
185185
{Column: clause.Column{Name: "updated_at"}, Desc: true},
186186
}})
187187
}
188+
// 添加软删除过滤
189+
sqlQuery = sqlQuery.Where("deleted_at = 0")
190+
191+
// 添加分区优化查询
192+
if param.StartTime > 0 && param.EndTime > 0 {
193+
partitions := convertIntoPartitions(param.StartTime, param.EndTime)
194+
sqlQuery = sqlQuery.
195+
Where("start_date >= ?", partitions[0]).
196+
Where("start_date <= ?", partitions[len(partitions)-1])
197+
}
198+
188199
if param.Limit > 0 {
189200
sqlQuery = sqlQuery.Limit(int(param.Limit))
190201
}
191202
return sqlQuery, nil
192-
}
203+
}

0 commit comments

Comments
 (0)