Loops in metrics deployment

This commit is contained in:
benbierens 2023-07-11 10:59:41 +02:00
parent 76dfd7a86c
commit 9778ef51a7
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 17 additions and 1 deletions

View File

@ -20,7 +20,7 @@ namespace CodexNetDeployer
this.workflowCreator = workflowCreator;
this.lifecycle = lifecycle;
this.gethResult = gethResult;
this.validatorsLeft = numberOfValidators;
validatorsLeft = numberOfValidators;
}
public RunningContainer? Start(int i)

View File

@ -46,6 +46,9 @@ namespace CodexNetDeployer
[Uniform("max-duration", "md", "MAXDURATION", true, "Maximum duration in seconds for contracts which will be accepted.")]
public int MaxDuration { get; set; }
[Uniform("record-metrics", "rm", "RECORDMETRICS", false, "If true, metrics will be collected for all Codex nodes.")]
public bool RecordMetrics { get; set; } = false;
public TestRunnerLocation RunnerLocation { get; set; } = TestRunnerLocation.InternalToCluster;
public List<string> Validate()

View File

@ -27,6 +27,7 @@ namespace CodexNetDeployer
// We trick the Geth companion node into unlocking all of its accounts, by saying we want to start 999 codex nodes.
var setup = new CodexSetup(999, config.CodexLogLevel);
setup.WithStorageQuota(config.StorageQuota!.Value.MB()).EnableMarketplace(0.TestTokens());
setup.MetricsEnabled = config.RecordMetrics;
Log("Creating Geth instance and deploying contracts...");
var gethStarter = new GethStarter(lifecycle, workflowCreator);
@ -46,6 +47,11 @@ namespace CodexNetDeployer
if (container != null) codexContainers.Add(container);
}
if (setup.MetricsEnabled)
{
StartMetricsService(lifecycle, setup, codexContainers);
}
return new CodexDeployment(gethResults, codexContainers.ToArray(), CreateMetadata());
}
@ -75,6 +81,13 @@ namespace CodexNetDeployer
return (workflowCreator, lifecycle);
}
private void StartMetricsService(TestLifecycle lifecycle, CodexSetup setup, List<RunningContainer> codexContainers)
{
Log("Starting metrics service...");
var runningContainers = new RunningContainers(null!, null!, codexContainers.ToArray());
lifecycle.PrometheusStarter.CollectMetricsFor(setup, runningContainers);
}
private string? GetKubeConfig(string kubeConfigFile)
{
if (string.IsNullOrEmpty(kubeConfigFile) || kubeConfigFile.ToLowerInvariant() == "null") return null;