GetStatisticsByNode(StatisticsSnapshot command) { return(new Dictionary <IPEndPoint, Dictionary <string, Statistics> >() { { this.IPEndPoint, this.GetStatistics(command) } }); }
/// <summary> /// Return statistics for each procedure, summarized for all connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A dictionary containing Statistics snapshot objects for each procedure that was called on the /// connection.</returns> internal override Dictionary <string, Statistics> GetStatistics(StatisticsSnapshot command) { // Grab from every node then regroup by procedure name and summarize for all nodes by procedure return(this.ConnectionPool.SelectMany(c => c.GetStatistics(command)) .GroupBy(r => r.Key, r => r.Value) .ToDictionary(g => g.Key, g => g.Summarize(), StringComparer.OrdinalIgnoreCase)); }
/// <summary> /// Return statistics for a given procedure, grouped by node. (an empty dictionary (not null!) if no node has /// any statistics for the given procedure). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> public Dictionary <IPEndPoint, Statistics> GetStatisticsByNode( StatisticsSnapshot command , string procedure ) { return(this.Executor.GetStatisticsByNode(command, procedure)); }
/// <summary> /// Return statistics for a given procedure, grouped by node. (an empty dictionary (not null!) if no node has /// any statistics for the given procedure). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics</param> /// <returns>A Statistics snapshot object</returns> internal override Dictionary <IPEndPoint, Statistics> GetStatisticsByNode( StatisticsSnapshot command , string procedure ) { // Summarize from each node connection. return(this.ConnectionPool.ToDictionary(c => c.IPEndPoint, c => c.GetStatistics(command, procedure)) .Where(r => r.Value != null) .ToDictionary(r => r.Key, r => r.Value)); }
public async Task CalculateStatistics(City city) { var averagePrice = await _offerRepository.GetAveragePriceForCity(city); var count = await _offerRepository.GetOffersCountForCity(city); var snapshot = new StatisticsSnapshot { AveragePrice = averagePrice, Count = count, DateCreated = DateTime.UtcNow, City = city }; await _statisticsRepository.Add(snapshot); }
/// <summary> /// Return statistics for a given procedure, grouped by node. (an empty dictionary (not null!) if no node has /// any statistics for the given procedure). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> internal override Dictionary <IPEndPoint, Statistics> GetStatisticsByNode( StatisticsSnapshot command , string procedure ) { Statistics result = this.GetStatistics(command, procedure); if (result == null) { return(new Dictionary <IPEndPoint, Statistics>()); } return(new Dictionary <IPEndPoint, Statistics>() { { this.IPEndPoint, result } }); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal override Statistics GetStatisticsSummary(StatisticsSnapshot command) { lock ((this.Stats as IDictionary).SyncRoot) { Statistics result = this.Stats.Select(i => i.Value).Summarize(); if (command != StatisticsSnapshot.SnapshotOnly) { this.Stats = new Dictionary <string, Statistics>(StringComparer.OrdinalIgnoreCase); if (command == StatisticsSnapshot.SnapshotAndResetWithIgnorePendingExecutions) { this.StatisticsResetExecutionId = this.ExecutionId; } } return(result); } }
/// <summary> /// Return statistics for each procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A dictionary containing Statistics snapshot objects for each procedure that was called on the /// connection.</returns> internal override Dictionary <string, Statistics> GetStatistics(StatisticsSnapshot command) { lock ((this.Stats as IDictionary).SyncRoot) { Dictionary <string, Statistics> result = this.Stats.ToDictionary(s => s.Key, s => s.Value.Snapshot(), StringComparer.OrdinalIgnoreCase); if (command != StatisticsSnapshot.SnapshotOnly) { this.Stats = new Dictionary <string, Statistics>(StringComparer.OrdinalIgnoreCase); } if (command == StatisticsSnapshot.SnapshotAndResetWithIgnorePendingExecutions) { this.StatisticsResetExecutionId = this.ExecutionId; } return(result); } }
/// <summary> /// Return statistics for a given procedure. (null if there are no available statistics). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> internal override Statistics GetStatistics(StatisticsSnapshot command, string procedure) { lock ((this.Stats as IDictionary).SyncRoot) { Statistics result = null; if (this.Stats.TryGetValue(procedure, out result)) { result = result.Snapshot(); if (command != StatisticsSnapshot.SnapshotOnly) { this.Stats.Remove(procedure); } } return(result); } }
/// <summary> /// Return statistics for each procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A dictionary containing Statistics snapshot objects for each procedure that was called on the /// connection.</returns> public Dictionary <string, Statistics> GetStatistics(StatisticsSnapshot command) { return(this.Executor.GetStatistics(command)); }
/// <summary> /// Return statistics for a given procedure. (null if there are no available statistics). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> public Statistics GetStatistics(StatisticsSnapshot command, string procedure) { return(this.Executor.GetStatistics(command, procedure)); }
/// <summary> /// Return statistics for a given procedure, grouped by node. (an empty dictionary (not null!) if no node has /// any statistics for the given procedure). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> internal abstract Dictionary <IPEndPoint, Statistics> GetStatisticsByNode( StatisticsSnapshot command , string procedure );
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal override Statistics GetStatisticsSummary(StatisticsSnapshot command) { // Summarize from each node connection return(this.ConnectionPool.Select(c => c.GetStatisticsSummary(command)).Summarize()); }
/// <summary> /// Return statistics for a given procedure, summarized for all connections. (null if there are no available /// statistics). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> internal override Statistics GetStatistics(StatisticsSnapshot command, string procedure) { // Summarize from each node connection. return(this.ConnectionPool.Select(c => c.GetStatistics(command, procedure)).Summarize()); }
/// <summary> /// Return statistics for a given procedure. (null if there are no available statistics). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> public Statistics GetStatistics(StatisticsSnapshot command, string procedure) { return this.Executor.GetStatistics(command, procedure); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> public Statistics GetStatisticsSummary(StatisticsSnapshot command) { return this.Executor.GetStatisticsSummary(command); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal abstract Dictionary <IPEndPoint, Statistics> GetStatisticsSummaryByNode(StatisticsSnapshot command);
GetStatisticsByNode(StatisticsSnapshot command);
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> public Statistics GetStatisticsSummary(StatisticsSnapshot command) { return(this.Executor.GetStatisticsSummary(command)); }
/// <summary> /// Return statistics for a given procedure, grouped by node. (an empty dictionary (not null!) if no node has /// any statistics for the given procedure). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters (for this /// procedure only).</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> public Dictionary<IPEndPoint, Statistics> GetStatisticsByNode( StatisticsSnapshot command , string procedure ) { return this.Executor.GetStatisticsByNode(command, procedure); }
/// <summary> /// Return statistics for each procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A dictionary containing Statistics snapshot objects for each procedure that was called on the /// connection.</returns> internal abstract Dictionary <string, Statistics> GetStatistics(StatisticsSnapshot command);
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> public Dictionary<IPEndPoint, Statistics> GetStatisticsSummaryByNode(StatisticsSnapshot command) { return this.Executor.GetStatisticsSummaryByNode(command); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal override Dictionary <IPEndPoint, Statistics> GetStatisticsSummaryByNode(StatisticsSnapshot command) { return(new Dictionary <IPEndPoint, Statistics>() { { this.IPEndPoint, this.GetStatisticsSummary(command) } }); }
/// <summary> /// Return statistics for each procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A dictionary containing Statistics snapshot objects for each procedure that was called on the /// connection.</returns> public Dictionary<string, Statistics> GetStatistics(StatisticsSnapshot command) { return this.Executor.GetStatistics(command); }
GetStatisticsByNode(StatisticsSnapshot command) { // Simply gather everything together return(this.ConnectionPool.ToDictionary(c => c.IPEndPoint, c => c.GetStatistics(command))); }
/// <summary> /// Return statistics for a given procedure. (null if there are no available statistics). /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <param name="procedure">The procedure for which you want statistics.</param> /// <returns>A Statistics snapshot object.</returns> internal abstract Statistics GetStatistics(StatisticsSnapshot command, string procedure);
GetStatisticsByNode(StatisticsSnapshot command) { return this.Executor.GetStatisticsByNode(command); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> public Dictionary <IPEndPoint, Statistics> GetStatisticsSummaryByNode(StatisticsSnapshot command) { return(this.Executor.GetStatisticsSummaryByNode(command)); }
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal abstract Statistics GetStatisticsSummary(StatisticsSnapshot command);
/// <summary> /// Return a statistics summary that aggregates all statistics for every called procedure, and accross all /// connections. /// </summary> /// <param name="command">Whether to snapshot only or also reset the internal statistics counters.</param> /// <returns>A Statistics snapshot object representing a summary of all available statistics for the /// connection.</returns> internal override Dictionary <IPEndPoint, Statistics> GetStatisticsSummaryByNode(StatisticsSnapshot command) { // Summarize from each node connection return(this.ConnectionPool.ToDictionary(c => c.IPEndPoint, c => c.GetStatisticsSummary(command))); }
GetStatisticsByNode(StatisticsSnapshot command) { return(this.Executor.GetStatisticsByNode(command)); }