2023-09-13 09:25:08 +00:00
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
|
|
|
|
|
namespace MetricsPlugin
|
|
|
|
|
{
|
|
|
|
|
public interface IMetricsScrapeTarget
|
|
|
|
|
{
|
2023-09-13 09:59:21 +00:00
|
|
|
|
string Name { get; }
|
2023-09-13 09:25:08 +00:00
|
|
|
|
string Ip { get; }
|
|
|
|
|
int Port { get; }
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-19 09:51:59 +00:00
|
|
|
|
public interface IHasMetricsScrapeTarget
|
|
|
|
|
{
|
|
|
|
|
IMetricsScrapeTarget MetricsScrapeTarget { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IHasManyMetricScrapeTargets
|
2023-09-13 09:59:21 +00:00
|
|
|
|
{
|
|
|
|
|
IMetricsScrapeTarget[] ScrapeTargets { get; }
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 09:25:08 +00:00
|
|
|
|
public class MetricsScrapeTarget : IMetricsScrapeTarget
|
|
|
|
|
{
|
2023-09-13 09:59:21 +00:00
|
|
|
|
public MetricsScrapeTarget(string ip, int port, string name)
|
2023-09-13 09:25:08 +00:00
|
|
|
|
{
|
|
|
|
|
Ip = ip;
|
|
|
|
|
Port = port;
|
2023-09-13 09:59:21 +00:00
|
|
|
|
Name = name;
|
2023-09-13 09:25:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MetricsScrapeTarget(RunningContainer container, int port)
|
2023-09-13 09:59:21 +00:00
|
|
|
|
: this(container.Pod.PodInfo.Ip, port, container.Name)
|
2023-09-13 09:25:08 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MetricsScrapeTarget(RunningContainer container, Port port)
|
|
|
|
|
: this(container, port.Number)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 09:59:21 +00:00
|
|
|
|
public string Name { get; }
|
2023-09-13 09:25:08 +00:00
|
|
|
|
public string Ip { get; }
|
|
|
|
|
public int Port { get; }
|
|
|
|
|
}
|
|
|
|
|
}
|