Example #1
0
        private void SetupTraceEvents(Trace trace, List <DaxStudioTraceEventClass> events)
        {
            Log.Verbose(Constants.LogMessageTemplate, nameof(QueryTraceEngine), nameof(SetupTraceEvents), "entering");
            trace.Events.Clear();
            // Add CommandBegine & DiscoverBegin so we can catch the heartbeat events
            trace.Events.Add(TraceEventFactory.Create(TraceEventClass.DiscoverBegin));
            trace.Events.Add(TraceEventFactory.Create(TraceEventClass.CommandBegin));
            // Add QueryEnd so we know when to stop the trace
            trace.Events.Add(TraceEventFactory.Create(TraceEventClass.QueryEnd));

            // catch the events in the ITraceWatcher
            foreach (DaxStudioTraceEventClass eventClass in events)
            {
                TraceEventClass amoEventClass = (TraceEventClass)eventClass;
                if (trace.Events.Find(amoEventClass) != null)
                {
                    continue;
                }

                var trcEvent = TraceEventFactory.Create(amoEventClass);
                trace.Events.Add(trcEvent);
            }
            trace.Update(UpdateOptions.Default, UpdateMode.CreateOrReplace);
            Log.Verbose(Constants.LogMessageTemplate, nameof(QueryTraceEngine), nameof(SetupTraceEvents), "exiting");
        }
Example #2
0
        private void SetupTrace(Trace trace, List <DaxStudioTraceEventClass> events)
        {
            Log.Verbose("{class} {method} {message}", "QueryTraceEngine", "SetupTrace", "entering");
            trace.Events.Clear();
            // Add CommandBegin so we can catch the heartbeat events
            trace.Events.Add(TraceEventFactory.Create(TraceEventClass.CommandBegin));
            // Add QueryEnd so we know when to stop the trace
            trace.Events.Add(TraceEventFactory.Create(TraceEventClass.QueryEnd));

            // catch the events in the ITraceWatcher
            foreach (DaxStudioTraceEventClass eventClass in events)
            {
                TraceEventClass amoEventClass = (TraceEventClass)eventClass;
                if (trace.Events.Find(amoEventClass) != null)
                {
                    continue;
                }

                var trcEvent = TraceEventFactory.Create(amoEventClass);
                trace.Events.Add(trcEvent);
            }
            trace.Update();
            Log.Verbose("{class} {method} {message}", "QueryTraceEngine", "SetupTrace", "exiting");
        }