public static TracingSession GetTracingSession(this IConnection @this, Guid tracingId)
        {
            string queryEvents = "select * from system_traces.events where session_id=" + tracingId.ToString();
            List<TracingEvent> tracingEvents = new List<TracingEvent>();
            IDataMapperFactory factory = new DataMapperFactory(null);
            foreach (IDictionary<string, object> mapEvents in CQLCommandHelpers.Query(@this, queryEvents, ConsistencyLevel.ONE, factory, ExecutionFlags.None).Result)
            {
                TracingEvent tracingEvent = new TracingEvent((string) mapEvents["activity"],
                                                             (Guid) mapEvents["event_id"],
                                                             (IPAddress) mapEvents["source"],
                                                             (int) mapEvents["source_elapsed"],
                                                             (string) mapEvents["thread"]);
                tracingEvents.Add(tracingEvent);
            }
            tracingEvents.Sort(CompareTracingEvent);
            TracingEvent[] events = tracingEvents.ToArray();

            string querySession = "select * from system_traces.sessions where session_id=" + tracingId.ToString();
            IDictionary<string, object> mapSession =
                    (IDictionary<string, object>)
                    CQLCommandHelpers.Query(@this, querySession, ConsistencyLevel.ONE, factory, ExecutionFlags.None).Result.Single();
            TracingSession tracingSession = new TracingSession((IPAddress) mapSession["coordinator"],
                                                               (int) mapSession["duration"],
                                                               (IDictionary<string, string>) mapSession["parameters"],
                                                               (string) mapSession["request"],
                                                               (Guid) mapSession["session_id"],
                                                               (DateTime) mapSession["started_at"],
                                                               events);

            return tracingSession;
        }
        private static int CompareTracingEvent(TracingEvent x, TracingEvent y)
        {
            if (x.SourceElapsed < y.SourceElapsed)
                return -1;

            if (x.SourceElapsed > y.SourceElapsed)
                return 1;

            return 0;
        }
Exemple #3
0
        private static int CompareTracingEvent(TracingEvent x, TracingEvent y)
        {
            if (x.SourceElapsed < y.SourceElapsed)
            {
                return(-1);
            }

            if (x.SourceElapsed > y.SourceElapsed)
            {
                return(1);
            }

            return(0);
        }
Exemple #4
0
 internal static void Enqueue(TracingEvent evt)
 {
     _queueTracing.Enqueue(evt);
 }