diff --git a/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/dao/mongotemplate/TurboSummaryDao.kt b/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/dao/mongotemplate/TurboSummaryDao.kt index 23c6b25c..bba6d030 100644 --- a/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/dao/mongotemplate/TurboSummaryDao.kt +++ b/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/dao/mongotemplate/TurboSummaryDao.kt @@ -5,6 +5,7 @@ import com.tencent.devops.turbo.model.TTurboDaySummaryEntity import com.tencent.devops.turbo.pojo.TurboDaySummaryOverviewModel import org.bson.Document import org.springframework.beans.factory.annotation.Autowired +import org.springframework.data.domain.Sort import org.springframework.data.mongodb.core.FindAndModifyOptions import org.springframework.data.mongodb.core.MongoTemplate import org.springframework.data.mongodb.core.aggregation.Aggregation @@ -144,8 +145,9 @@ class TurboSummaryDao @Autowired constructor( val skip = Aggregation.skip((pageNum * pageSize).toLong()) val limit = Aggregation.limit(pageSize.toLong()) + val sort = Aggregation.sort(Sort.Direction.ASC, "_id") - val aggregation = Aggregation.newAggregation(match, group, skip, limit) + val aggregation = Aggregation.newAggregation(match, group, sort, skip, limit) val queryResults: AggregationResults = mongoTemplate.aggregate(aggregation, "t_turbo_day_summary_entity", TurboDaySummaryOverviewModel::class.java) return queryResults.mappedResults diff --git a/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/job/BkMetricsDailyJob.kt b/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/job/BkMetricsDailyJob.kt index 7513c099..b811e177 100644 --- a/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/job/BkMetricsDailyJob.kt +++ b/src/backend/turbo/biz-turbo/src/main/kotlin/com/tencent/devops/turbo/job/BkMetricsDailyJob.kt @@ -85,13 +85,6 @@ class BkMetricsDailyJob @Autowired constructor( turboSaveTime = saveTime ) - bkMetricsRabbitTemplate.convertAndSend(EXCHANGE_METRICS_STATISTIC_TURBO_DAILY, "", - JsonUtil.toJson(bkMetricsMessage)) { message: Message -> - val messageProperties = message.messageProperties - messageProperties.setHeader("contentType", "application/json") - messageProperties.setHeader("contentEncoding", "UTF-8") - messageProperties.deliveryMode = MessageDeliveryMode.PERSISTENT - message - } + bkMetricsRabbitTemplate.convertAndSend(EXCHANGE_METRICS_STATISTIC_TURBO_DAILY, "", bkMetricsMessage) } } diff --git a/src/backend/turbo/common-turbo/common-turbo-util/src/main/kotlin/com/tencent/devops/common/util/constants/TurboMQ.kt b/src/backend/turbo/common-turbo/common-turbo-util/src/main/kotlin/com/tencent/devops/common/util/constants/TurboMQ.kt index 1114f983..6ab476fa 100644 --- a/src/backend/turbo/common-turbo/common-turbo-util/src/main/kotlin/com/tencent/devops/common/util/constants/TurboMQ.kt +++ b/src/backend/turbo/common-turbo/common-turbo-util/src/main/kotlin/com/tencent/devops/common/util/constants/TurboMQ.kt @@ -12,7 +12,7 @@ const val ROUTE_TURBO_PLUGIN_DATA = "route.turbo.plugin.data.new" /** * 蓝盾度量数据上报 */ -const val EXCHANGE_METRICS_STATISTIC_TURBO_DAILY = "e.metrics.statistic.turbo.daily" +const val EXCHANGE_METRICS_STATISTIC_TURBO_DAILY = "metrics.statistic.turbo.daily" /** * 蓝盾项目停用广播通知