/// <exception cref="System.IO.IOException"/> public override SpanReceiverInfo[] ListSpanReceivers() { lock (this) { SpanReceiverInfo[] info = new SpanReceiverInfo[receivers.Count]; int i = 0; foreach (KeyValuePair <long, SpanReceiver> entry in receivers) { info[i] = new SpanReceiverInfo(entry.Key, entry.Value.GetType().FullName); i++; } return(info); } }
/// <exception cref="System.IO.IOException"/> public virtual long AddSpanReceiver(SpanReceiverInfo info) { try { TraceAdminPB.AddSpanReceiverRequestProto.Builder bld = TraceAdminPB.AddSpanReceiverRequestProto .NewBuilder(); bld.SetClassName(info.GetClassName()); foreach (SpanReceiverInfo.ConfigurationPair configPair in info.configPairs) { TraceAdminPB.ConfigPair tuple = ((TraceAdminPB.ConfigPair)TraceAdminPB.ConfigPair .NewBuilder().SetKey(configPair.GetKey()).SetValue(configPair.GetValue()).Build( )); bld.AddConfig(tuple); } TraceAdminPB.AddSpanReceiverResponseProto resp = rpcProxy.AddSpanReceiver(null, ( (TraceAdminPB.AddSpanReceiverRequestProto)bld.Build())); return(resp.GetId()); } catch (ServiceException e) { throw ProtobufHelper.GetRemoteException(e); } }
/// <exception cref="System.IO.IOException"/> public override long AddSpanReceiver(SpanReceiverInfo info) { lock (this) { StringBuilder configStringBuilder = new StringBuilder(); string prefix = string.Empty; foreach (SpanReceiverInfo.ConfigurationPair pair in 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; } catch (RuntimeException e) { Log.Info("Failed to add SpanReceiver " + info.GetClassName() + " with configuration " + configStringBuilder.ToString(), e); throw; } Trace.AddReceiver(rcvr); long newId = highestId++; receivers[newId] = rcvr; Log.Info("Successfully added SpanReceiver " + info.GetClassName() + " with configuration " + configStringBuilder.ToString()); return(newId); } }
public abstract long AddSpanReceiver(SpanReceiverInfo desc);