public void addConfigurationPair(String key, String value) { info.configPairs.add(new ConfigurationPair(key, value)); }
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; }
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; }
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; }
public static HTraceConfiguration wrapHadoopConf(final String prefix, final Configuration conf, List<ConfigurationPair> extraConfig) { final HashMap<String, String> extraMap = new HashMap<String, String>(); for (ConfigurationPair pair : extraConfig) { extraMap.put(pair.getKey(), pair.getValue()); } return new HTraceConfiguration() { @Override public String get(String key) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, ""); } @Override public String get(String key, String defaultValue) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, defaultValue); } }; } }
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(); }
public static HTraceConfiguration wrapHadoopConf(final String prefix, final Configuration conf, List<ConfigurationPair> extraConfig) { final HashMap<String, String> extraMap = new HashMap<String, String>(); for (ConfigurationPair pair : extraConfig) { extraMap.put(pair.getKey(), pair.getValue()); } return new HTraceConfiguration() { @Override public String get(String key) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, ""); } @Override public String get(String key, String defaultValue) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, defaultValue); } }; } }
public static HTraceConfiguration wrapHadoopConf(final String prefix, final Configuration conf, List<ConfigurationPair> extraConfig) { final HashMap<String, String> extraMap = new HashMap<String, String>(); for (ConfigurationPair pair : extraConfig) { extraMap.put(pair.getKey(), pair.getValue()); } return new HTraceConfiguration() { @Override public String get(String key) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, ""); } @Override public String get(String key, String defaultValue) { if (extraMap.containsKey(key)) { return extraMap.get(key); } return conf.get(prefix + key, defaultValue); } }; } }
@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 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 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 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); } }
public void addConfigurationPair(String key, String value) { info.configPairs.add(new ConfigurationPair(key, value)); }
public void addConfigurationPair(String key, String value) { info.configPairs.add(new ConfigurationPair(key, value)); }
@Test public void testExtraConfig() { String key = "test.extra.config"; String oldValue = "old value"; String newValue = "new value"; Configuration conf = new Configuration(); conf.set(TEST_PREFIX + key, oldValue); LinkedList<ConfigurationPair> extraConfig = new LinkedList<ConfigurationPair>(); extraConfig.add(new ConfigurationPair(key, newValue)); HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig); assertEquals(newValue, wrapped.get(key)); } }
@Test public void testExtraConfig() { String key = "test.extra.config"; String oldValue = "old value"; String newValue = "new value"; Configuration conf = new Configuration(); conf.set(TEST_PREFIX + key, oldValue); LinkedList<ConfigurationPair> extraConfig = new LinkedList<ConfigurationPair>(); extraConfig.add(new ConfigurationPair(key, newValue)); HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig); assertEquals(newValue, wrapped.get(key)); } }
public void addConfigurationPair(String key, String value) { info.configPairs.add(new ConfigurationPair(key, value)); }
public void addConfigurationPair(String key, String value) { info.configPairs.add(new ConfigurationPair(key, value)); }