aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-08-29 12:49:09 -0500
committerJP Dillingham <jp@dillingham.me>2022-08-29 12:49:09 -0500
commit564111ea20a5cea831879fefcff9d5a84de31663 (patch)
tree73b569f280c61a5031c4a6da9c7f5a37ef0e461f /src
parent0085fa79cbe0b2589abc9ca6a99c367ff5ff0fd5 (diff)
downloadslskd-564111ea20a5cea831879fefcff9d5a84de31663.tar.gz
add Metrics options
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Options.cs82
1 files changed, 73 insertions, 9 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index bb525003..6a435db1 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -236,6 +236,13 @@ namespace slskd
public LoggerOptions Logger { get; init; } = new LoggerOptions();
/// <summary>
+ /// Gets metrics options.
+ /// </summary>
+ [Validate]
+ [RequiresRestart]
+ public MetricsOptions Metrics { get; init; } = new MetricsOptions();
+
+ /// <summary>
/// Gets feature options.
/// </summary>
[Validate]
@@ -623,15 +630,6 @@ namespace slskd
public class FeatureOptions
{
/// <summary>
- /// Gets a value indicating whether prometheus metrics should be collected and published.
- /// </summary>
- [Argument(default, "prometheus")]
- [EnvironmentVariable("PROMETHEUS")]
- [Description("enable collection and publishing of prometheus metrics")]
- [RequiresRestart]
- public bool Prometheus { get; init; } = false;
-
- /// <summary>
/// Gets a value indicating whether swagger documentation and UI should be enabled.
/// </summary>
[Argument(default, "swagger")]
@@ -731,6 +729,72 @@ namespace slskd
}
/// <summary>
+ /// Metrics options.
+ /// </summary>
+ public class MetricsOptions
+ {
+ /// <summary>
+ /// Gets a value indicating whether the metrics endpoint should be enabled.
+ /// </summary>
+ [Argument(default, "metrics")]
+ [EnvironmentVariable("METRICS")]
+ [Description("enable metrics")]
+ [RequiresRestart]
+ public bool Enabled { get; init; } = false;
+
+ /// <summary>
+ /// Gets the url for the metrics endpoint.
+ /// </summary>
+ [Argument(default, "metrics-url")]
+ [EnvironmentVariable("METRICS_URL")]
+ [Description("url for metrics")]
+ [RequiresRestart]
+ public string Url { get; init; } = "/metrics";
+
+ /// <summary>
+ /// Gets metrics endpoint authentication options.
+ /// </summary>
+ [Validate]
+ public AuthenticationOptions Authentication { get; init; } = new AuthenticationOptions();
+
+ /// <summary>
+ /// Metrics endpoint authentication options.
+ /// </summary>
+ public class AuthenticationOptions
+ {
+ /// <summary>
+ /// Gets a value indicating whether authentication should be disabled.
+ /// </summary>
+ [Argument(default, "metrics-no-auth")]
+ [EnvironmentVariable("METRICS_NO_AUTH")]
+ [Description("disable authentication for metrics requests")]
+ [RequiresRestart]
+ public bool Disabled { get; init; } = false;
+
+ /// <summary>
+ /// Gets the username for the metrics endpoint.
+ /// </summary>
+ [Argument(default, "metrics-username")]
+ [EnvironmentVariable("METRICS_USERNAME")]
+ [Description("username for metrics")]
+ [StringLength(255, MinimumLength = 1)]
+ [RequiresRestart]
+ public string Username { get; init; } = Program.AppName;
+
+ /// <summary>
+ /// Gets the password for the metrics endpoint.
+ /// </summary>
+ [Argument(default, "metrics-password")]
+ [EnvironmentVariable("METRICS_PASSWORD")]
+ [Description("password for metrics")]
+ [StringLength(255, MinimumLength = 1)]
+ [Secret]
+ [RequiresRestart]
+ public string Password { get; init; } = Program.AppName;
+ }
+ }
+
+ /// <summary>
/// Soulseek client options.
/// </summary>
public class SoulseekOptions