-
Notifications
You must be signed in to change notification settings - Fork 9.2k
YARN-11250. Capture the Performance Metrics of ZookeeperFederationStateStore. #4738
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
70c03a3
YARN-11250. Capture the Performance Metrics of ZookeeperFederationSta…
4e98d5e
YARN-11250. Capture the Performance Metrics of ZookeeperFederationSta…
8fdadcb
Merge branch 'trunk' into YARN-11250
slfan1989 2a1454b
YARN-11250. Fix CheckStyle.
df668f9
YARN-11250. Fix CheckStyle.
c7c9099
YARN-11250. Fix CheckStyle.
a27b862
YARN-11250. Fix CheckStyle.
95b9e4e
YARN-11250. Fix CheckStyle.
9e0bea9
YARN-11250. Fix CheckStyle.
dec1841
YARN-11250. Fix CheckStyle.
e78395f
YARN-11250. Fix CheckStyle.
e7b6b69
YARN-11250. Fix CheckStyle.
644fceb
YARN-11250. Fix CodeStyle.
15d0370
YARN-11250. Fix CodeStyle.
04ffb5d
Merge branch 'trunk' into YARN-11250
slfan1989 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
...rg/apache/hadoop/yarn/server/federation/store/impl/ZKFederationStateStoreOpDurations.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with this | ||
| * work for additional information regarding copyright ownership. The ASF | ||
| * licenses this file to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.apache.hadoop.yarn.server.federation.store.impl; | ||
|
|
||
| import org.apache.hadoop.classification.InterfaceAudience; | ||
| import org.apache.hadoop.classification.InterfaceStability; | ||
| import org.apache.hadoop.metrics2.MetricsCollector; | ||
| import org.apache.hadoop.metrics2.MetricsInfo; | ||
| import org.apache.hadoop.metrics2.MetricsSource; | ||
| import org.apache.hadoop.metrics2.MetricsSystem; | ||
| import org.apache.hadoop.metrics2.annotation.Metric; | ||
| import org.apache.hadoop.metrics2.annotation.Metrics; | ||
| import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; | ||
| import org.apache.hadoop.metrics2.lib.MetricsRegistry; | ||
| import org.apache.hadoop.metrics2.lib.MutableRate; | ||
|
|
||
| import static org.apache.hadoop.metrics2.lib.Interns.info; | ||
|
|
||
| @InterfaceAudience.Private | ||
| @InterfaceStability.Unstable | ||
| @Metrics(context="ZKFederationStateStore-op-durations") | ||
| public final class ZKFederationStateStoreOpDurations implements MetricsSource { | ||
|
|
||
| @Metric("Duration for a add application homeSubcluster call") | ||
| private MutableRate addAppHomeSubCluster; | ||
|
|
||
| @Metric("Duration for a update application homeSubcluster call") | ||
| private MutableRate updateAppHomeSubCluster; | ||
|
|
||
| @Metric("Duration for a get application homeSubcluster call") | ||
| private MutableRate getAppHomeSubCluster; | ||
|
|
||
| @Metric("Duration for a get applications homeSubcluster call") | ||
| private MutableRate getAppsHomeSubCluster; | ||
|
|
||
| @Metric("Duration for a delete applications homeSubcluster call") | ||
| private MutableRate deleteAppHomeSubCluster; | ||
|
|
||
| @Metric("Duration for a register subCluster call") | ||
| private MutableRate registerSubCluster; | ||
|
|
||
| @Metric("Duration for a deregister subCluster call") | ||
| private MutableRate deregisterSubCluster; | ||
|
|
||
| @Metric("Duration for a subCluster Heartbeat call") | ||
| private MutableRate subClusterHeartbeat; | ||
|
|
||
| @Metric("Duration for a get SubCluster call") | ||
| private MutableRate getSubCluster; | ||
|
|
||
| @Metric("Duration for a get SubClusters call") | ||
| private MutableRate getSubClusters; | ||
|
|
||
| @Metric("Duration for a get PolicyConfiguration call") | ||
| private MutableRate getPolicyConfiguration; | ||
|
|
||
| @Metric("Duration for a set PolicyConfiguration call") | ||
| private MutableRate setPolicyConfiguration; | ||
|
|
||
| @Metric("Duration for a get PolicyConfigurations call") | ||
| private MutableRate getPoliciesConfigurations; | ||
|
|
||
| protected static final MetricsInfo RECORD_INFO = | ||
| info("ZKFederationStateStoreOpDurations", "Durations of ZKFederationStateStore calls"); | ||
|
|
||
| private final MetricsRegistry registry; | ||
|
|
||
| private static final ZKFederationStateStoreOpDurations INSTANCE = | ||
| new ZKFederationStateStoreOpDurations(); | ||
|
|
||
| public static ZKFederationStateStoreOpDurations getInstance() { | ||
| return INSTANCE; | ||
| } | ||
|
|
||
| private ZKFederationStateStoreOpDurations() { | ||
| registry = new MetricsRegistry(RECORD_INFO); | ||
| registry.tag(RECORD_INFO, "ZKFederationStateStoreOpDurations"); | ||
|
|
||
| MetricsSystem ms = DefaultMetricsSystem.instance(); | ||
| if (ms != null) { | ||
| ms.register(RECORD_INFO.name(), RECORD_INFO.description(), this); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public synchronized void getMetrics(MetricsCollector collector, boolean all) { | ||
| registry.snapshot(collector.addRecord(registry.info()), all); | ||
| } | ||
|
|
||
| public void addAppHomeSubClusterDuration(long endTime, long startTime) { | ||
| addAppHomeSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addUpdateAppHomeSubClusterDuration(long endTime, long startTime) { | ||
| updateAppHomeSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetAppHomeSubClusterDuration(long endTime, long startTime) { | ||
| getAppHomeSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetAppsHomeSubClusterDuration(long endTime, long startTime) { | ||
| getAppsHomeSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addDeleteAppHomeSubClusterDuration(long endTime, long startTime) { | ||
| deleteAppHomeSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addRegisterSubClusterDuration(long endTime, long startTime) { | ||
| registerSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addDeregisterSubClusterDuration(long endTime, long startTime) { | ||
| deregisterSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addSubClusterHeartbeatDuration(long endTime, long startTime) { | ||
| subClusterHeartbeat.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetSubClusterDuration(long endTime, long startTime) { | ||
| getSubCluster.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetSubClustersDuration(long endTime, long startTime) { | ||
| getSubClusters.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetPolicyConfigurationDuration(long endTime, long startTime) { | ||
| getPolicyConfiguration.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addSetPolicyConfigurationDuration(long endTime, long startTime) { | ||
| setPolicyConfiguration.add(endTime - startTime); | ||
| } | ||
|
|
||
| public void addGetPoliciesConfigurationsDuration(long endTime, long startTime) { | ||
| getPoliciesConfigurations.add(endTime - startTime); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we do long startTime, long endTime?
It looks a little more intuitive.
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.