fradrive/templates/metrics.hamlet
2022-10-12 09:35:16 +02:00

60 lines
2.3 KiB
Plaintext

$newline never
$# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later
$maybe t <- metricsBearer
<section>
<pre .token>
#{toPathPiece t}
<section>
<dl .deflist>
$forall SampleGroup Info{..} _ mSamples <- samples
<dt .deflist__dt>
<div>#{metricName}
<p style="font-weight: 600; color: var(--color-fontsec); font-size: 0.9rem; margin-top: 7px">
#{metricHelp}
<dd .deflist__dd style="overflow: auto; max-height: 50vh">
$case mSamples
$of []
<p style="font-style: italic">_{MsgMetricNoSamples}
$of _
$maybe (lPairs, sValue) <- singleSample metricName mSamples
<p>
#{decodeUtf8 sValue}
$case lPairs
$of []
$of _
<ul .list--inline .list--comma-separated>
$forall (lName, lValue) <- lPairs
<li>
<span .metric-label>
#{lName}
=
<span .metric-value>
#{lValue}
$nothing
$with allLabels <- getLabels mSamples
<table .table .table--striped .table--hover>
<thead>
<tr .table__row .table__row--head>
$if showMetricName metricName mSamples
<th .table__th>_{MsgMetricName}
$forall l <- allLabels
<th .table__th .metric-label>
#{l}
<th .table__th>_{MsgMetricValue}
<tbody>
$forall Sample sName lPairs sValue <- mSamples
<tr .table__row>
$if showMetricName metricName mSamples
<td .table__td title=#{sName}>
#{metricBasename metricName sName}
$forall l <- allLabels
<td .table__td .metric-value>
$maybe lValue <- lookup l lPairs
#{lValue}
<td .table__td .metric-value>
#{decodeUtf8 sValue}