Skip to content

Commit

Permalink
refactor: unified variable naming style
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterZh6 committed Sep 24, 2024
1 parent ab4420f commit 6481c5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public final class Constants {

public static final String NUM_SNAPSHOT_ERROR = "numSnapshotError";

public static final String NUM_COMPLETED_SNAPSHOTS = "numCompletedSnapshots";
public static final String NUM_SNAPSHOT_COMPLETE = "numSnapshotComplete";

public static final String SNAPSHOT_TO_CHECKPOINT_TIME_LAG = "snapshotToCheckpointTimeLag";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
import static org.apache.inlong.sort.base.Constants.NUM_BYTES_IN;
import static org.apache.inlong.sort.base.Constants.NUM_BYTES_IN_FOR_METER;
import static org.apache.inlong.sort.base.Constants.NUM_BYTES_IN_PER_SECOND;
import static org.apache.inlong.sort.base.Constants.NUM_COMPLETED_SNAPSHOTS;
import static org.apache.inlong.sort.base.Constants.NUM_DESERIALIZE_ERROR;
import static org.apache.inlong.sort.base.Constants.NUM_DESERIALIZE_SUCCESS;
import static org.apache.inlong.sort.base.Constants.NUM_RECORDS_IN;
import static org.apache.inlong.sort.base.Constants.NUM_RECORDS_IN_FOR_METER;
import static org.apache.inlong.sort.base.Constants.NUM_RECORDS_IN_PER_SECOND;
import static org.apache.inlong.sort.base.Constants.NUM_SNAPSHOT_COMPLETE;
import static org.apache.inlong.sort.base.Constants.NUM_SNAPSHOT_CREATE;
import static org.apache.inlong.sort.base.Constants.NUM_SNAPSHOT_ERROR;
import static org.apache.inlong.sort.base.Constants.SNAPSHOT_TO_CHECKPOINT_TIME_LAG;
Expand All @@ -62,7 +62,7 @@ public class SourceExactlyMetric implements MetricData, Serializable, SourceMetr
private Gauge<Long> deserializeTimeLag;
private Counter numSnapshotCreate;
private Counter numSnapshotError;
private Counter numCompletedSnapshots;
private Counter numSnapshotComplete;
private Gauge<Long> snapshotToCheckpointTimeLag;
private Meter numRecordsInPerSecond;
private Meter numBytesInPerSecond;
Expand Down Expand Up @@ -124,7 +124,7 @@ public SourceExactlyMetric(MetricOption option, MetricGroup metricGroup) {
registerMetricsForCurrentFetchEventTimeLag();
registerMetricsForCurrentEmitEventTimeLag();
registerMetricsForDeserializeTimeLag();
registerMetricsForNumCompletedSnapshots(new ThreadSafeCounter());
registerMetricsForNumSnapshotComplete(new ThreadSafeCounter());
registerMetricsForNumDeserializeSuccess(new ThreadSafeCounter());
registerMetricsForNumDeserializeError(new ThreadSafeCounter());
registerMetricsForNumSnapshotCreate(new ThreadSafeCounter());
Expand Down Expand Up @@ -230,8 +230,8 @@ public void registerMetricsForNumSnapshotError(Counter counter) {
numSnapshotError = registerCounter(NUM_SNAPSHOT_ERROR, counter);
}

public void registerMetricsForNumCompletedSnapshots(Counter counter) {
numCompletedSnapshots = registerCounter(NUM_COMPLETED_SNAPSHOTS, counter);
public void registerMetricsForNumSnapshotComplete(Counter counter) {
numSnapshotComplete = registerCounter(NUM_SNAPSHOT_COMPLETE, counter);
}

public void registerMetricsForSnapshotToCheckpointTimeLag() {
Expand Down Expand Up @@ -303,8 +303,8 @@ public long getSnapshotToCheckpointDelay() {
return snapshotToCheckpointDelay;
}

public Counter getNumCompletedSnapshots() {
return numCompletedSnapshots;
public Counter getNumSnapshotComplete() {
return numSnapshotComplete;
}

public void recordDeserializeDelay(long deserializeDelay) {
Expand Down Expand Up @@ -390,9 +390,9 @@ public void incNumSnapshotError() {
}
}

public void incNumCompletedSnapshots() {
if (numCompletedSnapshots != null) {
numCompletedSnapshots.inc();
public void incNumSnapshotComplete() {
if (numSnapshotComplete != null) {
numSnapshotComplete.inc();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public void notifyCheckpointComplete(long checkpointId) {
if (checkpointStartTimeMap != null) {
Long snapShotStartTimeById = checkpointStartTimeMap.remove(checkpointId);
if (snapShotStartTimeById != null && sourceExactlyMetric != null) {
sourceExactlyMetric.incNumCompletedSnapshots();
sourceExactlyMetric.incNumSnapshotComplete();
sourceExactlyMetric
.recordSnapshotToCheckpointDelay(System.currentTimeMillis() - snapShotStartTimeById);
}
Expand Down

0 comments on commit 6481c5a

Please sign in to comment.