-
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 2 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
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 addAppHomeSubClusterCall; | ||
|
|
||
| @Metric("Duration for a update application homeSubcluster call") | ||
| private MutableRate updateAppHomeSubClusterCall; | ||
|
|
||
| @Metric("Duration for a get application homeSubcluster call") | ||
| private MutableRate getAppHomeSubClusterCall; | ||
|
|
||
| @Metric("Duration for a get applications homeSubcluster call") | ||
| private MutableRate getAppsHomeSubClusterCall; | ||
|
|
||
| @Metric("Duration for a delete applications homeSubcluster call") | ||
| private MutableRate deleteAppHomeSubClusterCall; | ||
|
|
||
| @Metric("Duration for a register subCluster call") | ||
| private MutableRate registerSubClusterCall; | ||
|
|
||
| @Metric("Duration for a deregister subCluster call") | ||
| private MutableRate deregisterSubClusterCall; | ||
|
|
||
| @Metric("Duration for a subCluster Heartbeat call") | ||
| private MutableRate subClusterHeartbeatCall; | ||
|
|
||
| @Metric("Duration for a get SubCluster call") | ||
| private MutableRate getSubClusterCall; | ||
|
|
||
| @Metric("Duration for a get SubClusters call") | ||
| private MutableRate getSubClustersCall; | ||
|
|
||
| @Metric("Duration for a get PolicyConfiguration call") | ||
| private MutableRate getPolicyConfigurationCall; | ||
|
|
||
| @Metric("Duration for a set PolicyConfiguration call") | ||
| private MutableRate setPolicyConfigurationCall; | ||
|
|
||
| @Metric("Duration for a get PolicyConfigurations call") | ||
| private MutableRate getPoliciesConfigurationsCall; | ||
|
|
||
| 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 addAppHomeSubClusterCallDuration(long value) { | ||
| addAppHomeSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addUpdateAppHomeSubClusterCallDuration(long value) { | ||
| updateAppHomeSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addGetAppHomeSubClusterCallDuration(long value) { | ||
| getAppHomeSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addGetAppsHomeSubClusterCallDuration(long value) { | ||
| getAppsHomeSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addDeleteAppHomeSubClusterCallDuration(long value) { | ||
| deleteAppHomeSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addRegisterSubClusterCallDuration(long value) { | ||
| registerSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addDeregisterSubClusterCallDuration(long value) { | ||
| deregisterSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addSubClusterHeartbeatCallDuration(long value) { | ||
| subClusterHeartbeatCall.add(value); | ||
| } | ||
|
|
||
| public void addGetSubClusterCallDuration(long value) { | ||
| getSubClusterCall.add(value); | ||
| } | ||
|
|
||
| public void addGetSubClustersCallDuration(long value) { | ||
| getSubClustersCall.add(value); | ||
| } | ||
|
|
||
| public void addGetPolicyConfigurationDuration(long value) { | ||
| getPolicyConfigurationCall.add(value); | ||
| } | ||
|
|
||
| public void addSetPolicyConfigurationDuration(long value) { | ||
| setPolicyConfigurationCall.add(value); | ||
| } | ||
|
|
||
| public void addGetPoliciesConfigurationsDuration(long value) { | ||
| getPoliciesConfigurationsCall.add(value); | ||
| } | ||
| } | ||
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.
Do we need to add the Call at the end?
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, there is no need to add the word Call after the variable, I will modify the code.