示例#1
0
 private void OnInitCompleted(object sender, EventArgs eventArgs)
 {
     CmdletLatencyTracker.EndInternalTracking(this.context.UniqueId, "BeginProcessing");
 }
示例#2
0
        private void CommitLog(string loggingStep)
        {
            if (!this.logPendingCommit)
            {
                return;
            }
            this.logPendingCommit = false;
            Guid cmdletUniqueId = this.context.UniqueId;

            try
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.CmdletUniqueId, cmdletUniqueId);
                if (loggingStep != null)
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "Logging", loggingStep);
                }
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ProcessId, Constants.ProcessId);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ProcessName, Constants.ProcessName);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ThreadId, Environment.CurrentManagedThreadId);
                CmdletLatencyTracker.EndInternalTracking(cmdletUniqueId, "Cmd");
                CmdletLatencyTracker.PushLatencyDetailsToLog(cmdletUniqueId, CmdletLogHelper.FuncNameToLogMetaDic, delegate(Enum metadata, double latency)
                {
                    CmdletLogger.UpdateLatency(cmdletUniqueId, metadata, latency);
                }, delegate(string funcName, string totalLatency)
                {
                    CmdletLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, funcName, totalLatency);
                });
                long num = CmdletLatencyTracker.StopLatencyTracker(cmdletUniqueId);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.TotalTime, num);
                CmdletLatencyTracker.DisposeLatencyTracker(cmdletUniqueId);
                if (!this.parametersSetInLog)
                {
                    if (this.context.InvocationInfo != null)
                    {
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.Cmdlet, this.context.InvocationInfo.CommandName);
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.Parameters, TaskVerboseStringHelper.FormatUserSpecifiedParameters(this.context.InvocationInfo.UserSpecifiedParameters ?? new PropertyBag()));
                    }
                    else
                    {
                        CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "InvocationInfo", "null");
                    }
                }
                TaskUserInfo userInfo = this.context.UserInfo;
                if (userInfo != null)
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.TenantId, userInfo.ExecutingUserOrganizationId.GetFriendlyName());
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.AuthenticatedUser, (userInfo.ExecutingWindowsLiveId != SmtpAddress.Empty) ? userInfo.ExecutingWindowsLiveId.ToString() : ((userInfo.ExecutingUserId != null && !string.IsNullOrWhiteSpace(userInfo.ExecutingUserId.Name)) ? userInfo.ExecutingUserId.Name : userInfo.ExecutingUserIdentityName));
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.EffectiveOrganization, userInfo.CurrentOrganizationId.GetFriendlyName());
                }
                else
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "UserInfo", "null");
                }
                if (this.context.ExchangeRunspaceConfig != null)
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.UserServicePlan, this.context.ExchangeRunspaceConfig.ServicePlanForLogging);
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.IsAdmin, this.context.ExchangeRunspaceConfig.HasAdminRoles);
                    if (this.context.ExchangeRunspaceConfig.ConfigurationSettings != null && this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication != ExchangeRunspaceConfigurationSettings.ExchangeApplication.Unknown)
                    {
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ClientApplication, this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication);
                    }
                }
                else
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "ExchangeRunspaceConfig", "null");
                }
                if (!CmdletLogHelper.DefaultLoggingCulture.Equals(CultureInfo.CurrentUICulture) || !CmdletLogHelper.DefaultLoggingCulture.Equals(CultureInfo.CurrentCulture))
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.CultureInfo, CultureInfo.CurrentUICulture + "," + CultureInfo.CurrentCulture);
                }
            }
            catch (Exception ex)
            {
                Diagnostics.LogExceptionWithTrace(Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, null, ExTraceGlobals.InstrumentationTracer, null, "Exception from CmdletLogger.AsyncCommit : {0}", ex);
                CmdletLogger.SafeAppendGenericError(cmdletUniqueId, "CommitLog", ex, new Func <Exception, bool>(TaskHelper.IsTaskUnhandledException));
            }
            finally
            {
                try
                {
                    CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.EndTime, DateTime.UtcNow);
                    CmdletLogger.AsyncCommit(cmdletUniqueId, true);
                    CmdletThreadStaticData.UnRegisterCmdletUniqueId(cmdletUniqueId);
                }
                catch (Exception exception)
                {
                    this.logPendingCommit = true;
                    Diagnostics.LogExceptionWithTrace(Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, null, ExTraceGlobals.InstrumentationTracer, null, "Exception from CmdletLogger.AsyncCommit : {0}", exception);
                }
            }
        }
示例#3
0
 void ITaskModule.Dispose()
 {
     CmdletLatencyTracker.DisposeLatencyTracker(this.context.UniqueId);
 }
 // Token: 0x060015F0 RID: 5616 RVA: 0x00051EE8 File Offset: 0x000500E8
 public LatencyTrackingModule(TaskContext context)
 {
     this.context = context;
     CmdletLatencyTracker.StartInternalTracking(context.UniqueId, "ParameterBinding");
 }
 // Token: 0x060015FB RID: 5627 RVA: 0x00052083 File Offset: 0x00050283
 private void OnStop(object sender, EventArgs eventArgs)
 {
     CmdletLatencyTracker.EndInternalTracking(this.context.UniqueId, "StopProcessing");
 }
 // Token: 0x060015F8 RID: 5624 RVA: 0x0005203C File Offset: 0x0005023C
 private void OnPreRelease(object sender, EventArgs eventArgs)
 {
     CmdletLatencyTracker.StartInternalTracking(this.context.UniqueId, "EndProcessing");
 }
 // Token: 0x060015F7 RID: 5623 RVA: 0x00052025 File Offset: 0x00050225
 private void OnIterateCompleted(object sender, EventArgs eventArgs)
 {
     CmdletLatencyTracker.EndInternalTracking(this.context.UniqueId, "ProcessRecord");
 }
 // Token: 0x060015F6 RID: 5622 RVA: 0x0005200D File Offset: 0x0005020D
 private void OnPreIterate(object sender, EventArgs eventArgs)
 {
     CmdletLatencyTracker.StartInternalTracking(this.context.UniqueId, "ProcessRecord");
 }