mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Remove toString() method on Result.Code and fix metrics recording
We almost certainly had intended to record a String representation of the numeric Code all along, but a bad toString() method on the enum resulted in the wrong thing happening. This is more evidence of why overriding toString() on enums is bad. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133583683
This commit is contained in:
parent
aa2af68af0
commit
b1e1dd0f47
2 changed files with 6 additions and 7 deletions
|
@ -55,18 +55,22 @@ public class EppMetrics {
|
|||
* @see FlowRunner
|
||||
*/
|
||||
public void incrementEppRequests(EppMetric metric) {
|
||||
String eppStatusCode =
|
||||
metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : "";
|
||||
eppRequests.increment(
|
||||
metric.getCommandName().or(""),
|
||||
metric.getClientId().or(""),
|
||||
metric.getStatus().isPresent() ? metric.getStatus().toString() : "");
|
||||
eppStatusCode);
|
||||
}
|
||||
|
||||
/** Record the server-side processing time for an EPP request. */
|
||||
public void recordProcessingTime(EppMetric metric) {
|
||||
String eppStatusCode =
|
||||
metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : "";
|
||||
processingTime.record(
|
||||
metric.getEndTimestamp().getMillis() - metric.getStartTimestamp().getMillis(),
|
||||
metric.getCommandName().or(""),
|
||||
metric.getClientId().or(""),
|
||||
metric.getStatus().isPresent() ? metric.getStatus().toString() : "");
|
||||
eppStatusCode);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue