mirror of
https://github.com/google/nomulus
synced 2026-01-09 07:33:42 +00:00
Correctly set clientId on EPP metrics in LoginFlow
This wasn't being recorded correctly because the clientId is only set in LoginFlow after the flow succeeds, whereas we were previously logging the clientId before executing the flow. This adds special handling for LoginFlow. Note that we only set the metric label to the clientId for valid registrar logins, to ensure that metric cardinality doesn't grow unbounded (as it might if we used every arbitrary string passed in as an attempted login). This also refactors creation and handling of FakesAndMocksModule so as to be able to make test assertions about EPP metrics from integration flow tests. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154048280
This commit is contained in:
@@ -25,6 +25,7 @@ import google.registry.flows.FlowModule.DryRun;
|
||||
import google.registry.flows.FlowModule.InputXml;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.Transactional;
|
||||
import google.registry.flows.session.LoginFlow;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.monitoring.whitebox.EppMetric;
|
||||
@@ -80,7 +81,12 @@ public class FlowRunner {
|
||||
eppMetricBuilder.setCommandNameFromFlow(flowClass.getSimpleName());
|
||||
if (!isTransactional) {
|
||||
eppMetricBuilder.incrementAttempts();
|
||||
return EppOutput.create(flowProvider.get().run());
|
||||
EppOutput eppOutput = EppOutput.create(flowProvider.get().run());
|
||||
if (flowClass.equals(LoginFlow.class)) {
|
||||
// In LoginFlow, clientId isn't known until after the flow executes, so save it then.
|
||||
eppMetricBuilder.setClientId(sessionMetadata.getClientId());
|
||||
}
|
||||
return eppOutput;
|
||||
}
|
||||
try {
|
||||
return ofy().transact(new Work<EppOutput>() {
|
||||
|
||||
Reference in New Issue
Block a user