Post about Service Status

This commit is contained in:
~lucidiot 2024-03-10 17:53:37 +01:00
parent 2644f596f2
commit 8543240e54
1 changed files with 75 additions and 0 deletions

View File

@ -15,6 +15,7 @@
xmlns:icbm="http://postneo.com/icbm"
xmlns:nhc="https://www.nhc.noaa.gov"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ss="http://purl.org/rss/1.0/modules/servicestatus/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:webfeeds="http://webfeeds.org/rss/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@ -27,6 +28,7 @@
http://www.opengis.net/gml https://schemas.opengis.net/georss/1.0/schema-1.1/gmlgeorss.xsd
http://postneo.com/icbm xsd/icbm.xsd
https://www.nhc.noaa.gov xsd/nhc.xsd
http://purl.org/rss/1.0/modules/servicestatus/ xsd/servicestatus.xsd
http://purl.org/rss/1.0/modules/syndication/ xsd/syndication.xsd
http://webfeeds.org/rss/1.0 xsd/webfeeds.xsd
"
@ -53,6 +55,8 @@
<dc:format>application/rss+xml</dc:format>
<ss:aboutStats>https://envs.net/~lucidiot/rsrsss/feed.xml#servicestatus</ss:aboutStats>
<sy:updatePeriod>weekly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>1990-01-01T12:00+01:00</sy:updateBase>
@ -2385,6 +2389,77 @@ $ printf hunter2 | md5sum
<p>Anyway, I still do occasionally play with it nowadays. I found out that it was made by a French developer, and that the French forensics service got them to add more models, so you can now put shotguns in your houses! And most importantly of course, it has a blog with an <a href="https://www.sweethome3d.com/blog/rss.xml" target="_blank">RSS feed</a> and an <a href="https://www.sweethome3d.com/blog/atom.xml" target="_blank">Atom feed</a>.</p>
]]></description>
</item>
<item>
<title>Build a service status page as an RSS feed</title>
<pubDate>Sun, 10 Mar 2024 17:48:57 +0100</pubDate>
<guid isPermaLink="false">servicestatus</guid>
<category domain="https://envs.net/~lucidiot/rsrsss/">XSD</category>
<link>https://envs.net/~lucidiot/rsrsss/xsd/servicestatus.xsd</link>
<description><![CDATA[
<p>It is quite common nowadays for websites, or just any Internet-powered application or service, to have a webpage somewhere reporting on the status of said service, to the extent that many companies and other services exist just to provide those. Those status services often include e-mail alerts that you can subscribe to to get notified of an outage or a planned maintenance on the service. <a href="https://www.atlassian.com/software/statuspage" target="_blank">Statuspage</a> is one such service, one of the most well known due to it having been vored by Atlassian. Statuspage doesn't just provide e-mails though, it also has feeds! An <a href="https://metastatuspage.com/history.rss" target="_blank"><abbr title="Really Simple Syndication">RSS</abbr> feed</a> and an <a href="https://metastatuspage.com/history.atom" target="_blank">Atom feed</a> are available, providing a history of the planned maintenances or incidents.</p>
<p>Unfortunately, those feeds are annoying to deal with for machines. If you want to tell anything about the service's status somewhere else, scraping data from the feeds will be just as annoying, if not more, than the HTML document. We can do better though, and we have been able to do better for over twenty years.</p>
<p>The <a href="https://web.resource.org/rss/1.0/modules/servicestatus/" target="_blank"><abbr title="Resource Description Framework">RDF</abbr> Site Summary 1.0 Service Status module</a> is one of many forgotten extensions to <abbr title="RDF Site Summary">RSS</abbr> 1.0. In an incredible plot twist you could never expect from its name, it is meant to report on a service's status, and provides some extra XML elements to help with that.</p>
<figure>
<pre>&lt;rss
version="2.0"
xmlns:ss="http://purl.org/rss/1.0/modules/servicestatus/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://purl.org/rss/1.0/modules/servicestatus/
https://envs.net/~lucidiot/rsrsss/xsd/servicestatus.xsd
"
&gt;
&lt;channel&gt;
&lt;!-- ... --&gt;
&lt;ss:aboutStats&gt;https://envs.net/~lucidiot/rsrsss/feed.xml#servicestatus&lt;/ss:aboutStats&gt;
&lt;item&gt;
&lt;!-- ... --&gt;
&lt;ss:responding&gt;true&lt;/ss:responding&gt;
&lt;ss:lastChecked&gt;1970-01-01T00:00:00+00:00&lt;/ss:lastChecked&gt;
&lt;ss:lastSeen&gt;1970-01-01T00:00:00+00:00&lt;/ss:lastSeen&gt;
&lt;ss:availability&gt;100&lt;/ss:availability&gt;
&lt;ss:averageResponseTime&gt;0.5&lt;/ss:availableResponseTime&gt;
&lt;ss:statusMessage&gt;Everything is fine.&lt;/ss:statusMessage&gt;
&lt;/item&gt;
&lt;/channel&gt;
&lt;/rss&gt;</pre>
<figcaption>Example of an <abbr title="Really Simple Syndication">RSS</abbr> 2.0 feed with every optional Service Status module element in use</figcaption>
</figure>
<p>Using those extra elements, you can report in a more machine-readable format on how your service is doing. Every element in this namespace is optional, and you can use them to report on whether your service is working, when that was last checked, when the server last worked, how well it is working, how fast it is working, and leave a message for human consumption, usually to report about how you are doing on fixing a specific issue.</p>
<p>The above example uses the <a href="https://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation" target="_blank"><code>xsi:schemaLocation</code></a> attribute to point <abbr title="XML Schema Definition">XSD</abbr> validators to <a href="https://envs.net/~lucidiot/rsrsss/xsd/servicestatus.xsd" target="_blank">the schema</a> I wrote to validate this namespace, if you want to validate your feed very hard. The <a href="https://validator.w3.org/feed/" target="_blank">W3C Feed Validation Service</a> is aware of the existence of this namespace, so it won't warn about an unknown namespace, but it does not do any validation on its elements, so you'll need that schema to do any interesting validation.</p>
<p>The overengineered <a href="https://envs.net/~lucidiot/rsrsss/xsl/style.xsl" target="_blank"><abbr title="Extensible Stylesheet Language Transformation">XSLT</abbr></a> used to display this feed in HTML in modern browsers has been updated and supports this namespace, so you could use it directly to roll a status page that is nothing but an RSS feed, if you don't want to duplicate information. You can <a href="https://envs.net/~lucidiot/rsrsss/feed.xml#servicestatus" target="_blank">open this post in a compatible browser</a> to get a preview.</p>
<h3>Reference</h3>
<dl>
<dt><code>&lt;<dfn>ss:aboutStats</dfn>&gt;</code></dt>
<dd>
<p>An <abbr title="Resource Description Framework">RDF</abbr> resource that should describe how the <code>availability</code> and <code>averageResponseTime</code> statistics are calculated in this feed. This should be used only on a <code>channel</code> element.</p>
<p>Note that <a href="https://stackoverflow.com/a/48195644/5990435" target="_blank">anything is an RDF resource</a>, and there are many ways to serialize an RDF resource as XML. However, <a href="https://web.resource.org/rss/1.0/modules/servicestatus/" target="_blank">the official specification</a> only uses the form where the element just contains a URL, therefore this form is recommended. Feed generator implementers that do not know about RDF and its <a href="https://www.w3.org/TR/rdf-syntax-grammar/" target="_blank">XML representation</a> are likely to only use this form, and feed parser implementers are likely to only support this form.</p>
</dd>
<dt><code>&lt;<dfn>ss:responding</dfn>&gt;</code></dt>
<dd>Whether or not the service is responding.</dd>
<dt><code>&lt;<dfn>ss:lastChecked</dfn>&gt;</code></dt>
<dd>The most recent time a check was performed, as a <a href="https://www.w3.org/TR/NOTE-datetime" target="_blank">W3C datetime</a>, a subset of ISO&nbsp;8601. You may want to have both the usual <code>&lt;pubDate&gt;</code> element and this element to share the same values. When the <code>responding</code> element is set to <code>true</code>, this should be exactly equal to <code>lastSeen</code>, meaning that this should be the end time of the last check, not the start time. If this was the start time, then <code>lastSeen</code> would be the end time, and they would not be equal.</dd>
<dt><code>&lt;<dfn>ss:lastSeen</dfn>&gt;</code></dt>
<dd>The most recent time a check was successful, as a <a href="https://www.w3.org/TR/NOTE-datetime" target="_blank">W3C datetime</a>, a subset of ISO&nbsp;8601. When the <code>responding</code> element is set to <code>true</code>, this should be exactly equal to <code>lastChecked</code>. When it is <code>false</code>, the difference between <code>lastSeen</code> and <code>lastChecked</code> should give an estimate of how long the service was down for.</dd>
<dt><code>&lt;<dfn>ss:availability</dfn>&gt;</code></dt>
<dd>An integer representing the percentage of availability, between 0 and 100. How this availability is calculated is left up to the implementer and should be described by the <code>aboutStats</code> element.</dd>
<dt><code>&lt;<dfn>ss:averageResponseTime</dfn>&gt;</code></dt>
<dd>A decimal number representing the average response time of the service in seconds. How this availability is calculated is left up to the implementer and should be described by the <code>aboutStats</code> element.</dd>
<dt><code>&lt;<dfn>ss:statusMessage</dfn>&gt;</code></dt>
<dd>A message intended for human consumption giving further details about the service's status. This could for example warn of a planned outage, or give updates on how an ongoing issue is being worked on.</dd>
</dl>
]]></description>
<ss:responding>true</ss:responding>
<ss:lastChecked>2024-03-10T17:48:57+0100</ss:lastChecked>
<ss:lastSeen>2024-03-10T17:48:57+0100</ss:lastSeen>
<ss:availability>100</ss:availability>
<ss:averageResponseTime>0.42</ss:averageResponseTime>
<ss:statusMessage>If you can read this, then RSRSSS is definitely working.</ss:statusMessage>
</item>
</channel>
<access:restriction relationship="allow" />
</rss>