Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,26 @@ public void proxyOpFailureCommunicate(String nsId) {
}
}

@Override
public void ProxyOpPermitRejected(String nsId) {
if (metrics != null) {
metrics.incrProxyOpPermitRejected();

}
if (nameserviceRPCMetricsMap != null &&
nameserviceRPCMetricsMap.containsKey(nsId)) {
nameserviceRPCMetricsMap.get(nsId).incrProxyOpPermitRejected();
}
}

@Override
public void ProxyOpPermitAccepted(String nsId) {
if (nameserviceRPCMetricsMap != null &&
nameserviceRPCMetricsMap.containsKey(nsId)) {
nameserviceRPCMetricsMap.get(nsId).incrProxyOpPermitAccepted();
}
}

@Override
public void proxyOpFailureClientOverloaded() {
if (metrics != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ public interface NameserviceRPCMBean {

long getProxyOpNoNamenodes();

long getProxyOpPermitRejected();

long getProxyOpPermitAccepted();
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class NameserviceRPCMetrics implements NameserviceRPCMBean {
private MutableCounterLong proxyOpFailureCommunicate;
@Metric("Number of operations to hit no namenodes available")
private MutableCounterLong proxyOpNoNamenodes;
@Metric("Number of operations to hit permit limits")
private MutableCounterLong proxyOpPermitRejected;
@Metric("Number of operations accepted to hit a namenode")
private MutableCounterLong proxyOpPermitAccepted;

public NameserviceRPCMetrics(Configuration conf, String nsId) {
this.nsId = nsId;
Expand Down Expand Up @@ -91,6 +95,23 @@ public long getProxyOpNoNamenodes() {
return proxyOpNoNamenodes.value();
}

public void incrProxyOpPermitRejected() {
proxyOpPermitRejected.incr();
}

@Override
public long getProxyOpPermitRejected() {
return proxyOpPermitRejected.value();
}

public void incrProxyOpPermitAccepted() {
proxyOpPermitAccepted.incr();
}

@Override
public long getProxyOpPermitAccepted() {
return proxyOpPermitAccepted.value();
}

/**
* Add the time to proxy an operation from the moment the Router sends it to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ private void acquirePermit(final String nsId, final UserGroupInformation ugi,
// Throw StandByException,
// Clients could fail over and try another router.
if (rpcMonitor != null) {
rpcMonitor.getRPCMetrics().incrProxyOpPermitRejected();
rpcMonitor.ProxyOpPermitRejected(nsId);
}
incrRejectedPermitForNs(nsId);
LOG.debug("Permit denied for ugi: {} for method: {}",
Expand All @@ -1590,6 +1590,9 @@ private void acquirePermit(final String nsId, final UserGroupInformation ugi,
" is overloaded for NS: " + nsId;
throw new StandbyException(msg);
}
if (rpcMonitor!= null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing

rpcMonitor.ProxyOpPermitAccepted(nsId);
}
incrAcceptedPermitForNs(nsId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ void init(
* exception.
*/
void proxyOpFailureCommunicate(String nsId);

/**
* Rejected to proxy an operation to a Namenode.
*/
void ProxyOpPermitRejected(String nsId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower case p?


/**
* Accepted to proxy an operation to a Namenode.
*/
void ProxyOpPermitAccepted(String nsId);

/**
* Failed to proxy an operation to a Namenode because the client was
* overloaded.
Expand Down