Skip to content

[METRICS] Migrate topic collector to balancer, partitioiner#1765

Merged
chinghongfang merged 3 commits intoopensource4you:mainfrom
chinghongfang:migrate
May 23, 2023
Merged

[METRICS] Migrate topic collector to balancer, partitioiner#1765
chinghongfang merged 3 commits intoopensource4you:mainfrom
chinghongfang:migrate

Conversation

@chinghongfang
Copy link
Copy Markdown
Collaborator

這隻 PR 將 topic collector 整合到 WebService (balancer) 以及 StrictcostPartitioner 中,讓兩者可以指定要使用哪一種 metric 收集方法。

原來的作法是 "使用 JMX 直接收集"。現在的作法除了 "使用 JMX 直接收集" ,多了從 topic 收集 metric 的方法。

使用範例如下:

try (var web =
    new WebService(
        Mockito.mock(Admin.class),
        0,
        id -> -1,
        Duration.ofMillis(5),
        new Configuration(
            Map.of(
                WebService.METRIC_STORE_KEY,
                WebService.METRIC_STORE_TOPIC,
                WebService.BOOTSTRAP_SERVERS_KEY,
                "ignore")))) {
  // webservice created metric store which receive metric from topic
}

Comment thread app/src/main/java/org/astraea/app/web/WebService.java Outdated
Comment thread common/src/main/java/org/astraea/common/partitioner/StrictCostPartitioner.java Outdated
@chinghongfang
Copy link
Copy Markdown
Collaborator Author

感謝 @garyparrot 解釋,我誤會你的意思了,沒有理解這個用法的用意。
改成使用 yield 確實比較容易閱讀和維護,我再修改。

Copy link
Copy Markdown
Collaborator

@garyparrot garyparrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants