Skip to content

Commit

Permalink
Merge pull request Azure#11 from FabianMeiswinkel/users/fabianm/Seria…
Browse files Browse the repository at this point in the history
…lizationFix

Fxiing Json serialization issue.
  • Loading branch information
FabianMeiswinkel authored Sep 15, 2020
2 parents 951f0ef + d396011 commit 3de9843
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ String recordAddressResolutionStart(URI targetEndpoint) {

AddressResolutionStatistics resolutionStatistics = new AddressResolutionStatistics();
resolutionStatistics.startTimeUTC = Instant.now();
// Very far in the future
resolutionStatistics.endTimeUTC = Instant.MAX;
resolutionStatistics.endTimeUTC = null;
resolutionStatistics.targetEndpoint = targetEndpoint == null ? "<NULL>" : targetEndpoint.toString();

synchronized (this) {
Expand Down Expand Up @@ -192,6 +191,8 @@ void recordAddressResolutionEnd(String identifier) {

AddressResolutionStatistics resolutionStatistics = this.addressResolutionStatistics.get(identifier);
resolutionStatistics.endTimeUTC = responseTime;
resolutionStatistics.errorMessage = null;
resolutionStatistics.inflightRequest = false;
}
}

Expand Down Expand Up @@ -329,6 +330,14 @@ private static class AddressResolutionStatistics {
Instant endTimeUTC;
@JsonSerialize
String targetEndpoint;
@JsonSerialize
String errorMessage;

// If one replica return error we start address call in parallel,
// on other replica valid response, we end the current user request,
// indicating background addressResolution is still inflight
@JsonSerialize
boolean inflightRequest = true;
}

private static class GatewayStatistics {
Expand Down Expand Up @@ -363,4 +372,4 @@ public RequestTimeline getRequestTimeline() {
return requestTimeline;
}
}
}
}

0 comments on commit 3de9843

Please sign in to comment.