示例#1
0
 /// <summary>
 /// 创建一个客户端监控
 /// </summary>
 /// <param name="serviceName">服务名称</param>
 /// <param name="operation">操作</param>
 public ClientTrace(string serviceName, string operation)
 {
     this.Trace        = Unity.Get().Child();
     this.RecordEvent += () =>
     {
         this.Trace.Record(Annotations.ClientSend(), this._beginDate);
         this.Trace.Record(Annotations.ServiceName(serviceName), this._beginDate);
         this.Trace.Record(Annotations.Rpc(operation), this._beginDate);
         this.Trace.Record(Annotations.ClientAddr(SerializerUtils.DefaultEndPoint), this._beginDate);
     };
 }
示例#2
0
文件: ServerTrace.cs 项目: ewin66/SAE
        /// <summary>
        /// 创建一个服务跟踪
        /// </summary>
        /// <param name="serviceName">对应服务的名称</param>
        /// <param name="port">端口号</param>
        public ServerTrace(string serviceName, int port)
        {
            this.Trace = Unity.Get();

            this.RecordEvent += () =>
            {
                this.Trace.Record(Annotations.ServerRecv(), this._beginDate);
                this.Trace.Record(Annotations.ServiceName(serviceName), this._beginDate);
                this.Trace.Record(Annotations.ServerAddr(serviceName,
                                                         new IPEndPoint(SerializerUtils.DefaultEndPoint.Address, port)),
                                  this._beginDate);
            };
        }
示例#3
0
 /// <summary>
 /// 通过<paramref name="dic"/>构建本地跟踪通过<see cref="ServerTrace"/>,<see cref="LocalTrace"/>使用
 /// </summary>
 /// <param name="dic">字典对象</param>
 public void Create(IDictionary <string, string> dic = null)
 {
     if (dic == null)
     {
         Unity.Get();
     }
     else
     {
         tracing.Trace trace;
         if (!_extractor.TryExtract(dic, (c, key) =>
         {
             string value;
             c.TryGetValue(key, out value);
             return(value);
         }, out trace))
         {
             Unity.Get();
         }
         else
         {
             Unity.Set(trace);
         }
     }
 }
示例#4
0
 /// <summary>
 ///
 /// </summary>
 protected override void ForceSampled()
 {
     Unity.Get().ForceSampled();
     base.ForceSampled();
 }