Skip to content

Commit

Permalink
Record fetch mismatches and success counts
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmulcahy committed Sep 29, 2020
1 parent 00e827e commit 3e19252
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class RemoteRegionRegistry implements LookupService<String> {
private volatile boolean readyForServingData;
private final EurekaHttpClient eurekaHttpClient;
private long timeOfLastSuccessfulRemoteFetch = System.currentTimeMillis();
private long deltaSuccesses = 0;
private long deltaMismatches = 0;

@Inject
public RemoteRegionRegistry(EurekaServerConfig serverConfig,
Expand Down Expand Up @@ -283,8 +285,11 @@ private boolean fetchAndStoreDelta() throws Throwable {
}

// There is a diff in number of instances for some reason
if ((!reconcileHashCode.equals(delta.getAppsHashCode()))) {
if (!reconcileHashCode.equals(delta.getAppsHashCode())) {
deltaMismatches++;
return reconcileAndLogDifference(delta, reconcileHashCode);
} else {
deltaSuccesses++;
}
}

Expand Down Expand Up @@ -515,4 +520,14 @@ private boolean shouldUseExperimentalTransport() {
public long getTimeOfLastSuccessfulRemoteFetch() {
return (System.currentTimeMillis() - timeOfLastSuccessfulRemoteFetch) / 1000;
}

@com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRY_PREFIX + "remoteDeltaSuccesses", type = DataSourceType.COUNTER)
public long getRemoteFetchSuccesses() {
return deltaSuccesses;
}

@com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRY_PREFIX + "remoteDeltaMismatches", type = DataSourceType.COUNTER)
public long getRemoteFetchMismatches() {
return deltaMismatches;
}
}

0 comments on commit 3e19252

Please sign in to comment.