Skip to content

Commit

Permalink
pre-init metric counters
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Apr 11, 2024
1 parent f600c2c commit d51e536
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,23 @@ public static void Main(string[] args)
Console.WriteLine($"[INIT] Loaded {Config.OrgConfigs.Count} orgs and {Config.Sizes.Count} sizes.");

// Prepare metrics
using var server = new Prometheus.KestrelMetricServer(port: 9000);
using var server = new KestrelMetricServer(port: 9000);
server.Start();
Console.WriteLine("[INIT] Metrics server listening on port 9000");

// Init count metrics
foreach (var org in Config.OrgConfigs)
{
foreach (var ms in Config.Sizes)
{
TotalMachineTime.Labels(org.OrgName, ms.Name).IncTo(0);
MachineCreatedCount.Labels(org.OrgName, ms.Name).IncTo(0);
PickedJobCount.Labels(org.OrgName, ms.Name).IncTo(0);
QueuedJobCount.Labels(org.OrgName, ms.Name).IncTo(0);
ProcessedJobCount.Labels(org.OrgName, ms.Name).IncTo(0);
}
}

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHostedService<PoolManager>();

Expand Down

0 comments on commit d51e536

Please sign in to comment.