Skip to content

Commit 15a7dcb

Browse files
author
Liebing
committed
[server] Add rack metric
1 parent a71a337 commit 15a7dcb

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

fluss-server/src/main/java/com/alibaba/fluss/server/metrics/ServerMetricUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public static CoordinatorMetricGroup createCoordinatorGroup(
7979
}
8080

8181
public static TabletServerMetricGroup createTabletServerGroup(
82-
MetricRegistry registry, String clusterId, String hostname, int serverId) {
82+
MetricRegistry registry, String clusterId, String rack, String hostname, int serverId) {
8383
TabletServerMetricGroup tabletServerMetricGroup =
84-
new TabletServerMetricGroup(registry, clusterId, hostname, serverId);
84+
new TabletServerMetricGroup(registry, clusterId, rack, hostname, serverId);
8585
createAndInitializeStatusMetricGroup(tabletServerMetricGroup);
8686
return tabletServerMetricGroup;
8787
}

fluss-server/src/main/java/com/alibaba/fluss/server/metrics/group/TabletServerMetricGroup.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class TabletServerMetricGroup extends AbstractMetricGroup {
3838
MapUtils.newConcurrentHashMap();
3939

4040
protected final String clusterId;
41+
protected final String rack;
4142
protected final String hostname;
4243
protected final int serverId;
4344

@@ -49,9 +50,10 @@ public class TabletServerMetricGroup extends AbstractMetricGroup {
4950
private final Counter delayedFetchFromClientExpireCount;
5051

5152
public TabletServerMetricGroup(
52-
MetricRegistry registry, String clusterId, String hostname, int serverId) {
53+
MetricRegistry registry, String clusterId, String rack, String hostname, int serverId) {
5354
super(registry, new String[] {clusterId, hostname, NAME}, null);
5455
this.clusterId = clusterId;
56+
this.rack = rack;
5557
this.hostname = hostname;
5658
this.serverId = serverId;
5759

@@ -75,6 +77,7 @@ public TabletServerMetricGroup(
7577
@Override
7678
protected final void putVariables(Map<String, String> variables) {
7779
variables.put("cluster_id", clusterId);
80+
variables.put("rack", rack);
7881
variables.put("host", hostname);
7982
variables.put("server_id", String.valueOf(serverId));
8083
}

fluss-server/src/main/java/com/alibaba/fluss/server/tablet/TabletServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ protected void startServices() throws Exception {
177177
ServerMetricUtils.createTabletServerGroup(
178178
metricRegistry,
179179
ServerMetricUtils.validateAndGetClusterId(conf),
180+
rack,
180181
endpoints.get(0).getHost(),
181182
serverId);
182183

fluss-server/src/test/java/com/alibaba/fluss/server/metrics/group/TestingMetricGroups.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class TestingMetricGroups {
2626

2727
public static final TabletServerMetricGroup TABLET_SERVER_METRICS =
28-
new TabletServerMetricGroup(NOPMetricRegistry.INSTANCE, "fluss", "host", 0);
28+
new TabletServerMetricGroup(NOPMetricRegistry.INSTANCE, "fluss", "host", "rack", 0);
2929

3030
public static final CoordinatorMetricGroup COORDINATOR_METRICS =
3131
new CoordinatorMetricGroup(NOPMetricRegistry.INSTANCE, "cluster1", "host", "0");

0 commit comments

Comments
 (0)