Beispiel #1
0
        public DesktopSessionPersister(IPluginRequest pluginRequest, IExtractPersisterFactory extractFactory)
        {
            maxQueryLength = VizqlPluginArgumentHelper.GetMaxQueryLength(pluginRequest, MaxQueryLengthArgumentKey, MaxQueryLengthDefault);

            sessionPersister          = extractFactory.CreateExtract <VizqlDesktopSession>("VizqlDesktopSessions.hyper");
            errorPersister            = extractFactory.CreateExtract <VizqlErrorEvent>("VizqlDesktopErrorEvents.hyper");
            performanceEventPersister = extractFactory.CreateExtract <VizqlPerformanceEvent>("VizqlDesktopPerformanceEvents.hyper");
            endQueryPersister         = extractFactory.CreateExtract <VizqlEndQuery>("VizqlDesktopEndQueryEvents.hyper");
        }
Beispiel #2
0
        public static InsertionResult PersistSession(IPluginRequest pluginRequest, IDbConnection database, VizqlServerSession currentSession)
        {
            try
            {
                try
                {
                    database.Insert(currentSession);
                    database.InsertAll(currentSession.ErrorEvents);
                }
                catch (PostgresException ex)
                {
                    // We now use these tables in both VizqlServer and VizqlServerPerformance.
                    // If someone runs both we need to swallow any duplicates exceptions that may arise.
                    if (!ex.SqlState.Equals(PluginLibConstants.POSTGRES_ERROR_CODE_UNIQUE_VIOLATION))
                    {
                        throw;
                    }
                }

                // Performance
                database.InsertAll(currentSession.PerformanceEvents);

                // Query
                int maxQueryLength = VizqlPluginArgumentHelper.GetMaxQueryLength(pluginRequest, MaxQueryLengthArgumentKey, DefaultMaxQueryLength);
                database.InsertAll(currentSession.EndQueryEvents.Select(queryEvent => queryEvent.WithTruncatedQueryText(maxQueryLength)));
                database.InsertAll(currentSession.QpQueryEndEvents);

                Log.DebugFormat("Persisted session {0}", currentSession.VizqlSessionId);
                return(new InsertionResult
                {
                    SuccessfulInserts = 1,
                    FailedInserts = 0
                });
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Failed to persist session '{0}': {1}", currentSession.VizqlSessionId, ex.Message);
                return(new InsertionResult
                {
                    SuccessfulInserts = 0,
                    FailedInserts = 1
                });
            }
        }
Beispiel #3
0
        public static InsertionResult PersistSession(IPluginRequest pluginRequest, IDbConnection database, VizqlServerSession currentSession)
        {
            try
            {
                try
                {
                    database.Insert(currentSession);
                    database.InsertAll(currentSession.ErrorEvents);
                }
                catch (PostgresException ex)
                {
                    // We now use these tables in both VizqlServer and VizqlServerPerformance.
                    // If someone runs both we need to swallow any duplicates exceptions that may arise.
                    if (!ex.SqlState.Equals(PluginLibConstants.POSTGRES_ERROR_CODE_UNIQUE_VIOLATION))
                    {
                        throw;
                    }
                }

                // Performance
                database.InsertAll(currentSession.PerformanceEvents);

                // Connection
                database.InsertAll(currentSession.ConstructProtocolEvents);
                database.InsertAll(currentSession.ConstructProtocolGroupEvents);

                // Compute
                database.InsertAll(currentSession.EndComputeQuickFilterStateEvents);

                // Render
                database.InsertAll(currentSession.EndUpdateSheetEvents);

                // Caching
                database.InsertAll(currentSession.EcDropEvents);
                database.InsertAll(currentSession.EcStoreEvents);
                database.InsertAll(currentSession.EcLoadEvents);
                database.InsertAll(currentSession.EqcStoreEvents);
                database.InsertAll(currentSession.EqcLoadEvents);

                // Query
                int maxQueryLength = VizqlPluginArgumentHelper.GetMaxQueryLength(pluginRequest, MaxQueryLengthArgumentKey, DefaultMaxQueryLength);
                database.InsertAll(currentSession.EndQueryEvents.Select(queryEvent => queryEvent.WithTruncatedQueryText(maxQueryLength)));
                database.InsertAll(currentSession.QpQueryEndEvents);
                database.InsertAll(currentSession.EndPrepareQuickFilterQueriesEvents);
                database.InsertAll(currentSession.EndSqlTempTableTuplesCreateEvents);
                foreach (VizqlQpBatchSummary qpBatchSummaryEvent in currentSession.QpBatchSummaryEvents)
                {
                    database.Insert(qpBatchSummaryEvent);
                    database.InsertAll(qpBatchSummaryEvent.QpBatchSummaryJobs.Select(queryEvent => queryEvent.WithTruncatedQueryText(maxQueryLength)));
                }

                Log.DebugFormat("Persisted session {0}", currentSession.VizqlSessionId);
                return(new InsertionResult
                {
                    SuccessfulInserts = 1,
                    FailedInserts = 0
                });
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Failed to persist session '{0}': {1}", currentSession.VizqlSessionId, ex.Message);
                return(new InsertionResult
                {
                    SuccessfulInserts = 0,
                    FailedInserts = 1
                });
            }
        }
        public static InsertionResult PersistSession(IPluginRequest pluginRequest, IDbConnection database, VizqlDesktopSession currentSession)
        {
            try
            {
                database.Insert(currentSession);

                // Error
                database.InsertAll(currentSession.ErrorEvents);

                // Performance
                database.InsertAll(currentSession.PerformanceEvents);

                // Connection
                database.InsertAll(currentSession.ConstructProtocolEvents);
                database.InsertAll(currentSession.ConstructProtocolGroupEvents);
                database.InsertAll(currentSession.DsConnectEvents);

                // Compute
                database.InsertAll(currentSession.EndComputeQuickFilterStateEvents);

                // Render
                database.InsertAll(currentSession.EndUpdateSheetEvents);

                // Caching
                database.InsertAll(currentSession.EcDropEvents);
                database.InsertAll(currentSession.EcStoreEvents);
                database.InsertAll(currentSession.EcLoadEvents);
                database.InsertAll(currentSession.EqcStoreEvents);
                database.InsertAll(currentSession.EqcLoadEvents);

                // Message
                database.InsertAll(currentSession.MessageEvents);

                // Etc
                database.InsertAll(currentSession.EtcEvents);

                // Query
                int maxQueryLength = VizqlPluginArgumentHelper.GetMaxQueryLength(pluginRequest, MaxQueryLengthArgumentKey, DefaultMaxQueryLength);
                database.InsertAll(currentSession.DsInterpretMetadataEvents);
                database.InsertAll(currentSession.EndQueryEvents.Select(queryEvent => queryEvent.WithTruncatedQueryText(maxQueryLength)));
                database.InsertAll(currentSession.QpQueryEndEvents);
                database.InsertAll(currentSession.EndPrepareQuickFilterQueriesEvents);
                database.InsertAll(currentSession.EndSqlTempTableTuplesCreateEvents);
                database.InsertAll(currentSession.SetCollationEvents);
                database.InsertAll(currentSession.ProcessQueryEvents);

                foreach (VizqlQpBatchSummary qpBatchSummaryEvent in currentSession.QpBatchSummaryEvents)
                {
                    database.Insert(qpBatchSummaryEvent);
                    database.InsertAll(qpBatchSummaryEvent.QpBatchSummaryJobs.Select(queryEvent => queryEvent.WithTruncatedQueryText(maxQueryLength)));
                }

                Log.DebugFormat("Persisted session {0}", currentSession.VizqlSessionId);
                return(new InsertionResult
                {
                    SuccessfulInserts = 1,
                    FailedInserts = 0
                });
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("Failed to persist session '{0}': {1}", currentSession.VizqlSessionId, ex.Message);
                return(new InsertionResult
                {
                    SuccessfulInserts = 0,
                    FailedInserts = 1
                });
            }
        }