public SpanReceiverInfoBuilder(String className) { info = new SpanReceiverInfo(0, className); }
private int listSpanReceivers(List<String> args) throws IOException { SpanReceiverInfo infos[] = remote.listSpanReceivers(); if (infos.length == 0) { System.out.println("[no span receivers found]"); return 0; } TableListing listing = new TableListing.Builder(). addField("ID"). addField("CLASS"). showHeaders(). build(); for (SpanReceiverInfo info : infos) { listing.addRow("" + info.getId(), info.getClassName()); } System.out.println(listing.toString()); return 0; }
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(); }
@Override public long addSpanReceiver(SpanReceiverInfo info) throws IOException { try { AddSpanReceiverRequestProto.Builder bld = AddSpanReceiverRequestProto.newBuilder(); bld.setClassName(info.getClassName()); for (ConfigurationPair configPair : info.configPairs) { ConfigPair tuple = ConfigPair.newBuilder(). setKey(configPair.getKey()). setValue(configPair.getValue()).build(); bld.addConfig(tuple); } AddSpanReceiverResponseProto resp = rpcProxy.addSpanReceiver(null, bld.build()); return resp.getId(); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public ListSpanReceiversResponseProto listSpanReceivers( RpcController controller, ListSpanReceiversRequestProto req) throws ServiceException { try { SpanReceiverInfo[] descs = server.listSpanReceivers(); ListSpanReceiversResponseProto.Builder bld = ListSpanReceiversResponseProto.newBuilder(); for (int i = 0; i < descs.length; ++i) { bld.addDescriptions(TraceAdminPB.SpanReceiverListInfo.newBuilder(). setId(descs[i].getId()). setClassName(descs[i].getClassName()).build()); } return bld.build(); } catch (IOException e) { throw new ServiceException(e); } }
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; }
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 = loadInstance(info.getClassName(), info.configPairs); } catch (IOException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } catch (RuntimeException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } Trace.addReceiver(rcvr); long newId = highestId++; receivers.put(newId, rcvr); LOG.info("Successfully added SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString()); return newId; }
private int listSpanReceivers(List<String> args) throws IOException { SpanReceiverInfo infos[] = remote.listSpanReceivers(); if (infos.length == 0) { System.out.println("[no span receivers found]"); return 0; } TableListing listing = new TableListing.Builder(). addField("ID"). addField("CLASS"). showHeaders(). build(); for (SpanReceiverInfo info : infos) { listing.addRow("" + info.getId(), info.getClassName()); } System.out.println(listing.toString()); return 0; }
@Override public SpanReceiverInfo[] listSpanReceivers() throws IOException { ArrayList<SpanReceiverInfo> infos = new ArrayList<SpanReceiverInfo>(1); try { ListSpanReceiversRequestProto req = ListSpanReceiversRequestProto.newBuilder().build(); ListSpanReceiversResponseProto resp = rpcProxy.listSpanReceivers(null, req); for (SpanReceiverListInfo info : resp.getDescriptionsList()) { infos.add(new SpanReceiverInfo(info.getId(), info.getClassName())); } } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } return infos.toArray(new SpanReceiverInfo[infos.size()]); }
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 = loadInstance(info.getClassName(), info.configPairs); } catch (IOException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } catch (RuntimeException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } Trace.addReceiver(rcvr); long newId = highestId++; receivers.put(newId, rcvr); LOG.info("Successfully added SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString()); return newId; }
private int listSpanReceivers(List<String> args) throws IOException { SpanReceiverInfo infos[] = remote.listSpanReceivers(); if (infos.length == 0) { System.out.println("[no span receivers found]"); return 0; } TableListing listing = new TableListing.Builder(). addField("ID"). addField("CLASS"). showHeaders(). build(); for (SpanReceiverInfo info : infos) { listing.addRow("" + info.getId(), info.getClassName()); } System.out.println(listing.toString()); return 0; }
public SpanReceiverInfoBuilder(String className) { info = new SpanReceiverInfo(0, className); }
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 = loadInstance(info.getClassName(), info.configPairs); } catch (IOException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } catch (RuntimeException e) { LOG.info("Failed to add SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString(), e); throw e; } Trace.addReceiver(rcvr); long newId = highestId++; receivers.put(newId, rcvr); LOG.info("Successfully added SpanReceiver " + info.getClassName() + " with configuration " + configStringBuilder.toString()); return newId; }
private int listSpanReceivers(List<String> args) throws IOException { SpanReceiverInfo infos[] = remote.listSpanReceivers(); if (infos.length == 0) { System.out.println("[no span receivers found]"); return 0; } TableListing listing = new TableListing.Builder(). addField("ID"). addField("CLASS"). showHeaders(). build(); for (SpanReceiverInfo info : infos) { listing.addRow("" + info.getId(), info.getClassName()); } System.out.println(listing.toString()); return 0; }
public SpanReceiverInfoBuilder(String className) { info = new SpanReceiverInfo(0, className); }
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(); }
private int listSpanReceivers(List<String> args) throws IOException { SpanReceiverInfo infos[] = remote.listSpanReceivers(); if (infos.length == 0) { System.out.println("[no span receivers found]"); return 0; } TableListing listing = new TableListing.Builder(). addField("ID"). addField("CLASS"). showHeaders(). build(); for (SpanReceiverInfo info : infos) { listing.addRow("" + info.getId(), info.getClassName()); } System.out.println(listing.toString()); return 0; }
public SpanReceiverInfoBuilder(String className) { info = new SpanReceiverInfo(0, className); }
@Override public long addSpanReceiver(SpanReceiverInfo info) throws IOException { try { AddSpanReceiverRequestProto.Builder bld = AddSpanReceiverRequestProto.newBuilder(); bld.setClassName(info.getClassName()); for (ConfigurationPair configPair : info.configPairs) { ConfigPair tuple = ConfigPair.newBuilder(). setKey(configPair.getKey()). setValue(configPair.getValue()).build(); bld.addConfig(tuple); } AddSpanReceiverResponseProto resp = rpcProxy.addSpanReceiver(null, bld.build()); return resp.getId(); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public ListSpanReceiversResponseProto listSpanReceivers( RpcController controller, ListSpanReceiversRequestProto req) throws ServiceException { try { SpanReceiverInfo[] descs = server.listSpanReceivers(); ListSpanReceiversResponseProto.Builder bld = ListSpanReceiversResponseProto.newBuilder(); for (int i = 0; i < descs.length; ++i) { bld.addDescriptions(TraceAdminPB.SpanReceiverListInfo.newBuilder(). setId(descs[i].getId()). setClassName(descs[i].getClassName()).build()); } return bld.build(); } catch (IOException e) { throw new ServiceException(e); } }