Loops in metrics deployment
This commit is contained in:
parent
76dfd7a86c
commit
9778ef51a7
|
@ -20,7 +20,7 @@ namespace CodexNetDeployer
|
||||||
this.workflowCreator = workflowCreator;
|
this.workflowCreator = workflowCreator;
|
||||||
this.lifecycle = lifecycle;
|
this.lifecycle = lifecycle;
|
||||||
this.gethResult = gethResult;
|
this.gethResult = gethResult;
|
||||||
this.validatorsLeft = numberOfValidators;
|
validatorsLeft = numberOfValidators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RunningContainer? Start(int i)
|
public RunningContainer? Start(int i)
|
||||||
|
|
|
@ -46,6 +46,9 @@ namespace CodexNetDeployer
|
||||||
[Uniform("max-duration", "md", "MAXDURATION", true, "Maximum duration in seconds for contracts which will be accepted.")]
|
[Uniform("max-duration", "md", "MAXDURATION", true, "Maximum duration in seconds for contracts which will be accepted.")]
|
||||||
public int MaxDuration { get; set; }
|
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 TestRunnerLocation RunnerLocation { get; set; } = TestRunnerLocation.InternalToCluster;
|
||||||
|
|
||||||
public List<string> Validate()
|
public List<string> Validate()
|
||||||
|
|
|
@ -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.
|
// 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);
|
var setup = new CodexSetup(999, config.CodexLogLevel);
|
||||||
setup.WithStorageQuota(config.StorageQuota!.Value.MB()).EnableMarketplace(0.TestTokens());
|
setup.WithStorageQuota(config.StorageQuota!.Value.MB()).EnableMarketplace(0.TestTokens());
|
||||||
|
setup.MetricsEnabled = config.RecordMetrics;
|
||||||
|
|
||||||
Log("Creating Geth instance and deploying contracts...");
|
Log("Creating Geth instance and deploying contracts...");
|
||||||
var gethStarter = new GethStarter(lifecycle, workflowCreator);
|
var gethStarter = new GethStarter(lifecycle, workflowCreator);
|
||||||
|
@ -46,6 +47,11 @@ namespace CodexNetDeployer
|
||||||
if (container != null) codexContainers.Add(container);
|
if (container != null) codexContainers.Add(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setup.MetricsEnabled)
|
||||||
|
{
|
||||||
|
StartMetricsService(lifecycle, setup, codexContainers);
|
||||||
|
}
|
||||||
|
|
||||||
return new CodexDeployment(gethResults, codexContainers.ToArray(), CreateMetadata());
|
return new CodexDeployment(gethResults, codexContainers.ToArray(), CreateMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +81,13 @@ namespace CodexNetDeployer
|
||||||
return (workflowCreator, lifecycle);
|
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)
|
private string? GetKubeConfig(string kubeConfigFile)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(kubeConfigFile) || kubeConfigFile.ToLowerInvariant() == "null") return null;
|
if (string.IsNullOrEmpty(kubeConfigFile) || kubeConfigFile.ToLowerInvariant() == "null") return null;
|
||||||
|
|
Loading…
Reference in New Issue