2
0
mirror of synced 2025-01-13 18:14:14 +00:00
cs-codex-dist-tests/DistTestCore/Metrics/MetricsAccessFactory.cs

36 lines
1.1 KiB
C#
Raw Normal View History

2023-04-13 14:36:17 +02: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
{
private readonly TestLifecycle lifecycle;
2023-04-13 14:36:17 +02:00
private readonly RunningContainers prometheusContainer;
public CodexNodeMetricsAccessFactory(TestLifecycle lifecycle, RunningContainers prometheusContainer)
2023-04-13 14:36:17 +02:00
{
this.lifecycle = lifecycle;
2023-04-13 14:36:17 +02:00
this.prometheusContainer = prometheusContainer;
}
public IMetricsAccess CreateMetricsAccess(RunningContainer codexContainer)
{
var query = new MetricsQuery(lifecycle, prometheusContainer);
return new MetricsAccess(lifecycle.Log, lifecycle.TimeSet, query, codexContainer);
2023-04-13 14:36:17 +02:00
}
}
}