summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fixtures/Host.Boots.HTML.expected31
-rw-r--r--fixtures/Host.Downtime.HTML.expected31
-rw-r--r--fixtures/Host.Lifespan.HTML.expected31
-rw-r--r--fixtures/Host.Score.HTML.expected31
-rw-r--r--fixtures/Host.Uptime.HTML.expected31
-rw-r--r--fixtures/Kernel.Boots.HTML.expected31
-rw-r--r--fixtures/Kernel.Score.HTML.expected31
-rw-r--r--fixtures/Kernel.Uptime.HTML.expected31
-rw-r--r--fixtures/KernelMajor.Boots.HTML.expected31
-rw-r--r--fixtures/KernelMajor.Score.HTML.expected31
-rw-r--r--fixtures/KernelMajor.Uptime.HTML.expected31
-rw-r--r--fixtures/KernelName.Boots.HTML.expected31
-rw-r--r--fixtures/KernelName.Score.HTML.expected31
-rw-r--r--fixtures/KernelName.Uptime.HTML.expected31
-rw-r--r--internal/daemon/daemon_test.go2
-rw-r--r--internal/goprecords/report.go132
-rw-r--r--internal/goprecords/report_format.go71
-rw-r--r--internal/goprecords/report_test.go4
-rw-r--r--internal/version/version.go2
19 files changed, 266 insertions, 379 deletions
diff --git a/fixtures/Host.Boots.HTML.expected b/fixtures/Host.Boots.HTML.expected
index eb11339..0aeb36c 100644
--- a/fixtures/Host.Boots.HTML.expected
+++ b/fixtures/Host.Boots.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Boots&#39;s by Host</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Boots&#39;s by Host</h1><br />
-<br />
-<span class="quote">Boots is the total number of host boots over the entire lifespan.</span><br />
-<br />
-<pre>+-----+----------------+-------+-----------------------------+------------------+
-| Pos | Host | Boots | Last Kernel | Updated |
-+-----+----------------+-------+-----------------------------+------------------+
-| 1. | alphacentauri | 671 | FreeBSD 11.4-RELEASE-p7 | 2026-03-03 18:29 |
-| 2. | mars | 207 | Linux 3.2.0-4-amd64 | 2026-03-03 18:29 |
-| 3. | callisto | 153 | Linux 4.0.4-303.fc22.x86_64 | 2026-03-03 18:29 |
-+-----+----------------+-------+-----------------------------+------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Boots&#39;s by Host</h1>
+<p>Boots is the total number of host boots over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>Host</th><th>Boots</th><th>Last Kernel</th><th>Updated</th></tr>
+<tr><td>1.</td><td> alphacentauri</td><td>671</td><td>FreeBSD 11.4-RELEASE-p7</td><td>2026-03-03 18:29</td></tr>
+<tr><td>2.</td><td> mars</td><td>207</td><td>Linux 3.2.0-4-amd64</td><td>2026-03-03 18:29</td></tr>
+<tr><td>3.</td><td> callisto</td><td>153</td><td>Linux 4.0.4-303.fc22.x86_64</td><td>2026-03-03 18:29</td></tr>
+</table>
diff --git a/fixtures/Host.Downtime.HTML.expected b/fixtures/Host.Downtime.HTML.expected
index 020f638..217681c 100644
--- a/fixtures/Host.Downtime.HTML.expected
+++ b/fixtures/Host.Downtime.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Downtime&#39;s by Host</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Downtime&#39;s by Host</h1><br />
-<br />
-<span class="quote">Downtime is the total downtime of a host over the entire lifespan.</span><br />
-<br />
-<pre>+-----+----------------+-----------------------------+--------------------------+------------------+
-| Pos | Host | Downtime | Last Kernel | Updated |
-+-----+----------------+-----------------------------+--------------------------+------------------+
-| 1. | dionysus | 8 years, 3 months, 16 days | FreeBSD 13.0-RELEASE-p11 | 2026-03-03 18:29 |
-| 2. | alphacentauri | 5 years, 11 months, 18 days | FreeBSD 11.4-RELEASE-p7 | 2026-03-03 18:29 |
-| 3. | uranus | 3 years, 3 months, 28 days | Linux 5.16.14-arch1-1 | 2026-03-03 18:29 |
-+-----+----------------+-----------------------------+--------------------------+------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Downtime&#39;s by Host</h1>
+<p>Downtime is the total downtime of a host over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>Host</th><th>Downtime</th><th>Last Kernel</th><th>Updated</th></tr>
+<tr><td>1.</td><td> dionysus</td><td>8 years, 3 months, 16 days</td><td>FreeBSD 13.0-RELEASE-p11</td><td>2026-03-03 18:29</td></tr>
+<tr><td>2.</td><td> alphacentauri</td><td>5 years, 11 months, 18 days</td><td>FreeBSD 11.4-RELEASE-p7</td><td>2026-03-03 18:29</td></tr>
+<tr><td>3.</td><td> uranus</td><td>3 years, 3 months, 28 days</td><td>Linux 5.16.14-arch1-1</td><td>2026-03-03 18:29</td></tr>
+</table>
diff --git a/fixtures/Host.Lifespan.HTML.expected b/fixtures/Host.Lifespan.HTML.expected
index a73bc82..b380381 100644
--- a/fixtures/Host.Lifespan.HTML.expected
+++ b/fixtures/Host.Lifespan.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Lifespan&#39;s by Host</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Lifespan&#39;s by Host</h1><br />
-<br />
-<span class="quote">Lifespan is the total uptime + the total downtime of a host.</span><br />
-<br />
-<pre>+-----+----------------+----------------------------+--------------------------+------------------+
-| Pos | Host | Lifespan | Last Kernel | Updated |
-+-----+----------------+----------------------------+--------------------------+------------------+
-| 1. | dionysus | 8 years, 6 months, 17 days | FreeBSD 13.0-RELEASE-p11 | 2026-03-03 18:29 |
-| 2. | uranus | 7 years, 2 months, 16 days | Linux 5.16.14-arch1-1 | 2026-03-03 18:29 |
-| 3. | alphacentauri | 6 years, 9 months, 13 days | FreeBSD 11.4-RELEASE-p7 | 2026-03-03 18:29 |
-+-----+----------------+----------------------------+--------------------------+------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Lifespan&#39;s by Host</h1>
+<p>Lifespan is the total uptime + the total downtime of a host.</p>
+<table>
+<tr><th>Pos</th><th>Host</th><th>Lifespan</th><th>Last Kernel</th><th>Updated</th></tr>
+<tr><td>1.</td><td> dionysus</td><td>8 years, 6 months, 17 days</td><td>FreeBSD 13.0-RELEASE-p11</td><td>2026-03-03 18:29</td></tr>
+<tr><td>2.</td><td> uranus</td><td>7 years, 2 months, 16 days</td><td>Linux 5.16.14-arch1-1</td><td>2026-03-03 18:29</td></tr>
+<tr><td>3.</td><td> alphacentauri</td><td>6 years, 9 months, 13 days</td><td>FreeBSD 11.4-RELEASE-p7</td><td>2026-03-03 18:29</td></tr>
+</table>
diff --git a/fixtures/Host.Score.HTML.expected b/fixtures/Host.Score.HTML.expected
index c13e4a6..7b7d33f 100644
--- a/fixtures/Host.Score.HTML.expected
+++ b/fixtures/Host.Score.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Score&#39;s by Host</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Score&#39;s by Host</h1><br />
-<br />
-<span class="quote">Score is calculated by combining all other metrics.</span><br />
-<br />
-<pre>+-----+---------+-------+-----------------------------------+------------------+
-| Pos | Host | Score | Last Kernel | Updated |
-+-----+---------+-------+-----------------------------------+------------------+
-| 1. | uranus | 309 | Linux 5.16.14-arch1-1 | 2026-03-03 18:29 |
-| 2. | vulcan | 270 | Linux 3.10.0-1160.81.1.el7.x86_64 | 2026-03-03 18:29 |
-| 3. | sun | 238 | FreeBSD 10.3-RELEASE-p24 | 2026-03-03 18:29 |
-+-----+---------+-------+-----------------------------------+------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Score&#39;s by Host</h1>
+<p>Score is calculated by combining all other metrics.</p>
+<table>
+<tr><th>Pos</th><th>Host</th><th>Score</th><th>Last Kernel</th><th>Updated</th></tr>
+<tr><td>1.</td><td> uranus</td><td>309</td><td>Linux 5.16.14-arch1-1</td><td>2026-03-03 18:29</td></tr>
+<tr><td>2.</td><td> vulcan</td><td>270</td><td>Linux 3.10.0-1160.81.1.el7.x86_64</td><td>2026-03-03 18:29</td></tr>
+<tr><td>3.</td><td> sun</td><td>238</td><td>FreeBSD 10.3-RELEASE-p24</td><td>2026-03-03 18:29</td></tr>
+</table>
diff --git a/fixtures/Host.Uptime.HTML.expected b/fixtures/Host.Uptime.HTML.expected
index 7c00ced..e78ebbf 100644
--- a/fixtures/Host.Uptime.HTML.expected
+++ b/fixtures/Host.Uptime.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Uptime&#39;s by Host</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Uptime&#39;s by Host</h1><br />
-<br />
-<span class="quote">Uptime is the total uptime of a host over the entire lifespan.</span><br />
-<br />
-<pre>+-----+---------+-----------------------------+-----------------------------------+------------------+
-| Pos | Host | Uptime | Last Kernel | Updated |
-+-----+---------+-----------------------------+-----------------------------------+------------------+
-| 1. | vulcan | 4 years, 4 months, 7 days | Linux 3.10.0-1160.81.1.el7.x86_64 | 2026-03-03 18:29 |
-| 2. | uranus | 3 years, 11 months, 21 days | Linux 5.16.14-arch1-1 | 2026-03-03 18:29 |
-| 3. | sun | 3 years, 9 months, 26 days | FreeBSD 10.3-RELEASE-p24 | 2026-03-03 18:29 |
-+-----+---------+-----------------------------+-----------------------------------+------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Uptime&#39;s by Host</h1>
+<p>Uptime is the total uptime of a host over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>Host</th><th>Uptime</th><th>Last Kernel</th><th>Updated</th></tr>
+<tr><td>1.</td><td> vulcan</td><td>4 years, 4 months, 7 days</td><td>Linux 3.10.0-1160.81.1.el7.x86_64</td><td>2026-03-03 18:29</td></tr>
+<tr><td>2.</td><td> uranus</td><td>3 years, 11 months, 21 days</td><td>Linux 5.16.14-arch1-1</td><td>2026-03-03 18:29</td></tr>
+<tr><td>3.</td><td> sun</td><td>3 years, 9 months, 26 days</td><td>FreeBSD 10.3-RELEASE-p24</td><td>2026-03-03 18:29</td></tr>
+</table>
diff --git a/fixtures/Kernel.Boots.HTML.expected b/fixtures/Kernel.Boots.HTML.expected
index 273b982..4e23932 100644
--- a/fixtures/Kernel.Boots.HTML.expected
+++ b/fixtures/Kernel.Boots.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Boots&#39;s by Kernel</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Boots&#39;s by Kernel</h1><br />
-<br />
-<span class="quote">Boots is the total number of host boots over the entire lifespan.</span><br />
-<br />
-<pre>+-----+------------------------------+-------+
-| Pos | Kernel | Boots |
-+-----+------------------------------+-------+
-| 1. | Linux 3.2.0-4-amd64 | 321 |
-| 2. | Linux 4.0.4-303.fc22.x86_64 | 103 |
-| 3. | FreeBSD 10.1-RELEASE | 76 |
-+-----+------------------------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Boots&#39;s by Kernel</h1>
+<p>Boots is the total number of host boots over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>Kernel</th><th>Boots</th></tr>
+<tr><td>1.</td><td> Linux 3.2.0-4-amd64</td><td>321</td></tr>
+<tr><td>2.</td><td> Linux 4.0.4-303.fc22.x86_64</td><td>103</td></tr>
+<tr><td>3.</td><td> FreeBSD 10.1-RELEASE</td><td>76</td></tr>
+</table>
diff --git a/fixtures/Kernel.Score.HTML.expected b/fixtures/Kernel.Score.HTML.expected
index fcf8e3c..01d0888 100644
--- a/fixtures/Kernel.Score.HTML.expected
+++ b/fixtures/Kernel.Score.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Score&#39;s by Kernel</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Score&#39;s by Kernel</h1><br />
-<br />
-<span class="quote">Score is calculated by combining all other metrics.</span><br />
-<br />
-<pre>+-----+------------------------------------+-------+
-| Pos | Kernel | Score |
-+-----+------------------------------------+-------+
-| 1. | Linux 3.2.0-4-amd64 | 241 |
-| 2. | Linux 3.10.0-1160.15.2.el7.x86_64 | 123 |
-| 3. | Linux 3.10.0-957.21.3.el7.x86_64 | 96 |
-+-----+------------------------------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Score&#39;s by Kernel</h1>
+<p>Score is calculated by combining all other metrics.</p>
+<table>
+<tr><th>Pos</th><th>Kernel</th><th>Score</th></tr>
+<tr><td>1.</td><td> Linux 3.2.0-4-amd64</td><td>241</td></tr>
+<tr><td>2.</td><td> Linux 3.10.0-1160.15.2.el7.x86_64</td><td>123</td></tr>
+<tr><td>3.</td><td> Linux 3.10.0-957.21.3.el7.x86_64</td><td>96</td></tr>
+</table>
diff --git a/fixtures/Kernel.Uptime.HTML.expected b/fixtures/Kernel.Uptime.HTML.expected
index a374352..ce9d94a 100644
--- a/fixtures/Kernel.Uptime.HTML.expected
+++ b/fixtures/Kernel.Uptime.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Uptime&#39;s by Kernel</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Uptime&#39;s by Kernel</h1><br />
-<br />
-<span class="quote">Uptime is the total uptime of a host over the entire lifespan.</span><br />
-<br />
-<pre>+-----+------------------------------------+-----------------------------+
-| Pos | Kernel | Uptime |
-+-----+------------------------------------+-----------------------------+
-| 1. | Linux 3.2.0-4-amd64 | 3 years, 5 months, 23 days |
-| 2. | Linux 3.10.0-1160.15.2.el7.x86_64 | 1 years, 12 months, 15 days |
-| 3. | Linux 3.10.0-957.21.3.el7.x86_64 | 1 years, 7 months, 13 days |
-+-----+------------------------------------+-----------------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Uptime&#39;s by Kernel</h1>
+<p>Uptime is the total uptime of a host over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>Kernel</th><th>Uptime</th></tr>
+<tr><td>1.</td><td> Linux 3.2.0-4-amd64</td><td>3 years, 5 months, 23 days</td></tr>
+<tr><td>2.</td><td> Linux 3.10.0-1160.15.2.el7.x86_64</td><td>1 years, 12 months, 15 days</td></tr>
+<tr><td>3.</td><td> Linux 3.10.0-957.21.3.el7.x86_64</td><td>1 years, 7 months, 13 days</td></tr>
+</table>
diff --git a/fixtures/KernelMajor.Boots.HTML.expected b/fixtures/KernelMajor.Boots.HTML.expected
index 55e626a..c54c058 100644
--- a/fixtures/KernelMajor.Boots.HTML.expected
+++ b/fixtures/KernelMajor.Boots.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Boots&#39;s by KernelMajor</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Boots&#39;s by KernelMajor</h1><br />
-<br />
-<span class="quote">Boots is the total number of host boots over the entire lifespan.</span><br />
-<br />
-<pre>+-----+----------------+-------+
-| Pos | KernelMajor | Boots |
-+-----+----------------+-------+
-| 1. | FreeBSD 10... | 551 |
-| 2. | Linux 3... | 410 |
-| 3. | Linux 5... | 249 |
-+-----+----------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Boots&#39;s by KernelMajor</h1>
+<p>Boots is the total number of host boots over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>KernelMajor</th><th>Boots</th></tr>
+<tr><td>1.</td><td> FreeBSD 10...</td><td>551</td></tr>
+<tr><td>2.</td><td> Linux 3...</td><td>410</td></tr>
+<tr><td>3.</td><td> Linux 5...</td><td>249</td></tr>
+</table>
diff --git a/fixtures/KernelMajor.Score.HTML.expected b/fixtures/KernelMajor.Score.HTML.expected
index ab5b6a6..116f74d 100644
--- a/fixtures/KernelMajor.Score.HTML.expected
+++ b/fixtures/KernelMajor.Score.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Score&#39;s by KernelMajor</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Score&#39;s by KernelMajor</h1><br />
-<br />
-<span class="quote">Score is calculated by combining all other metrics.</span><br />
-<br />
-<pre>+-----+----------------+-------+
-| Pos | KernelMajor | Score |
-+-----+----------------+-------+
-| 1. | Linux 3... | 736 |
-| 2. | FreeBSD 10... | 406 |
-| 3. | Linux 5... | 268 |
-+-----+----------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Score&#39;s by KernelMajor</h1>
+<p>Score is calculated by combining all other metrics.</p>
+<table>
+<tr><th>Pos</th><th>KernelMajor</th><th>Score</th></tr>
+<tr><td>1.</td><td> Linux 3...</td><td>736</td></tr>
+<tr><td>2.</td><td> FreeBSD 10...</td><td>406</td></tr>
+<tr><td>3.</td><td> Linux 5...</td><td>268</td></tr>
+</table>
diff --git a/fixtures/KernelMajor.Uptime.HTML.expected b/fixtures/KernelMajor.Uptime.HTML.expected
index dd08ee3..848e2ff 100644
--- a/fixtures/KernelMajor.Uptime.HTML.expected
+++ b/fixtures/KernelMajor.Uptime.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Uptime&#39;s by KernelMajor</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Uptime&#39;s by KernelMajor</h1><br />
-<br />
-<span class="quote">Uptime is the total uptime of a host over the entire lifespan.</span><br />
-<br />
-<pre>+-----+----------------+-----------------------------+
-| Pos | KernelMajor | Uptime |
-+-----+----------------+-----------------------------+
-| 1. | Linux 3... | 11 years, 2 months, 11 days |
-| 2. | FreeBSD 10... | 5 years, 9 months, 9 days |
-| 3. | Linux 5... | 3 years, 12 months, 2 days |
-+-----+----------------+-----------------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Uptime&#39;s by KernelMajor</h1>
+<p>Uptime is the total uptime of a host over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>KernelMajor</th><th>Uptime</th></tr>
+<tr><td>1.</td><td> Linux 3...</td><td>11 years, 2 months, 11 days</td></tr>
+<tr><td>2.</td><td> FreeBSD 10...</td><td>5 years, 9 months, 9 days</td></tr>
+<tr><td>3.</td><td> Linux 5...</td><td>3 years, 12 months, 2 days</td></tr>
+</table>
diff --git a/fixtures/KernelName.Boots.HTML.expected b/fixtures/KernelName.Boots.HTML.expected
index 6685f18..e984d77 100644
--- a/fixtures/KernelName.Boots.HTML.expected
+++ b/fixtures/KernelName.Boots.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Boots&#39;s by KernelName</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Boots&#39;s by KernelName</h1><br />
-<br />
-<span class="quote">Boots is the total number of host boots over the entire lifespan.</span><br />
-<br />
-<pre>+-----+------------+-------+
-| Pos | KernelName | Boots |
-+-----+------------+-------+
-| 1. | FreeBSD | 872 |
-| 2. | Linux | 867 |
-| 3. | OpenBSD | 44 |
-+-----+------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Boots&#39;s by KernelName</h1>
+<p>Boots is the total number of host boots over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>KernelName</th><th>Boots</th></tr>
+<tr><td>1.</td><td> FreeBSD</td><td>872</td></tr>
+<tr><td>2.</td><td> Linux</td><td>867</td></tr>
+<tr><td>3.</td><td> OpenBSD</td><td>44</td></tr>
+</table>
diff --git a/fixtures/KernelName.Score.HTML.expected b/fixtures/KernelName.Score.HTML.expected
index 1f1a665..79fd8b9 100644
--- a/fixtures/KernelName.Score.HTML.expected
+++ b/fixtures/KernelName.Score.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Score&#39;s by KernelName</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Score&#39;s by KernelName</h1><br />
-<br />
-<span class="quote">Score is calculated by combining all other metrics.</span><br />
-<br />
-<pre>+-----+------------+-------+
-| Pos | KernelName | Score |
-+-----+------------+-------+
-| 1. | Linux | 1292 |
-| 2. | FreeBSD | 700 |
-| 3. | OpenBSD | 196 |
-+-----+------------+-------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Score&#39;s by KernelName</h1>
+<p>Score is calculated by combining all other metrics.</p>
+<table>
+<tr><th>Pos</th><th>KernelName</th><th>Score</th></tr>
+<tr><td>1.</td><td> Linux</td><td>1292</td></tr>
+<tr><td>2.</td><td> FreeBSD</td><td>700</td></tr>
+<tr><td>3.</td><td> OpenBSD</td><td>196</td></tr>
+</table>
diff --git a/fixtures/KernelName.Uptime.HTML.expected b/fixtures/KernelName.Uptime.HTML.expected
index 345b33f..353b63f 100644
--- a/fixtures/KernelName.Uptime.HTML.expected
+++ b/fixtures/KernelName.Uptime.HTML.expected
@@ -1,23 +1,8 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<link rel="shortcut icon" type="image/gif" href="https://foo.zone/favicon.ico" />
-<link rel="stylesheet" href="https://foo.zone/style.css" />
-<title>Top 3 Uptime&#39;s by KernelName</title>
-</head>
-<body>
-<h1 style="display: inline">Top 3 Uptime&#39;s by KernelName</h1><br />
-<br />
-<span class="quote">Uptime is the total uptime of a host over the entire lifespan.</span><br />
-<br />
-<pre>+-----+------------+-----------------------------+
-| Pos | KernelName | Uptime |
-+-----+------------+-----------------------------+
-| 1. | Linux | 19 years, 4 months, 18 days |
-| 2. | FreeBSD | 9 years, 11 months, 29 days |
-| 3. | OpenBSD | 3 years, 1 months, 18 days |
-+-----+------------+-----------------------------+
-</pre>
-</body>
-</html>
+<h1>Top 3 Uptime&#39;s by KernelName</h1>
+<p>Uptime is the total uptime of a host over the entire lifespan.</p>
+<table>
+<tr><th>Pos</th><th>KernelName</th><th>Uptime</th></tr>
+<tr><td>1.</td><td> Linux</td><td>19 years, 4 months, 18 days</td></tr>
+<tr><td>2.</td><td> FreeBSD</td><td>9 years, 11 months, 29 days</td></tr>
+<tr><td>3.</td><td> OpenBSD</td><td>3 years, 1 months, 18 days</td></tr>
+</table>
diff --git a/internal/daemon/daemon_test.go b/internal/daemon/daemon_test.go
index 44f9888..5d642b6 100644
--- a/internal/daemon/daemon_test.go
+++ b/internal/daemon/daemon_test.go
@@ -312,7 +312,7 @@ func TestReportHTTPTable(t *testing.T) {
query: "OutputFormat=HTML&limit=2",
wantCode: http.StatusOK,
wantCTPfx: "text/html",
- bodyNeedle: []string{"<!DOCTYPE html>", "<pre>"},
+ bodyNeedle: []string{"<!DOCTYPE html>", "<table>"},
},
{
name: "gemtext",
diff --git a/internal/goprecords/report.go b/internal/goprecords/report.go
index 12c3951..8916caa 100644
--- a/internal/goprecords/report.go
+++ b/internal/goprecords/report.go
@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"sort"
+ "strings"
)
type metricExtractor struct {
@@ -61,38 +62,33 @@ func WriteReports(w io.Writer, aggregates *Aggregates, cfg ReportConfig) error {
if cfg.Category != CategoryHost && (cfg.Metric == MetricDowntime || cfg.Metric == MetricLifespan) {
return fmt.Errorf("Category %s only supports: Boots, Uptime, Score", cfg.Category)
}
- if cfg.Category == CategoryHost {
- if err := writeReportString(w, NewHostReporter(aggregates, cfg.Limit, cfg.Metric, cfg.OutputFormat, 1).Report()); err != nil {
- return err
- }
- } else {
- if err := writeReportString(w, NewReporter(aggregates, cfg.Category, cfg.Limit, cfg.Metric, cfg.OutputFormat, 1).Report()); err != nil {
- return err
- }
- }
- return nil
+ s := reportForPair(aggregates, cfg.Category, cfg.Metric, cfg.Limit, 1, cfg.OutputFormat)
+ return writeReportString(w, wrapIfHTML(s, cfg.OutputFormat))
}
order, err := StatsOrderList(cfg.StatsOrder)
if err != nil {
return err
}
headerIndent := uint(2)
- for _, pair := range order {
- c, m := pair.Category, pair.Metric
- if !cfg.IncludeKernel && c == CategoryKernel {
- continue
+ if cfg.OutputFormat == FormatHTML {
+ var parts []string
+ for _, pair := range order {
+ if skipPair(cfg, pair.Category, pair.Metric) {
+ continue
+ }
+ if s := reportForPair(aggregates, pair.Category, pair.Metric, cfg.Limit, headerIndent, cfg.OutputFormat); s != "" {
+ parts = append(parts, s)
+ }
}
- if c != CategoryHost && (m == MetricDowntime || m == MetricLifespan) {
+ return writeReportString(w, wrapHTMLDocument(strings.Join(parts, "\n")))
+ }
+ for _, pair := range order {
+ if skipPair(cfg, pair.Category, pair.Metric) {
continue
}
- if c == CategoryHost {
- if err := writeReportString(w, NewHostReporter(aggregates, cfg.Limit, m, cfg.OutputFormat, headerIndent).Report()); err != nil {
- return err
- }
- } else {
- if err := writeReportString(w, NewReporter(aggregates, c, cfg.Limit, m, cfg.OutputFormat, headerIndent).Report()); err != nil {
- return err
- }
+ s := reportForPair(aggregates, pair.Category, pair.Metric, cfg.Limit, headerIndent, cfg.OutputFormat)
+ if err := writeReportString(w, s); err != nil {
+ return err
}
if err := writeReportString(w, "\n"); err != nil {
return err
@@ -101,6 +97,96 @@ func WriteReports(w io.Writer, aggregates *Aggregates, cfg ReportConfig) error {
return nil
}
+func reportForPair(aggregates *Aggregates, c Category, m Metric, limit, headerIndent uint, outputFormat OutputFormat) string {
+ if c == CategoryHost {
+ return NewHostReporter(aggregates, limit, m, outputFormat, headerIndent).Report()
+ }
+ return NewReporter(aggregates, c, limit, m, outputFormat, headerIndent).Report()
+}
+
+func skipPair(cfg ReportConfig, c Category, m Metric) bool {
+ if !cfg.IncludeKernel && c == CategoryKernel {
+ return true
+ }
+ if c != CategoryHost && (m == MetricDowntime || m == MetricLifespan) {
+ return true
+ }
+ return false
+}
+
+func wrapIfHTML(s string, f OutputFormat) string {
+ if f != FormatHTML {
+ return s
+ }
+ return wrapHTMLDocument(s)
+}
+
+func wrapHTMLDocument(body string) string {
+ var b strings.Builder
+ b.WriteString("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n")
+ b.WriteString("<meta charset=\"UTF-8\">\n")
+ b.WriteString("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n")
+ b.WriteString("<title>goprecords uptime report</title>\n")
+ b.WriteString(htmlStyle)
+ b.WriteString("</head>\n<body>\n")
+ b.WriteString(body)
+ b.WriteString("</body>\n</html>\n")
+ return b.String()
+}
+
+const htmlStyle = `<style>
+ /* Compact, full-width layout */
+ :root {
+ --pad: 8px;
+ }
+ html, body {
+ height: 100%;
+ }
+ body {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
+ line-height: 1.3;
+ margin: 0;
+ padding: var(--pad);
+ background: #fff;
+ color: #000;
+ }
+ /* Headings: smaller and tighter */
+ h1, h2, h3 { margin: 0.5em 0 0.25em; font-weight: 600; }
+ h1 { font-size: 1em; }
+ h2 { font-size: 0.95em; }
+ h3 { font-size: 0.9em; }
+ /* Paragraphs and lists: minimal vertical rhythm */
+ p { margin: 0.2em 0; }
+ ul { margin: 0.3em 0; padding-left: 1.2em; }
+ li { margin: 0.1em 0; }
+ /* Code blocks and tables */
+ pre {
+ overflow-x: auto;
+ white-space: pre;
+ margin: 0.3em 0;
+ }
+ table {
+ border-collapse: collapse;
+ table-layout: auto; /* size columns by content */
+ width: auto; /* do not stretch to full width */
+ max-width: 100%;
+ margin: 0.5em 0;
+ font-size: 0.95em;
+ display: inline-table; /* keep as compact as content allows */
+ }
+ th, td {
+ padding: 0.1em 0.3em;
+ text-align: left;
+ white-space: nowrap; /* avoid wide columns caused by wrapping */
+ }
+ /* Links */
+ a { color: #06c; text-decoration: underline; }
+ a:visited { color: #639; }
+ /* Rules */
+ hr { border: none; border-top: 1px solid #ccc; margin: 0.5em 0; }
+ </style>
+`
+
func writeReportString(w io.Writer, s string) error {
_, err := io.WriteString(w, s)
return err
diff --git a/internal/goprecords/report_format.go b/internal/goprecords/report_format.go
index 8d06b04..079fe94 100644
--- a/internal/goprecords/report_format.go
+++ b/