public IEnumerable <MetricEvent> Scrape(DateTimeOffset timestamp) { var statistic = herculesSink.GetStatistics().Total; var delta = statistic - previous; previous = statistic; yield return(CreateMetricEvent(timestamp, "RecordsLostDueToBuildFailures", delta.RecordsLostDueToBuildFailures)); yield return(CreateMetricEvent(timestamp, "RecordsLostDueToOverflows", delta.RecordsLostDueToOverflows)); yield return(CreateMetricEvent(timestamp, "RecordsLostDueToSizeLimit", delta.RecordsLostDueToSizeLimit)); yield return(CreateMetricEvent(timestamp, "TotalLostRecords", delta.TotalLostRecords)); yield return(CreateMetricEvent(timestamp, "RejectedRecordsCount", delta.RejectedRecords.Count)); yield return(CreateMetricEvent(timestamp, "RejectedRecordsSize", delta.RejectedRecords.Size)); yield return(CreateMetricEvent(timestamp, "SentRecordsSize", delta.SentRecords.Size)); yield return(CreateMetricEvent(timestamp, "SentRecordsCount", delta.SentRecords.Count)); yield return(CreateMetricEvent(timestamp, "StoredRecordsSize", statistic.StoredRecords.Size)); yield return(CreateMetricEvent(timestamp, "StoredRecordsCount", statistic.StoredRecords.Count)); yield return(CreateMetricEvent(timestamp, "Capacity", statistic.Capacity)); }
private void LogSentRecords(HerculesSinkStatistics statistic, HerculesSinkCounters delta) { var details = new StringBuilder(); foreach (var kvp in statistic.PerStream) { previous.PerStream.TryGetValue(kvp.Key, out var p); var count = kvp.Value.SentRecords.Count - (p?.SentRecords.Count ?? 0); if (count == 0) { continue; } details.Append(details.Length > 0 ? ", " : " ("); details.Append($"{count} {kvp.Key}"); } if (details.Length > 0) { details.Append(')'); } log.Info("Successfully sent {RecordsCount} record(s) of size {RecordsSize}{Details}.", delta.SentRecords.Count, delta.SentRecords.Size, details.ToString()); }
private void LogSentRecords(HerculesSinkStatistics statistic, HerculesSinkCounters delta) { var message = new StringBuilder("Successfully sent {RecordsCount} record(s) of size {RecordsSize}"); var started = false; foreach (var kvp in statistic.PerStream) { previous.PerStream.TryGetValue(kvp.Key, out var p); var count = kvp.Value.SentRecords.Count - (p?.SentRecords.Count ?? 0); if (count == 0) { continue; } message.Append(started ? ", " : " ("); message.Append($"{count} {kvp.Key}"); started = true; } message.Append(started ? ")." : "."); log.Info(message.ToString(), delta.SentRecords.Count, delta.SentRecords.Size); }