Exemplo n.º 1
0
 void IApiHandler.End(ApiStation station, ApiCallItem item)
 {
     count.End    = DateTime.Now.Ticks;
     count.Status = item.Status;
     //count.FromId = item.CallerGlobalId;
     ApiCounter.Instance.Count(count);
 }
Exemplo n.º 2
0
 void RegistToZero()
 {
     foreach (var sta in StationInfo.Values)
     {
         if (sta.Aips.Count == 0)
         {
             continue;
         }
         var station = (ApiStation)ZeroApplication.TryGetZeroObject(sta.Name);
         if (station == null)
         {
             ZeroApplication.RegistZeroObject(station = new ApiStation
             {
                 Name        = sta.Name,
                 StationName = sta.Name
             });
         }
         foreach (var api in sta.Aips)
         {
             var action = (ApiActionInfo)api.Value;
             var a      = action.HaseArgument
                 ? station.RegistAction(api.Key, action.ArgumentAction, action.AccessOption, action)
                 : station.RegistAction(api.Key, action.Action, action.AccessOption, action);
             a.ArgumenType = action.ArgumenType;
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 设置Api调用注入
 /// </summary>
 public void HookApi()
 {
     if (_isEnable)
     {
         return;
     }
     _isEnable = true;
     ApiStation.RegistHandlers <ApiCountHandler>();
     ApiClient.RegistHandlers <ApiClientCountHandler>();
     ZeroTrace.SystemLog("ApiCounter", "HookApi");
 }
Exemplo n.º 4
0
 void IApiHandler.Prepare(ApiStation station, ApiCallItem item)
 {
     count = new CountData
     {
         IsInner   = true,
         Start     = DateTime.Now.Ticks,
         Requester = item.Requester,
         HostName  = station.StationName,
         ApiName   = item.ApiName
     };
 }