github.com/grafana/pyroscope@v1.18.0/pkg/api/memberlist_status.gohtml (about)

     1  {{- /*gotype: github.com/grafana/dskit/kv/memberlist.StatusPageData */ -}}
     2  <!DOCTYPE html>
     3  <html class="h-100" data-bs-theme="dark">
     4  <head>
     5      <meta charset="UTF-8">
     6      <meta http-equiv="X-UA-Compatible" content="IE=edge">
     7      <meta name="viewport" content="width=device-width, initial-scale=1">
     8  
     9      <title>Memberlist: Grafana Pyroscope</title>
    10  
    11      <link rel="stylesheet" href="{{ AddPathPrefix "/static/bootstrap-5.3.3.min.css" }}">
    12      <link rel="stylesheet" href="{{ AddPathPrefix "/static/bootstrap-icons-1.8.1.css" }}">
    13      <link rel="stylesheet" href="{{ AddPathPrefix "/static/pyroscope-styles.css" }}">
    14      <script src="{{ AddPathPrefix "/static/bootstrap-5.3.3.bundle.min.js" }}"></script>
    15  </head>
    16  <body class="d-flex flex-column h-100">
    17  <main class="flex-shrink-0">
    18      <div class="container">
    19          <div class="header row border-bottom py-3 flex-column-reverse flex-sm-row">
    20              <div class="col-12 col-sm-9 text-center text-sm-start">
    21                  <h1>Memberlist: Grafana Pyroscope</h1>
    22              </div>
    23              <div class="col-12 col-sm-3 text-center text-sm-end mb-3 mb-sm-0">
    24                  <a href="{{AddPathPrefix "/"}}">
    25                      <img alt="Pyroscope logo" class="pyroscope-brand" src="{{ AddPathPrefix "/static/pyroscope-logo.png" }}">
    26                  </a>
    27              </div>
    28          </div>
    29          <div class="row my-3">
    30              <div class="col-12">
    31                  {{ $HealthScore := .Memberlist.GetHealthScore }}
    32                  {{ if eq $HealthScore 0 }}
    33                      <div class="alert alert-success" role="alert">
    34                          Memberlist cluster has <strong>{{ .Memberlist.NumMembers }}</strong> members and it is <strong>healthy</strong>.
    35                      </div>
    36                  {{ else }}
    37                      <div class="alert alert-warning" role="alert">
    38                          Memberlist cluster has <strong>{{ .Memberlist.NumMembers }}</strong> members but health score
    39                          is {{ $HealthScore }} (lower is better, 0 = healthy).
    40                      </div>
    41                  {{ end }}
    42              </div>
    43  
    44              <h2>KV Store</h2>
    45              <div class="table-responsive">
    46                  <table class="table table-bordered table-hover table-striped">
    47                      <thead>
    48                      <tr>
    49                          <th>Key</th>
    50                          <th class="fit-width">Codec</th>
    51                          <th class="fit-width">
    52                              <span class="text-nowrap">
    53                                  Version
    54                                  <i class="bi bi-info-circle"
    55                                     data-bs-toggle="tooltip" data-bs-placement="top"
    56                                     title="Note that value 'version' is node-specific. It starts with 0 (on restart), and increases on each received update."></i>
    57                              </span>
    58                          </th>
    59                          <th class="fit-width">Actions</th>
    60                      </tr>
    61                      </thead>
    62  
    63                      <tbody>
    64                      {{ range $k, $v := .Store }}
    65                          <tr>
    66                              <td class="align-middle font-monospace small">{{ $k }}</td>
    67                              <td class="align-middle font-monospace small fit-width">{{ $v.CodecID }}</td>
    68                              <td class="align-middle font-monospace small fit-width">{{ $v.Version }}</td>
    69                              <td class="fit-width">
    70                                  <span class="text-nowrap">
    71                                      <a href="?viewKey={{ $k }}&format=json-pretty" title="JSON pretty" class="text-decoration-none">
    72                                          <i class="bi bi-filetype-json text-success"></i>
    73                                      </a>
    74                                      <a href="?viewKey={{ $k }}&format=json" title="JSON" class="text-decoration-none">
    75                                          <i class="bi bi-filetype-json"></i>
    76                                      </a>
    77                                      <a href="?viewKey={{ $k }}&format=struct" title="Struct" class="text-decoration-none">
    78                                          <i class="bi bi-file-earmark-code"></i>
    79                                      </a>
    80                                      <a href="?downloadKey={{ $k }}" title="Download" class="text-decoration-none">
    81                                          <i class="bi bi-file-earmark-arrow-down"></i>
    82                                      </a>
    83                                  </span>
    84                              </td>
    85                          </tr>
    86                      {{ end }}
    87                      </tbody>
    88                  </table>
    89              </div>
    90  
    91              <h2>Memberlist Cluster Members</h2>
    92              <div class="table-responsive">
    93                  <table class="table table-bordered table-hover table-striped">
    94                      <thead>
    95                      <tr>
    96                          <th>Name</th>
    97                          <th>Address</th>
    98                          <th class="fit-width">
    99                              <span class="text-nowrap">
   100                                  State
   101                                  <i class="bi bi-info-circle"
   102                                     data-bs-toggle="tooltip" data-bs-placement="left"
   103                                     title="State: 0 = Alive, 1 = Suspect, 2 = Dead, 3 = Left"></i>
   104                              </span>
   105                          </th>
   106                      </tr>
   107                      </thead>
   108  
   109                      <tbody>
   110                      {{ range .SortedMembers }}
   111                          <tr>
   112                              <td class="align-middle font-monospace small">{{ .Name }}</td>
   113                              <td class="align-middle font-monospace small">{{ .Address }}</td>
   114                              <td class="fit-width text-center py-1">
   115                                  {{ if eq .State 0}}
   116                                      <span class="badge bg-success">Alive</span>
   117                                  {{ else if eq .State 1 }}
   118                                      <span class="badge bg-warning text-dark">Suspect</span>
   119                                  {{ else if eq .State 2 }}
   120                                      <span class="badge bg-danger">Dead</span>
   121                                  {{ else if eq.State 3}}
   122                                      <span class="badge bg-info">Left</span>
   123                                  {{ else }}
   124                                      <span class="badge bg-info">Unknown: {{ .State }}</span>
   125                                  {{ end }}
   126                              </td>
   127                          </tr>
   128                      {{ end }}
   129                      </tbody>
   130                  </table>
   131              </div>
   132  
   133              <h2>Message History
   134                  {{ if .MessageHistoryBufferBytes }}
   135                      <a class="btn btn-outline-warning" href="?deleteMessages=true" data-bs-toggle="tooltip"
   136                         data-bs-placement="right" title="Delete sent and received messages buffer">Flush</a>
   137                  {{ end }}
   138              </h2>
   139  
   140              {{ if .MessageHistoryBufferBytes }}
   141                  <div class="accordion">
   142                      <div class="accordion-item">
   143                          <h3 class="accordion-header" id="heading-received-messages">
   144                              <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
   145                                      data-bs-target="#collapse-received-messages" aria-expanded="false"
   146                                      aria-controls="collapse-received-messages">
   147                                  Received Messages
   148                              </button>
   149                          </h3>
   150                          <div id="collapse-received-messages" class="accordion-collapse collapse"
   151                               aria-labelledby="heading-received-messages">
   152                              <div class="accordion-body p-0 table-responsive">
   153                                  {{ if .ReceivedMessages }}
   154                                      <table class="table table-hover table-striped">
   155                                          <thead>
   156                                          <tr>
   157                                              <th class="fit-width">ID</th>
   158                                              <th>Time</th>
   159                                              <th>Key</th>
   160                                              <th class="fit-width">Size (B)</th>
   161                                              <th class="fit-width">Codec</th>
   162                                              <th class="fit-width">
   163                                                  <span class="text-nowrap">
   164                                                      Version
   165                                                      <i class="bi bi-info-circle"
   166                                                         data-bs-toggle="tooltip" data-bs-placement="top"
   167                                                         title="Version after update. 0 = No change."></i>
   168                                                  </span>
   169                                              </th>
   170                                              <th>Changes</th>
   171                                              <th class="fit-width">Actions</th>
   172                                          </tr>
   173                                          </thead>
   174  
   175                                          <tbody class="font-monospace small">
   176                                          {{ range .ReceivedMessages }}
   177                                              <tr>
   178                                                  <td class="font-monospace small fit-width">{{ .ID }}</td>
   179                                                  <td class="font-monospace small">{{ .Time.Format "15:04:05.000" }}</td>
   180                                                  <td class="font-monospace small">{{ .Pair.Key }}</td>
   181                                                  <td class="font-monospace small fit-width">{{ .Pair.Value | len }}</td>
   182                                                  <td class="font-monospace small fit-width">{{ .Pair.Codec }}</td>
   183                                                  <td class="font-monospace small fit-width">{{ .Version }}</td>
   184                                                  <td class="font-monospace small">{{ StringsJoin .Changes ", " }}</td>
   185                                                  <td class="fit-width">
   186                                                      <span class="text-nowrap">
   187                                                          <a href="?viewMsg={{ .ID }}&format=json-pretty" class="text-decoration-none">
   188                                                              <i class="bi bi-filetype-json text-success"></i>
   189                                                          </a>
   190                                                          <a href="?viewMsg={{ .ID }}&format=json" class="text-decoration-none">
   191                                                              <i class="bi bi-filetype-json"></i>
   192                                                          </a>
   193                                                          <a href="?viewMsg={{ .ID }}&format=struct" class="text-decoration-none">
   194                                                              <i class="bi bi-file-earmark-code"></i>
   195                                                          </a>
   196                                                      </span>
   197                                                  </td>
   198                                              </tr>
   199                                          {{ end }}
   200                                          </tbody>
   201  
   202                                      </table>
   203                                  {{ else }}
   204                                      <span><i>There are no received messages.</i></span>
   205                                  {{ end }}
   206                              </div>
   207                          </div>
   208                      </div>
   209                      <div class="accordion-item">
   210                          <h3 class="accordion-header" id="heading-sent-messages">
   211                              <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
   212                                      data-bs-target="#collapse-sent-messages" aria-expanded="false"
   213                                      aria-controls="collapse-sent-messages">
   214                                  Sent Messages
   215                              </button>
   216                          </h3>
   217                          <div id="collapse-sent-messages" class="accordion-collapse collapse"
   218                               aria-labelledby="heading-sent-messages">
   219                              <div class="accordion-body p-0 table-responsive">
   220  
   221                                  {{ if .SentMessages }}
   222                                      <table class="table table-hover table-striped">
   223                                          <thead>
   224                                          <tr>
   225                                              <th>ID</th>
   226                                              <th>Time</th>
   227                                              <th>Key</th>
   228                                              <th>Size</th>
   229                                              <th>Codec</th>
   230                                              <th>Version</th>
   231                                              <th>Changes</th>
   232                                              <th>Actions</th>
   233                                          </tr>
   234                                          </thead>
   235  
   236                                          <tbody>
   237                                          {{ range .SentMessages }}
   238                                              <tr>
   239                                                  <td class="font-monospace small">{{ .ID }}</td>
   240                                                  <td class="font-monospace small">{{ .Time.Format "15:04:05.000" }}</td>
   241                                                  <td class="font-monospace small">{{ .Pair.Key }}</td>
   242                                                  <td class="font-monospace small">{{ .Pair.Value | len }}</td>
   243                                                  <td class="font-monospace small">{{ .Pair.Codec }}</td>
   244                                                  <td class="font-monospace small">{{ .Version }}</td>
   245                                                  <td class="font-monospace small">{{ StringsJoin .Changes ", " }}</td>
   246                                                  <td>
   247                                                      <span class="text-nowrap">
   248                                                          <a href="?viewMsg={{ .ID }}&format=json-pretty" class="text-decoration-none">
   249                                                              <i class="bi bi-filetype-json text-success"></i>
   250                                                          </a>
   251                                                          <a href="?viewMsg={{ .ID }}&format=json" class="text-decoration-none">
   252                                                              <i class="bi bi-filetype-json"></i>
   253                                                          </a>
   254                                                          <a href="?viewMsg={{ .ID }}&format=struct" class="text-decoration-none">
   255                                                              <i class="bi bi-file-earmark-code"></i>
   256                                                          </a>
   257                                                      </span>
   258                                                  </td>
   259                                              </tr>
   260                                          {{ end }}
   261                                          </tbody>
   262                                      </table>
   263  
   264                                  {{ else }}
   265                                      <span><i>There are no sent messages.</i></span>
   266                                  {{ end }}
   267                              </div>
   268                          </div>
   269                      </div>
   270                  </div>
   271              {{ else }}
   272  
   273                  <div class="col-12">
   274                      <div class="alert alert-info" role="alert">
   275                          Message history buffer is disabled.
   276                          <br />Enable it by setting the <code>-memberlist.message-history-buffer-bytes</code> flag or the corresponding config key.
   277                      </div>
   278                  </div>
   279              {{ end }}
   280          </div>
   281      </div>
   282  </main>
   283  <footer class="footer mt-auto py-3 bg-light">
   284      <div class="container">
   285          <small class="text-muted">Status @ {{ .Now.Format "2006-01-02 15:04:05.000" }}</small>
   286      </div>
   287  </footer>
   288  <script type="text/javascript">
   289      var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
   290      var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
   291          return new bootstrap.Tooltip(tooltipTriggerEl)
   292      })
   293  </script>
   294  </body>
   295  </html>