-
Notifications
You must be signed in to change notification settings - Fork 9.1k
YARN-11326. [Federation] Add RM FederationStateStoreService Metrics. #4963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Can you help review this pr? I added Metric information for RM FederationStateStoreService. Thank you very much! |
GetSubClusterPolicyConfigurationResponse response = | ||
stateStoreClient.getPolicyConfiguration(request); | ||
long stopTime = clock.getTime(); | ||
FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help reviewing the code, I will fix it.
GetSubClusterPoliciesConfigurationsResponse response = | ||
stateStoreClient.getPoliciesConfigurations(request); | ||
long stopTime = clock.getTime(); | ||
FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it.
AddApplicationHomeSubClusterResponse response = | ||
stateStoreClient.addApplicationHomeSubCluster(request); | ||
long stopTime = clock.getTime(); | ||
FederationStateStoreServiceMetrics.succeededStateStoreServiceCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it.
} | ||
|
||
@Override | ||
public DeleteApplicationHomeSubClusterResponse deleteApplicationHomeSubCluster( | ||
DeleteApplicationHomeSubClusterRequest request) throws YarnException { | ||
return stateStoreClient.deleteApplicationHomeSubCluster(request); | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We keep doing this over and over again.
There's no way to generalize this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion, I will refactor this part of the code to use a generic method instead.
@Test | ||
public void testFederationStateStoreServiceMetricInit() { | ||
LOG.info("Test: aggregate metrics are initialized correctly"); | ||
assertEquals(0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line
FederationStateStoreServiceMetrics.getNumSucceededCalls()); | ||
double latencySucceessfulCalls = | ||
FederationStateStoreServiceMetrics.getLatencySucceessfulCallsForMethod("registerSubCluster"); | ||
Assert.assertEquals(100, latencySucceessfulCalls, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static import
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@goiri Please help to review this pr again, thank you very much! |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
return invoke(clientMethod, RouterMasterKeyResponse.class); | ||
} | ||
|
||
private <R> R invoke(FederationClientMethod request, Class<R> clazz) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add javadoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help reviewing the code, I will add the java doc.
return result; | ||
} catch (Exception e) { | ||
LOG.error("stateStoreClient call method {} error.", request.getMethodName(), e); | ||
FederationStateStoreServiceMetrics.failedStateStoreServiceCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it.
} | ||
|
||
@Override | ||
public RouterMasterKeyResponse getMasterKeyByDelegationKey(RouterMasterKeyRequest request) | ||
throws YarnException, IOException { | ||
FederationClientMethod clientMethod = new FederationClientMethod( | ||
"getMasterKeyByDelegationKey", RouterMasterKeyResponse.class, request); | ||
return invoke(clientMethod, RouterMasterKeyResponse.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we do something like:
clientMethod.invoke();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestion, I will refactor this part of the code.
} | ||
FederationClientMethod clientMethod = new FederationClientMethod( | ||
"getPoliciesConfigurations", GetSubClusterPoliciesConfigurationsResponse.class, request); | ||
return invoke(clientMethod, GetSubClusterPoliciesConfigurationsResponse.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have tests for all these metrics, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't finished the test yet, I will test the interface in junit Test.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -283,154 +290,229 @@ public void checkVersion() throws Exception { | |||
@Override | |||
public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration( | |||
GetSubClusterPolicyConfigurationRequest request) throws YarnException { | |||
return stateStoreClient.getPolicyConfiguration(request); | |||
FederationClientMethod clientMethod = new FederationClientMethod( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense to make it:
FederationClientMethod<GetSubClusterPolicyConfigurationResponse>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or actually just specify it as an arg:
FederationClientMethod clientMethod = new FederationClientMethod(
"getPolicyConfiguration", GetSubClusterPolicyConfigurationRequest.class, request,
GetSubClusterPolicyConfigurationResponse.class,
stateStoreClient, clock);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea, I will modify the code.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Can you help review this PR again? Thank you very much! |
} | ||
|
||
@Override | ||
public RouterRMTokenResponse updateStoredToken(RouterRMTokenRequest request) | ||
throws YarnException, IOException { | ||
return stateStoreClient.updateStoredToken(request); | ||
FederationClientMethod<RouterRMTokenResponse> clientMethod = | ||
new FederationClientMethod<>("updateStoredToken", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why the checkstyle is not flagging this, but the spacing doesn't look correctly.
@Override
public RouterRMTokenResponse updateStoredToken(RouterRMTokenRequest request)
throws YarnException, IOException {
FederationClientMethod<RouterRMTokenResponse> clientMethod = new FederationClientMethod<>(
"updateStoredToken",
RouterRMTokenRequest.class, request,
RouterRMTokenResponse.class, stateStoreClient, clock);
return clientMethod.invoke();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion! I will modify the code.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Thank you very much for helping to review the code! |
JIRA: YARN-11326. [Federation] Add RM FederationStateStoreService Metrics.