use of org.apache.hadoop.tracing.SpanReceiverInfo.ConfigurationPair in project hadoop by apache.
the class TraceAdminProtocolTranslatorPB method addSpanReceiver.
@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);
}
}
use of org.apache.hadoop.tracing.SpanReceiverInfo.ConfigurationPair 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.hadoop.tracing.SpanReceiverInfo.ConfigurationPair in project hadoop by apache.
the class TestTraceUtils method testExtraConfig.
@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(TEST_PREFIX + key, newValue));
HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig);
assertEquals(newValue, wrapped.get(key));
}
Aggregations