From c0e55e735bdcae96ca027b437f8a11d09b91c6dc Mon Sep 17 00:00:00 2001 From: greysonfang Date: Wed, 11 Sep 2024 12:00:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat=EF=BC=9A=E6=B4=BB=E8=B7=83=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=AE=B0=E5=BD=95=E6=93=8D=E4=BD=9C=E5=92=8C=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=20#10891?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/event/dispatcher/pipeline/mq/MQ.kt | 2 +- .../pojo/measure/ProjectUserDailyEvent.kt | 2 +- .../measure/ProjectUserOperateMetricsEvent.kt | 2 +- .../config/MetricsListenerConfiguration.kt | 28 +++++++++++++------ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt index e602baff8e6..f47b0b25fc0 100644 --- a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt +++ b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt @@ -326,8 +326,8 @@ object MQ { const val EXCHANGE_PROJECT_USER_DAILY_FANOUT = "e.metrics.project.user.daily.exchange.fanout" const val QUEUE_PROJECT_USER_DAILY_METRICS = "q.metrics.project.user.daily.queue" - const val ROUTE_PROJECT_USER_DAILY_METRICS = "r.metrics.project.user.daily" + const val EXCHANGE_PROJECT_USER_DAILY_OPERATE = "e.metrics.project.user.daily.operate.exchange" const val QUEUE_PROJECT_USER_DAILY_OPERATE_METRICS = "q.metrics.project.user.daily.operate.queue" const val ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS = "r.metrics.project.user.daily.operate" diff --git a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserDailyEvent.kt b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserDailyEvent.kt index 25a72bc46c3..43fa018fd9a 100644 --- a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserDailyEvent.kt +++ b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserDailyEvent.kt @@ -33,7 +33,7 @@ import com.tencent.devops.common.event.dispatcher.pipeline.mq.MQ import io.swagger.v3.oas.annotations.media.Schema import java.time.LocalDate -@Event(exchange = MQ.EXCHANGE_PROJECT_USER_DAILY_FANOUT, routeKey = MQ.ROUTE_PROJECT_USER_DAILY_METRICS) +@Event(exchange = MQ.EXCHANGE_PROJECT_USER_DAILY_FANOUT) data class ProjectUserDailyEvent( @get:Schema(title = "项目ID") override val projectId: String, diff --git a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserOperateMetricsEvent.kt b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserOperateMetricsEvent.kt index 894a37fb3eb..778f9b6e184 100644 --- a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserOperateMetricsEvent.kt +++ b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/pojo/measure/ProjectUserOperateMetricsEvent.kt @@ -32,7 +32,7 @@ import com.tencent.devops.common.event.annotation.Event import com.tencent.devops.common.event.dispatcher.pipeline.mq.MQ import io.swagger.v3.oas.annotations.media.Schema -@Event(exchange = MQ.EXCHANGE_PROJECT_USER_DAILY_FANOUT, routeKey = MQ.ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS) +@Event(exchange = MQ.EXCHANGE_PROJECT_USER_DAILY_OPERATE, routeKey = MQ.ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS) data class ProjectUserOperateMetricsEvent( @get:Schema(title = "项目用户操作度量数据") val userOperateCounterData: UserOperateCounterData diff --git a/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/config/MetricsListenerConfiguration.kt b/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/config/MetricsListenerConfiguration.kt index e85fbb27727..bad4813c6b3 100644 --- a/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/config/MetricsListenerConfiguration.kt +++ b/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/config/MetricsListenerConfiguration.kt @@ -100,13 +100,13 @@ class MetricsListenerConfiguration { } /** - * 用户审计数据上报交换机 + * 插件监控数据上报广播交换机 */ @Bean - fun projectUserDailyMetricsExchange(): DirectExchange { - val directExchange = DirectExchange(MQ.EXCHANGE_PROJECT_USER_DAILY_FANOUT, true, false) - directExchange.isDelayed = true - return directExchange + fun projectUserDailyMetricsFanoutExchange(): FanoutExchange { + val fanoutExchange = FanoutExchange(MQ.EXCHANGE_PROJECT_USER_DAILY_FANOUT, true, false) + fanoutExchange.isDelayed = true + return fanoutExchange } @Bean @@ -115,10 +115,10 @@ class MetricsListenerConfiguration { @Bean fun projectUserDailyMetricsQueueBind( @Autowired projectUserDailyMetricsQueue: Queue, - @Autowired projectUserDailyMetricsExchange: DirectExchange + @Autowired projectUserDailyMetricsFanoutExchange: FanoutExchange ): Binding { return BindingBuilder.bind(projectUserDailyMetricsQueue) - .to(projectUserDailyMetricsExchange).with(MQ.ROUTE_PROJECT_USER_DAILY_METRICS) + .to(projectUserDailyMetricsFanoutExchange) } @Bean @@ -142,16 +142,26 @@ class MetricsListenerConfiguration { ) } + /** + * 用户操作度量数据上报交换机 + */ + @Bean + fun projectUserDailyOperateMetricsExchange(): DirectExchange { + val directExchange = DirectExchange(MQ.EXCHANGE_PROJECT_USER_DAILY_OPERATE, true, false) + directExchange.isDelayed = true + return directExchange + } + @Bean fun projectUserDailyOperateMetricsQueue() = Queue(QUEUE_PROJECT_USER_DAILY_OPERATE_METRICS) @Bean fun projectUserDailyOperateMetricsQueueBind( @Autowired projectUserDailyOperateMetricsQueue: Queue, - @Autowired projectUserDailyMetricsExchange: DirectExchange + @Autowired projectUserDailyOperateMetricsExchange: DirectExchange ): Binding { return BindingBuilder.bind(projectUserDailyOperateMetricsQueue) - .to(projectUserDailyMetricsExchange).with(MQ.ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS) + .to(projectUserDailyOperateMetricsExchange).with(MQ.ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS) } @Bean From 903b9d6bee0df9d6bbe57ba27e0405d3ffa42b20 Mon Sep 17 00:00:00 2001 From: greysonfang Date: Wed, 11 Sep 2024 14:41:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat=EF=BC=9A=E6=B4=BB=E8=B7=83=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=AE=B0=E5=BD=95=E6=93=8D=E4=BD=9C=E5=92=8C=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=20#10891?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt index f47b0b25fc0..a957a4b089e 100644 --- a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt +++ b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt @@ -324,7 +324,7 @@ object MQ { const val ROUTE_AUTH_RESOURCE_GROUP_MODIFY = "r.auth.resource.group.modify" const val QUEUE_AUTH_RESOURCE_GROUP_MODIFY = "q.auth.resource.group.modify" - const val EXCHANGE_PROJECT_USER_DAILY_FANOUT = "e.metrics.project.user.daily.exchange.fanout" + const val EXCHANGE_PROJECT_USER_DAILY_FANOUT = "e.metrics.project.user.daily.fanout" const val QUEUE_PROJECT_USER_DAILY_METRICS = "q.metrics.project.user.daily.queue" const val EXCHANGE_PROJECT_USER_DAILY_OPERATE = "e.metrics.project.user.daily.operate.exchange" From ffa3850558342d8df2b3668e96b705b99c9ebdc5 Mon Sep 17 00:00:00 2001 From: greysonfang Date: Wed, 11 Sep 2024 14:43:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat=EF=BC=9A=E6=B4=BB=E8=B7=83=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=AE=B0=E5=BD=95=E6=93=8D=E4=BD=9C=E5=92=8C=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=20#10891?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/common/event/dispatcher/pipeline/mq/MQ.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt index a957a4b089e..b05be424801 100644 --- a/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt +++ b/src/backend/ci/core/common/common-event/src/main/kotlin/com/tencent/devops/common/event/dispatcher/pipeline/mq/MQ.kt @@ -325,11 +325,11 @@ object MQ { const val QUEUE_AUTH_RESOURCE_GROUP_MODIFY = "q.auth.resource.group.modify" const val EXCHANGE_PROJECT_USER_DAILY_FANOUT = "e.metrics.project.user.daily.fanout" - const val QUEUE_PROJECT_USER_DAILY_METRICS = "q.metrics.project.user.daily.queue" + const val QUEUE_PROJECT_USER_DAILY_METRICS = "q.metrics.project.user.daily.new.queue" const val EXCHANGE_PROJECT_USER_DAILY_OPERATE = "e.metrics.project.user.daily.operate.exchange" - const val QUEUE_PROJECT_USER_DAILY_OPERATE_METRICS = "q.metrics.project.user.daily.operate.queue" - const val ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS = "r.metrics.project.user.daily.operate" + const val QUEUE_PROJECT_USER_DAILY_OPERATE_METRICS = "q.metrics.project.user.daily.operate.new.queue" + const val ROUTE_PROJECT_USER_DAILY_OPERATE_METRICS = "r.metrics.project.user.daily.new.operate" // 项目启用同步组和成员事件 const val QUEUE_PROJECT_ENABLED_SYNC_GROUP_AND_MEMBER = "q.project.enabled.sync.group.and.member"