repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
4350d48
parent
e522d71
author
Eric Bower
date
2025-02-24 22:16:54 -0500 EST
fix(metrics): track prose 404s
1 files changed,  +6, -10
M auth/api.go
+6, -10
 1@@ -612,6 +612,9 @@ func deserializeCaddyAccessLog(dbpool db.DB, access *AccessLog) (*db.AnalyticsVi
 2 		subdomain = shared.GetCustomDomain(host, space)
 3 	}
 4 
 5+	subdomain = strings.TrimSuffix(subdomain, ".nue")
 6+	subdomain = strings.TrimSuffix(subdomain, ".ash")
 7+
 8 	// get user and namespace details from subdomain
 9 	props, err := shared.GetProjectFromSubdomain(subdomain)
10 	if err != nil {
11@@ -644,15 +647,10 @@ func deserializeCaddyAccessLog(dbpool db.DB, access *AccessLog) (*db.AnalyticsVi
12 			cleanPath := strings.TrimPrefix(path, "/")
13 			post, err := dbpool.FindPostWithSlug(cleanPath, user.ID, space)
14 			if err != nil {
15-				return nil, fmt.Errorf(
16-					"could not find post with slug (path:%s, userId:%s, space:%s): %w",
17-					cleanPath,
18-					user.ID,
19-					space,
20-					err,
21-				)
22+				// skip
23+			} else {
24+				postID = post.ID
25 			}
26-			postID = post.ID
27 		}
28 	}
29 
30@@ -697,8 +695,6 @@ func metricDrainSub(ctx context.Context, dbpool db.DB, logger *slog.Logger, secr
31 			line := scanner.Text()
32 			clean := strings.TrimSpace(line)
33 
34-			fmt.Println(line)
35-
36 			visit, err := accessLogToVisit(dbpool, clean)
37 			if err != nil {
38 				logger.Info("could not convert access log to a visit", "err", err)