Exemplo n.º 1
0
        protected override void InternalLogActivityEvent(IActivityScope activityScope, ActivityEventType eventType)
        {
            LogRowFormatter logRowFormatter = new LogRowFormatter(base.LogSchema);

            logRowFormatter[1] = activityScope.ActivityType;
            logRowFormatter[2] = ActivityContextLogger.ActivityEventTypeDictionary[eventType];
            logRowFormatter[3] = activityScope.Status;
            logRowFormatter[4] = activityScope.StartTime;
            logRowFormatter[5] = activityScope.EndTime;
            logRowFormatter[6] = WorkloadManagementLogger.FormatWlmActivity(activityScope, true);
            base.AppendLog(logRowFormatter);
        }
Exemplo n.º 2
0
        protected override void InternalLogActivityEvent(IActivityScope activityScope, ActivityEventType eventType)
        {
            object        userState     = activityScope.UserState;
            AssistantBase assistantBase = null;
            string        assistantShortName;

            if (activityScope.ActivityType == ActivityType.Global)
            {
                assistantShortName = "GlobalActivity";
            }
            else
            {
                SystemTaskBase systemTaskBase = userState as SystemTaskBase;
                if (systemTaskBase != null)
                {
                    assistantShortName = systemTaskBase.Workload.Id;
                }
                else
                {
                    AssistantBase assistantBase2 = userState as AssistantBase;
                    if (assistantBase2 == null)
                    {
                        return;
                    }
                    assistantBase      = assistantBase2;
                    assistantShortName = assistantBase.NonLocalizedName;
                }
            }
            AssistantsEventType eventType2;

            switch (eventType)
            {
            case ActivityEventType.SuspendActivity:
                eventType2 = AssistantsEventType.SuspendActivity;
                goto IL_92;

            case ActivityEventType.EndActivity:
                eventType2 = AssistantsEventType.EndActivity;
                goto IL_92;
            }
            base.SafeTraceDebug(0L, "Skip logging ActivityEvent '{0}'.", new object[]
            {
                eventType
            });
            return;

IL_92:
            List <KeyValuePair <string, object> > customData = WorkloadManagementLogger.FormatWlmActivity(activityScope, true);

            AssistantsLog.InternalLogRow(activityScope.ActivityId, assistantShortName, assistantBase, eventType2, customData, Guid.Empty);
        }
        protected override void InternalLogActivityEvent(IActivityScope scope, ActivityEventType eventType)
        {
            List <KeyValuePair <string, object> > customData = null;

            switch (eventType)
            {
            case ActivityEventType.StartActivity:
            case ActivityEventType.ResumeActivity:
                break;

            case ActivityEventType.SuspendActivity:
            case ActivityEventType.EndActivity:
                customData = WorkloadManagementLogger.FormatWlmActivity(scope, true);
                break;

            default:
                MrsAndProxyActivityLogger.instance.SafeTraceDebug(0L, "Skip logging ActivityEvent '{0}'.", new object[]
                {
                    eventType
                });
                return;
            }
            MrsAndProxyActivityLogger.InternalLogRow(scope.ActivityId, ActivityContextLogger.ActivityEventTypeDictionary[eventType], scope.Action, scope.UserId, scope.ClientInfo, customData);
        }
        protected override void InternalDispose(bool disposing)
        {
            if (!this.isDisposeAlreadyCalled && disposing && this.ActivityScope != null)
            {
                lock (this.SyncRoot)
                {
                    if (!this.isDisposeAlreadyCalled)
                    {
                        this.excludeLogEntry |= this.SkipLogging;
                        try
                        {
                            if (this.ActivityScope.ActivityType == ActivityType.Request)
                            {
                                this.FetchLatencyData();
                                if (!this.excludeLogEntry)
                                {
                                    this.PreCommitTasks();
                                }
                            }
                            if (this.EndActivityContext && this.ActivityScope.Status == ActivityContextStatus.ActivityStarted)
                            {
                                this.ActivityScope.End();
                            }
                            if (!this.excludeLogEntry)
                            {
                                List <KeyValuePair <string, object> > formattableMetadata = this.ActivityScope.GetFormattableMetadata();
                                formattableMetadata.RemoveAll(delegate(KeyValuePair <string, object> pair)
                                {
                                    Enum @enum = ActivityContext.LookupEnum(pair.Key);
                                    return(object.Equals(@enum, RequestDetailsLoggerBase <T> .RequestLoggerConfig.GenericInfoColumn) || object.Equals(@enum, ActivityStandardMetadata.ReturnClientRequestId) || RequestDetailsLoggerBase <T> .enumToIndexMap.ContainsKey(@enum));
                                });
                                List <KeyValuePair <string, object> > collection = WorkloadManagementLogger.FormatWlmActivity(this.ActivityScope, false);
                                formattableMetadata.AddRange(collection);
                                foreach (KeyValuePair <Enum, int> keyValuePair in RequestDetailsLoggerBase <T> .enumToIndexMap)
                                {
                                    string text = this.Get(keyValuePair.Key);
                                    if (object.Equals(RequestDetailsLoggerBase <T> .RequestLoggerConfig.GenericInfoColumn, keyValuePair.Key))
                                    {
                                        text += LogRowFormatter.FormatCollection(formattableMetadata);
                                    }
                                    if (!string.IsNullOrEmpty(text))
                                    {
                                        text = RequestDetailsLoggerBase <T> .FormatForCsv(text);

                                        this.Row[keyValuePair.Value] = text;
                                    }
                                }
                                RequestDetailsLoggerBase <T> .Log.Append(this.Row, -1);

                                this.UploadDataToStreamInsight();
                            }
                        }
                        finally
                        {
                            if (this.ActivityScope != null && this.EndActivityContext && this.ActivityScope.Status == ActivityContextStatus.ActivityStarted)
                            {
                                this.ActivityScope.End();
                            }
                            this.isDisposeAlreadyCalled = true;
                        }
                    }
                }
            }
        }