feat: expand mqtt varz monitoring with all Go-compatible fields
This commit is contained in:
@@ -355,8 +355,29 @@ public sealed class MqttOptsVarz
|
||||
[JsonPropertyName("port")]
|
||||
public int Port { get; set; }
|
||||
|
||||
[JsonPropertyName("no_auth_user")]
|
||||
public string NoAuthUser { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("auth_timeout")]
|
||||
public double AuthTimeout { get; set; }
|
||||
|
||||
[JsonPropertyName("tls_map")]
|
||||
public bool TlsMap { get; set; }
|
||||
|
||||
[JsonPropertyName("tls_timeout")]
|
||||
public double TlsTimeout { get; set; }
|
||||
|
||||
[JsonPropertyName("tls_pinned_certs")]
|
||||
public string[] TlsPinnedCerts { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("js_domain")]
|
||||
public string JsDomain { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("ack_wait")]
|
||||
public long AckWait { get; set; }
|
||||
|
||||
[JsonPropertyName("max_ack_pending")]
|
||||
public ushort MaxAckPending { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -121,6 +121,7 @@ public sealed class VarzHandler : IDisposable
|
||||
Subscriptions = _server.SubList.Count,
|
||||
ConfigLoadTime = _server.StartTime,
|
||||
HttpReqStats = stats.HttpReqStats.ToDictionary(kv => kv.Key, kv => (ulong)kv.Value),
|
||||
Mqtt = BuildMqttVarz(),
|
||||
};
|
||||
}
|
||||
finally
|
||||
@@ -134,6 +135,27 @@ public sealed class VarzHandler : IDisposable
|
||||
_varzMu.Dispose();
|
||||
}
|
||||
|
||||
private MqttOptsVarz BuildMqttVarz()
|
||||
{
|
||||
var mqtt = _options.Mqtt;
|
||||
if (mqtt is null)
|
||||
return new MqttOptsVarz();
|
||||
|
||||
return new MqttOptsVarz
|
||||
{
|
||||
Host = mqtt.Host,
|
||||
Port = mqtt.Port,
|
||||
NoAuthUser = mqtt.NoAuthUser ?? "",
|
||||
AuthTimeout = mqtt.AuthTimeout,
|
||||
TlsMap = mqtt.TlsMap,
|
||||
TlsTimeout = mqtt.TlsTimeout,
|
||||
TlsPinnedCerts = mqtt.TlsPinnedCerts?.ToArray() ?? [],
|
||||
JsDomain = mqtt.JsDomain ?? "",
|
||||
AckWait = (long)mqtt.AckWait.TotalNanoseconds,
|
||||
MaxAckPending = mqtt.MaxAckPending,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a TimeSpan as a human-readable uptime string matching Go server format.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user