HDFS-9942. Add an HTrace span when refreshing the groups for a username (cmccabe)
(cherry picked from commit6e9a582eb1
) (cherry picked from commitb67b5b09a7
)
This commit is contained in:
parent
a44eec1fde
commit
ffa9f2db70
|
@ -27,6 +27,8 @@ import java.util.Set;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.htrace.core.TraceScope;
|
||||
import org.apache.htrace.core.Tracer;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Ticker;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
@ -217,7 +219,20 @@ public class Groups {
|
|||
*/
|
||||
@Override
|
||||
public List<String> load(String user) throws Exception {
|
||||
List<String> groups = fetchGroupList(user);
|
||||
TraceScope scope = null;
|
||||
Tracer tracer = Tracer.curThreadTracer();
|
||||
if (tracer != null) {
|
||||
scope = tracer.newScope("Groups#fetchGroupList");
|
||||
scope.addKVAnnotation("user", user);
|
||||
}
|
||||
List<String> groups = null;
|
||||
try {
|
||||
groups = fetchGroupList(user);
|
||||
} finally {
|
||||
if (scope != null) {
|
||||
scope.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (groups.isEmpty()) {
|
||||
if (isNegativeCacheEnabled()) {
|
||||
|
|
Loading…
Reference in New Issue