44 lines
1.0 KiB
C#
Raw Normal View History

2023-09-13 11:25:08 +02:00
using KubernetesWorkflow;
using Utils;
2023-09-13 11:25:08 +02:00
namespace MetricsPlugin
{
public interface IMetricsScrapeTarget
{
2023-09-13 11:59:21 +02:00
string Name { get; }
Address Address { get; }
2023-09-13 11:25:08 +02:00
}
2023-09-19 11:51:59 +02:00
public interface IHasMetricsScrapeTarget
{
IMetricsScrapeTarget MetricsScrapeTarget { get; }
}
public interface IHasManyMetricScrapeTargets
2023-09-13 11:59:21 +02:00
{
IMetricsScrapeTarget[] ScrapeTargets { get; }
}
2023-09-13 11:25:08 +02:00
public class MetricsScrapeTarget : IMetricsScrapeTarget
{
public MetricsScrapeTarget(Address address, string name)
2023-09-13 11:25:08 +02:00
{
Address = address;
2023-09-13 11:59:21 +02:00
Name = name;
2023-09-13 11:25:08 +02:00
}
public MetricsScrapeTarget(string ip, int port, string name)
: this(new Address("http://" + ip, port), name)
2023-09-13 11:25:08 +02:00
{
}
public MetricsScrapeTarget(RunningContainer container, string portTag)
: this(container.GetAddress(portTag), container.Name)
2023-09-13 11:25:08 +02:00
{
}
2023-09-13 11:59:21 +02:00
public string Name { get; }
public Address Address { get; }
2023-09-13 11:25:08 +02:00
}
}