2023-04-13 12:36:17 +00:00
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
|
|
|
|
|
namespace DistTestCore.Metrics
|
|
|
|
|
{
|
|
|
|
|
public interface IMetricsAccessFactory
|
|
|
|
|
{
|
|
|
|
|
IMetricsAccess CreateMetricsAccess(RunningContainer codexContainer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MetricsUnavailableAccessFactory : IMetricsAccessFactory
|
|
|
|
|
{
|
|
|
|
|
public IMetricsAccess CreateMetricsAccess(RunningContainer codexContainer)
|
|
|
|
|
{
|
|
|
|
|
return new MetricsUnavailable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class CodexNodeMetricsAccessFactory : IMetricsAccessFactory
|
|
|
|
|
{
|
2023-04-19 08:42:08 +00:00
|
|
|
|
private readonly TestLifecycle lifecycle;
|
2023-04-13 12:36:17 +00:00
|
|
|
|
private readonly RunningContainers prometheusContainer;
|
|
|
|
|
|
2023-04-19 08:42:08 +00:00
|
|
|
|
public CodexNodeMetricsAccessFactory(TestLifecycle lifecycle, RunningContainers prometheusContainer)
|
2023-04-13 12:36:17 +00:00
|
|
|
|
{
|
2023-04-19 08:42:08 +00:00
|
|
|
|
this.lifecycle = lifecycle;
|
2023-04-13 12:36:17 +00:00
|
|
|
|
this.prometheusContainer = prometheusContainer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IMetricsAccess CreateMetricsAccess(RunningContainer codexContainer)
|
|
|
|
|
{
|
2023-05-04 06:55:20 +00:00
|
|
|
|
var query = new MetricsQuery(lifecycle.Log, lifecycle.TimeSet, prometheusContainer);
|
|
|
|
|
return new MetricsAccess(lifecycle.Log, lifecycle.TimeSet, query, codexContainer);
|
2023-04-13 12:36:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|