Esempio n. 1
0
        /// <summary>
        /// Retrieves list of Function calls matching query.
        /// </summary>
        /// <param name="functionId">The id of the function to get call from.</param>
        /// <param name="filter">Filter to find function calls.</param>
        /// <param name="token">Optional cancellation token to use.</param>
        /// <returns>List of Functions</returns>
        public async Task <ItemsWithoutCursor <FunctionCall> > ListAsync(long functionId, FunctionCallFilter filter, CancellationToken token = default)
        {
            if (filter is null)
            {
                throw new ArgumentNullException(nameof(filter));
            }
            var req = FunctionCalls.list <ItemsWithoutCursor <FunctionCall> >(functionId, filter);

            return(await RunAsync(req, token).ConfigureAwait(false));
        }
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        /// <param name="CrashInstance">A crash that was recently added to the database.</param>
        public void BuildPattern(Crash CrashInstance)
        {
            List <string> Pattern = new List <string>();

            // Get an array of callstack items
            CallStackContainer CallStack = new CallStackContainer(CrashInstance);

            CallStack.bDisplayFunctionNames = true;

            if (CrashInstance.Pattern == null)
            {
                // Set the module based on the modules in the callstack
                CrashInstance.Module = CallStack.GetModuleName();
                try
                {
                    foreach (CallStackEntry Entry in CallStack.CallStackEntries)
                    {
                        FunctionCall CurrentFunctionCall = new FunctionCall();

                        if (FunctionCalls.Where(f => f.Call == Entry.FunctionName).Count() > 0)
                        {
                            CurrentFunctionCall = FunctionCalls.Where(f => f.Call == Entry.FunctionName).First();
                        }
                        else
                        {
                            CurrentFunctionCall      = new FunctionCall();
                            CurrentFunctionCall.Call = Entry.FunctionName;
                            FunctionCalls.InsertOnSubmit(CurrentFunctionCall);
                        }

                        int Count = Crash_FunctionCalls.Where(c => c.CrashId == CrashInstance.Id && c.FunctionCallId == CurrentFunctionCall.Id).Count();
                        if (Count < 1)
                        {
                            Crash_FunctionCall JoinTable = new Crash_FunctionCall();
                            JoinTable.Crash        = CrashInstance;
                            JoinTable.FunctionCall = CurrentFunctionCall;
                            Crash_FunctionCalls.InsertOnSubmit(JoinTable);
                        }

                        SubmitChanges();

                        Pattern.Add(CurrentFunctionCall.Id.ToString());
                    }

                    CrashInstance.Pattern = string.Join("+", Pattern);
                    SubmitChanges();
                }
                catch (Exception Ex)
                {
                    Debug.WriteLine("Exception in BuildPattern: " + Ex.ToString());
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        /// <param name="CrashInstance">A crash that was recently added to the database.</param>
        public void BuildPattern(Crash CrashInstance)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(Crash=" + CrashInstance.Id + ")"))
            {
                List <string> Pattern = new List <string>();

                // Get an array of callstack items
                CallStackContainer CallStack = new CallStackContainer(CrashInstance);
                CallStack.bDisplayFunctionNames = true;

                if (CrashInstance.Pattern == null)
                {
                    // Set the module based on the modules in the callstack
                    CrashInstance.Module = CallStack.GetModuleName();
                    try
                    {
                        foreach (CallStackEntry Entry in CallStack.CallStackEntries)
                        {
                            FunctionCall CurrentFunctionCall = new FunctionCall();

                            if (FunctionCalls.Where(f => f.Call == Entry.FunctionName).Count() > 0)
                            {
                                CurrentFunctionCall = FunctionCalls.Where(f => f.Call == Entry.FunctionName).First();
                            }
                            else
                            {
                                CurrentFunctionCall      = new FunctionCall();
                                CurrentFunctionCall.Call = Entry.FunctionName;
                                FunctionCalls.InsertOnSubmit(CurrentFunctionCall);
                            }

                            SubmitChanges();

                            Pattern.Add(CurrentFunctionCall.Id.ToString());
                        }

                        //CrashInstance.Pattern = "+";
                        CrashInstance.Pattern = string.Join("+", Pattern);
                        // We need something like this +1+2+3+5+ for searching for exact pattern like +5+
                        //CrashInstance.Pattern += "+";

                        SubmitChanges();
                    }
                    catch (Exception Ex)
                    {
                        FLogger.WriteException("BuildPattern: " + Ex.ToString());
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Calls a function synchronously.
        /// </summary>
        /// <param name="functionId">Id for function to get call from.</param>
        /// <param name="data">Data passed through the data argument to the function.</param>
        /// <param name="token">Optional cancellation token to use.</param>
        /// <returns>Reponse from function call.</returns>
        public async Task <FunctionCall> CallFunction <T>(long functionId, T data, CancellationToken token = default)
        {
            var req = FunctionCalls.callFunction <T, FunctionCall>(functionId, data);

            return(await RunAsync(req, token).ConfigureAwait(false));
        }
Esempio n. 5
0
        /// <summary>
        /// Retrieves response for Function call.
        /// </summary>
        /// <param name="functionId">Id for function to get call from.</param>
        /// <param name="callId">Id for function call to get.</param>
        /// <param name="token">Optional cancellation token to use.</param>
        /// <returns>Reponse from function call.</returns>
        public async Task <FunctionCallResponse> RetrieveResponse(long functionId, long callId, CancellationToken token = default)
        {
            var req = FunctionCalls.retrieveResponse <FunctionCallResponse>(functionId, callId);

            return(await RunAsync(req, token).ConfigureAwait(false));
        }
Esempio n. 6
0
        /// <summary>
        /// Retrieves list of Function call logs.
        /// </summary>
        /// <param name="functionId">Id for function to get call from.</param>
        /// <param name="callId">Id for function call to get.</param>
        /// <param name="token">Optional cancellation token to use.</param>
        /// <returns>List of Functions</returns>
        public async Task <ItemsWithoutCursor <FunctionCallLogEntry> > ListLogsAsync(long functionId, long callId, CancellationToken token = default)
        {
            var req = FunctionCalls.listLogs <ItemsWithoutCursor <FunctionCallLogEntry> >(functionId, callId);

            return(await RunAsync(req, token).ConfigureAwait(false));
        }
Esempio n. 7
0
        /// <summary>
        /// Retrieves information about a functionCall given a function id and a call id.
        /// </summary>
        /// <param name="functionId">The id of the function to get call from.</param>
        /// <param name="callId">The id of the function to get call from.</param>
        /// <param name="token">Optional cancellation token.</param>
        /// <returns>Function call with the given id.</returns>
        public async Task <FunctionCall> GetAsync(long functionId, long callId, CancellationToken token = default)
        {
            var req = FunctionCalls.get <FunctionCall>(functionId, callId);

            return(await RunAsync(req, token).ConfigureAwait(false));
        }