use of org.apache.htrace.core.SpanReceiver in project hadoop by apache.
the class TracerConfigurationManager method listSpanReceivers.
public synchronized SpanReceiverInfo[] listSpanReceivers() throws IOException {
TracerPool pool = TracerPool.getGlobalTracerPool();
SpanReceiver[] receivers = pool.getReceivers();
SpanReceiverInfo[] info = new SpanReceiverInfo[receivers.length];
for (int i = 0; i < receivers.length; i++) {
SpanReceiver receiver = receivers[i];
info[i] = new SpanReceiverInfo(receiver.getId(), receiver.getClass().getName());
}
return info;
}
use of org.apache.htrace.core.SpanReceiver in project hadoop by apache.
the class TracerConfigurationManager method addSpanReceiver.
public synchronized long addSpanReceiver(SpanReceiverInfo info) throws IOException {
StringBuilder configStringBuilder = new StringBuilder();
String prefix = "";
for (ConfigurationPair pair : info.configPairs) {
configStringBuilder.append(prefix).append(pair.getKey()).append(" = ").append(pair.getValue());
prefix = ", ";
}
SpanReceiver rcvr = null;
try {
rcvr = new SpanReceiver.Builder(TraceUtils.wrapHadoopConf(confPrefix, conf, info.configPairs)).className(info.getClassName().trim()).build();
} catch (RuntimeException e) {
LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e);
throw e;
}
TracerPool.getGlobalTracerPool().addReceiver(rcvr);
LOG.info("Successfully added SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString());
return rcvr.getId();
}
use of org.apache.htrace.core.SpanReceiver in project hadoop by apache.
the class TracerConfigurationManager method removeSpanReceiver.
public synchronized void removeSpanReceiver(long spanReceiverId) throws IOException {
SpanReceiver[] receivers = TracerPool.getGlobalTracerPool().getReceivers();
for (SpanReceiver receiver : receivers) {
if (receiver.getId() == spanReceiverId) {
TracerPool.getGlobalTracerPool().removeAndCloseReceiver(receiver);
LOG.info("Successfully removed SpanReceiver " + spanReceiverId + " with class " + receiver.getClass().getName());
return;
}
}
throw new IOException("There is no span receiver with id " + spanReceiverId);
}
Aggregations