Revert "Don't log post titles anymore"

This reverts commit e9a2f5b745.
This commit is contained in:
Andre Medeiros 2022-05-27 09:22:04 -04:00
parent 2111cb4be6
commit f0353399e8

View file

@ -7,6 +7,7 @@ import (
"os" "os"
"sort" "sort"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/DataDog/datadog-go/statsd" "github.com/DataDog/datadog-go/statsd"
@ -210,11 +211,17 @@ func (tc *trendingConsumer) Consume(delivery rmq.Delivery) {
return tps.Children[i].Score > tps.Children[j].Score return tps.Children[i].Score > tps.Children[j].Score
}) })
posts := make([]string, tps.Count)
for i, post := range tps.Children {
posts[i] = fmt.Sprintf("%s: %d", post.Title, post.Score)
}
middlePost := tps.Count / 2 middlePost := tps.Count / 2
medianScore := tps.Children[middlePost].Score medianScore := tps.Children[middlePost].Score
tc.logger.Info("calculated median score", tc.logger.Info("calculated median score",
zap.Int64("subreddit#id", id), zap.Int64("subreddit#id", id),
zap.String("subreddit#name", subreddit.NormalizedName()), zap.String("subreddit#name", subreddit.NormalizedName()),
zap.String("subreddit#posts", strings.Join(posts, "\n")),
zap.Int64("score", medianScore), zap.Int64("score", medianScore),
) )