Skip to content

Commit

Permalink
Reverse samples to show latest on top, add #samples linking (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Jan 16, 2021
1 parent dca842d commit 70e80d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions logzpage/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func Handler(observers ...*logz.Observer) http.Handler {
<tbody>
{{ range .Entries }}
<tr>
<td><a href="?msg={{ .Message }}&amp;level={{ $.Level }}">{{ .Message }}</a></td>
<td><a href="?msg={{ .Message }}&amp;level={{ $.Level }}#samples">{{ .Message }}</a></td>
<td>{{ time .First }}</td>
<td>{{ time .Last }}</td>
<td>{{ .Count }}</td>
Expand Down Expand Up @@ -119,7 +119,7 @@ func Handler(observers ...*logz.Observer) http.Handler {
{{ histogram .Details.Buckets }}
<h3>Samples</h3>
<h3 id="samples">Samples</h3>
<table class="pure-table pure-table-horizontal">
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (l *Observer) exportEntry(en *entry, withSamples bool) Entry {
if withSamples {
e.Samples = make([]interface{}, 0, l.maxSamples)

for i := uint32(0); i < l.maxSamples; i++ {
for i := int(l.maxSamples) - 1; i >= 0; i-- {
sample := <-en.samples
en.samples <- sample

Expand Down

0 comments on commit 70e80d9

Please sign in to comment.