/// <summary>
        /// Executes <see cref="ReportStatisticsCommand"/>.
        /// </summary>
        private Task <IIpcResult> ExecuteReportStatistics(ReportStatisticsCommand cmd)
        {
            Contract.Requires(cmd != null);

            Tracing.Logger.Log.ApiServerReportStatisticsExecuted(m_loggingContext, cmd.Stats.Count);
            Logger.Log.BulkStatistic(m_loggingContext, cmd.Stats);
            return(Task.FromResult(IpcResult.Success(cmd.RenderResult(true))));
        }
Beispiel #2
0
        /// <summary>
        /// Executes <see cref="ReportStatisticsCommand"/>.
        /// </summary>
        private Task <IIpcResult> ExecuteReportStatistics(ReportStatisticsCommand cmd)
        {
            Contract.Requires(cmd != null);

            Tracing.Logger.Log.ApiServerReportStatisticsExecuted(m_loggingContext, cmd.Stats.Count);
            foreach (var statistic in cmd.Stats)
            {
                // we aggregate the stats based on their name
                m_receivedStatistics.AddOrUpdate(
                    statistic.Key,
                    statistic.Value,
                    static (key, value) => value,
                    static (key, newValue, oldValue) => newValue + oldValue);
            }

            return(Task.FromResult(IpcResult.Success(cmd.RenderResult(true))));
        }