Skip to content

Commit 02dcaa9

Browse files
committed
refactor implementation by Jark
1 parent d406a60 commit 02dcaa9

File tree

24 files changed

+622
-493
lines changed

24 files changed

+622
-493
lines changed

fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,14 +1735,6 @@ public class ConfigOptions {
17351735
+ "the CoordinatorServer) it is advisable to use a port range "
17361736
+ "like 9250-9260.");
17371737

1738-
public static final ConfigOption<Duration> METRICS_MANAGER_INACTIVE_EXPIRATION_TIME =
1739-
key("metrics.manager.inactive-expiration-time")
1740-
.durationType()
1741-
.defaultValue(Duration.ofHours(1))
1742-
.withDescription(
1743-
"The time to wait an inactive metric to be expired."
1744-
+ "This is not effective for permanent metric but for temporary metric. Mostly user level metric.");
1745-
17461738
// ------------------------------------------------------------------------
17471739
// ConfigOptions for jmx reporter
17481740
// ------------------------------------------------------------------------

fluss-common/src/main/java/org/apache/fluss/metrics/MetricNames.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public class MetricNames {
7777
// --------------------------------------------------------------------------------------------
7878
// metrics for user
7979
// --------------------------------------------------------------------------------------------
80-
public static final String BYTES_IN_COUNT = "bytesInCount";
81-
public static final String BYTES_OUT_COUNT = "bytesOutCount";
80+
public static final String BYTES_IN = "bytesIn";
81+
public static final String BYTES_OUT = "bytesOut";
8282

8383
// --------------------------------------------------------------------------------------------
8484
// metrics for table

fluss-common/src/main/java/org/apache/fluss/metrics/groups/AbstractMetricGroup.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public abstract class AbstractMetricGroup implements MetricGroup {
7373
/** The registry that this metrics group belongs to. */
7474
protected final MetricRegistry registry;
7575

76-
/** The last record time for the group. */
77-
protected volatile long lastRecordTime;
78-
7976
/** All metrics that are directly contained in this group. */
8077
private final Map<String, Metric> metrics = new HashMap<>();
8178

@@ -104,7 +101,6 @@ public AbstractMetricGroup(
104101
this.scopeComponents = checkNotNull(scope);
105102
this.parent = parent;
106103
this.logicalScopeStrings = new String[registry.getNumberReporters()];
107-
this.lastRecordTime = System.currentTimeMillis();
108104
}
109105

110106
@Override
@@ -199,10 +195,6 @@ protected void putVariables(Map<String, String> variables) {}
199195
*/
200196
protected abstract String getGroupName(CharacterFilter filter);
201197

202-
public long getLastRecordTime() {
203-
return lastRecordTime;
204-
}
205-
206198
// ------------------------------------------------------------------------
207199
// Closing
208200
// ------------------------------------------------------------------------

fluss-common/src/main/java/org/apache/fluss/metrics/utils/MetricGroupUtils.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import org.apache.fluss.metrics.groups.MetricGroup;
2121

22-
import java.util.Arrays;
23-
2422
/** Utils for {@link MetricGroup}. */
2523
public class MetricGroupUtils {
2624

@@ -32,8 +30,4 @@ public static String[] makeScope(MetricGroup parentGroup, String... scopes) {
3230
System.arraycopy(scopes, 0, parts, parentComponents.length, scopes.length);
3331
return parts;
3432
}
35-
36-
public static String getScopeName(MetricGroup parentGroup, String... scopes) {
37-
return Arrays.toString(makeScope(parentGroup, scopes));
38-
}
3933
}

fluss-server/src/main/java/org/apache/fluss/server/entity/UserContext.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020

2121
import org.apache.fluss.security.acl.FlussPrincipal;
2222

23+
import static org.apache.fluss.utils.Preconditions.checkNotNull;
24+
2325
/** The context information of user who writes or reads table. */
2426
public class UserContext {
2527
private final FlussPrincipal principal;
2628

2729
public UserContext(FlussPrincipal principal) {
28-
this.principal = principal;
30+
this.principal = checkNotNull(principal);
2931
}
3032

3133
public FlussPrincipal getPrincipal() {

fluss-server/src/main/java/org/apache/fluss/server/metrics/MetricManager.java

Lines changed: 0 additions & 127 deletions
This file was deleted.

fluss-server/src/main/java/org/apache/fluss/server/metrics/ServerMetricUtils.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ public static TabletServerMetricGroup createTabletServerGroup(
8484
String clusterId,
8585
@Nullable String rack,
8686
String hostname,
87-
int serverId,
88-
MetricManager metricManager) {
87+
int serverId) {
8988
TabletServerMetricGroup tabletServerMetricGroup =
90-
new TabletServerMetricGroup(
91-
registry, clusterId, rack, hostname, serverId, metricManager);
89+
new TabletServerMetricGroup(registry, clusterId, rack, hostname, serverId);
9290
createAndInitializeStatusMetricGroup(tabletServerMetricGroup);
9391
return tabletServerMetricGroup;
9492
}

0 commit comments

Comments
 (0)