public PerformanceMetricEventArgs(PerformanceMetricCollection performanceMetric, TimeSpan monitorPeriod) { PerformanceMetric = performanceMetric; MonitorPeriod = monitorPeriod; }
private PerformanceMetricCollection GetNextAuditMessageDetails() { var performanceCounter = new PerformanceMetricCollection(); using (var connection = new SqlConnection(connectionString)) { connection.Open(); using (var command = new SqlCommand("SELECT [RowVersion], [Headers] " + "FROM [queue].[Audit] " + "WHERE [RowVersion] > @previous " + "ORDER BY [RowVersion]", connection)) { command.Parameters.Add(new SqlParameter("previous", previousAudit)); using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { while (reader.Read()) { previousAudit = reader.GetInt64(0); string header = reader.GetString(1); var messageHeader = serializer.DeserializeObject<Dictionary<string, string>>(header); performanceCounter.Add(new MessagePerformanceMetric(messageHeader)); } } } } return performanceCounter; }