Example #1
0
        /// <summary>
        /// 拦截器记录日志
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task Invoke(IIncomingGrainCallContext context)
        {
            string sw8              = RequestContext.Get(IdentityServerConsts.ClaimTypes.SkyWalking) as string;
            string OperId           = this.GrainId.ToString();
            var    tracingTimestamp = _diagnosticListener.OrleansInvokeBefore(context.Grain.GetType(), context.InterfaceMethod, OperId, this.RuntimeIdentity, sw8);

            try
            {
                await context.Invoke();

                _diagnosticListener.OrleansInvokeAfter(tracingTimestamp);
            }
            catch (Exception exception)
            {
                Logger.LogError($"Grain执行异常", exception);
                if (FuncExceptionHandler != null)
                {
                    await FuncExceptionHandler(exception);
                }

                _diagnosticListener.OrleansInvokeError(tracingTimestamp, exception);

                throw exception;
            }
        }