void IApiHandler.End(ApiStation station, ApiCallItem item) { count.End = DateTime.Now.Ticks; count.Status = item.Status; //count.FromId = item.CallerGlobalId; ApiCounter.Instance.Count(count); }
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; } } }
/// <summary> /// 设置Api调用注入 /// </summary> public void HookApi() { if (_isEnable) { return; } _isEnable = true; ApiStation.RegistHandlers <ApiCountHandler>(); ApiClient.RegistHandlers <ApiClientCountHandler>(); ZeroTrace.SystemLog("ApiCounter", "HookApi"); }
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 }; }