Exemplo n.º 1
0
 private void AppendHourlySucceededJobsCount(StringBuilder data)
 {
     data.AppendLine("# Help Hourly Succeeded Jobs Count");
     foreach ((DateTime key, long value) in api.HourlySucceededJobs())
     {
         data.AppendLine($"hangfire_hourly_succeeded_jobs_count{{key=\"{key}\"}} {value}");
     }
 }
        public string Get()
        {
            data.AppendLine("# Help Servers Count ");
            data.AppendLine("hangfire_servers_count " + api.GetStatistics().Servers.ToString());
            data.AppendLine("# Help Deleted Jobs Count");
            data.AppendLine("hangfire_deleted_jobs_total_count " + api.GetStatistics().Deleted.ToString());
            data.AppendLine("# Help Enqueued Jobs Count");
            data.AppendLine("hangfire_enqueued_jobs_total_count " + api.GetStatistics().Enqueued.ToString());
            data.AppendLine("# Help Failed Jobs Count");
            data.AppendLine("hangfire_failed_jobs_total_count " + api.GetStatistics().Failed.ToString());
            data.AppendLine("# Help Processing Jobs Count");
            data.AppendLine("hangfire_processing_jobs_total_count " + api.GetStatistics().Processing.ToString());
            data.AppendLine("# Help Queues Count");
            data.AppendLine("hangfire_queues_count " + api.GetStatistics().Queues.ToString());
            data.AppendLine("# Help Recurring Jobs Count");
            data.AppendLine("hangfire_recurring_jobs_count " + api.GetStatistics().Recurring.ToString());
            data.AppendLine("# Help Scheduled Jobs Count");
            data.AppendLine("hangfire_scheduled_jobs_total_count " + api.GetStatistics().Scheduled.ToString());
            data.AppendLine("# Help Succeeded Jobs List Count");
            data.AppendLine("hangfire_succeeded_jobs_total_count " + api.GetStatistics().Succeeded.ToString());

            data.AppendLine("# Help Failed Jobs By Dates Count");
            foreach (var item in api.FailedByDatesCount())
            {
                data.AppendLine("hangfire_failed_jobs_by_dates_count" + "{key=" + "\"" + item.Key.ToShortDateString() + "\"} " + item.Value);
            }

            data.AppendLine("# Help Succeeded Jobs By Dates Count");
            foreach (var item in api.SucceededByDatesCount())
            {
                data.AppendLine("hangfire_succeeded_jobs_by_dates_count" + "{key=" + "\"" + item.Key.ToShortDateString() + "\"} " + item.Value);
            }

            data.AppendLine("# Help Hourly Failed Jobs Count");
            foreach (var item in api.HourlyFailedJobs())
            {
                data.AppendLine("hangfire_hourly_failed_jobs_count" + "{key=" + "\"" + item.Key + "\"} " + item.Value);
            }

            data.AppendLine("# Help Hourly Succeeded Jobs Count");
            foreach (var item in api.HourlySucceededJobs())
            {
                data.AppendLine("hangfire_hourly_succeeded_jobs_count" + "{key=" + "\"" + item.Key + "\"} " + item.Value);
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            return(data.ToString());
        }