2023-06-21 08:28:40 +02:00
|
|
|
|
namespace Utils
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Address
|
|
|
|
|
|
{
|
2025-01-15 15:00:25 +01:00
|
|
|
|
public Address(string logName, string host, int port)
|
2023-06-21 08:28:40 +02:00
|
|
|
|
{
|
2025-01-15 15:00:25 +01:00
|
|
|
|
LogName = logName;
|
2023-06-21 08:28:40 +02:00
|
|
|
|
Host = host;
|
|
|
|
|
|
Port = port;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-15 15:00:25 +01:00
|
|
|
|
public string LogName { get; }
|
2023-06-21 08:28:40 +02:00
|
|
|
|
public string Host { get; }
|
|
|
|
|
|
public int Port { get; }
|
2023-10-19 11:18:59 +02:00
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return $"{Host}:{Port}";
|
|
|
|
|
|
}
|
2023-10-23 15:28:20 +02:00
|
|
|
|
|
|
|
|
|
|
public bool IsValid()
|
|
|
|
|
|
{
|
|
|
|
|
|
return !string.IsNullOrEmpty(Host) && Port > 0;
|
|
|
|
|
|
}
|
2025-01-16 15:13:16 +01:00
|
|
|
|
|
|
|
|
|
|
public static Address Empty()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Address(string.Empty, string.Empty, 0);
|
|
|
|
|
|
}
|
2023-06-21 08:28:40 +02:00
|
|
|
|
}
|
2025-01-16 15:13:16 +01:00
|
|
|
|
|
|
|
|
|
|
public interface IHasMetricsScrapeTarget
|
|
|
|
|
|
{
|
|
|
|
|
|
Address GetMetricsScrapeTarget();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public interface IHasManyMetricScrapeTargets
|
|
|
|
|
|
{
|
|
|
|
|
|
Address[] GetMetricsScrapeTargets();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-21 08:28:40 +02:00
|
|
|
|
}
|