Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uptime_in_* format as an integer #211

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions libs/server/Metrics/Info/GarnetInfoMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ public GarnetInfoMetrics() { }
private void PopulateServerInfo(StoreWrapper storeWrapper)
{
var uptime = TimeSpan.FromTicks(DateTimeOffset.UtcNow.Ticks - storeWrapper.startupTime);
var integerFormat = string.Format("{0}{1}", "F", "0");
var uptime_in_seconds = uptime.TotalSeconds.ToString(integerFormat);
var uptime_in_days = uptime.TotalDays.ToString(integerFormat);

serverInfo =
[
new("garnet_version", storeWrapper.version),
new("garnet_mode", storeWrapper.serverOptions.EnableCluster ? "cluster" : "standalone"),
new("os", Environment.OSVersion.ToString()),
new("processor_count", Environment.ProcessorCount.ToString()),
new("arch_bits", Environment.Is64BitProcess ? "64" : "32"),
new("uptime_in_seconds", uptime.TotalSeconds.ToString()),
new("uptime_in_days", uptime.TotalDays.ToString()),
new("uptime_in_seconds", uptime_in_seconds),
new("uptime_in_days", uptime_in_days),
new("monitor_task", storeWrapper.serverOptions.MetricsSamplingFrequency > 0 ? "enabled" : "disabled"),
new("monitor_freq", storeWrapper.serverOptions.MetricsSamplingFrequency.ToString()),
new("latency_monitor", storeWrapper.serverOptions.LatencyMonitor ? "enabled" : "disabled"),
Expand Down