- commit
- de6dafb
- parent
- 777269b
- author
- Antonio Mika
- date
- 2024-11-18 14:46:23 +0000 UTC
Add user to analytics entries
1 files changed,
+5,
-3
+5,
-3
1@@ -662,17 +662,19 @@ func metricDrainSub(ctx context.Context, dbpool db.DB, logger *slog.Logger, secr
2 continue
3 }
4
5+ user := slog.Any("userId", visit.UserID)
6+
7 err = shared.AnalyticsVisitFromVisit(&visit, dbpool, secret)
8 if err != nil {
9 if !errors.Is(err, shared.ErrAnalyticsDisabled) {
10- logger.Info("could not record analytics visit", "reason", err)
11+ logger.Info("could not record analytics visit", "reason", err, "visit", visit, user)
12 }
13 }
14
15- logger.Info("inserting visit", "visit", visit)
16+ logger.Info("inserting visit", "visit", visit, user)
17 err = dbpool.InsertVisit(&visit)
18 if err != nil {
19- logger.Error("could not insert visit record", "err", err)
20+ logger.Error("could not insert visit record", "err", err, "visit", visit, user)
21 }
22 }
23