diff options
| author | Ethan Lee <ethanalee@google.com> | 2026-01-12 19:57:54 +0000 |
|---|---|---|
| committer | Ethan Lee <ethanalee@google.com> | 2026-01-15 12:21:49 -0800 |
| commit | 576fb9481e5c52c5d6679fdefa4b07607989d00d (patch) | |
| tree | fdb49a91e0bfa20b2d8338ab63c8ccf5b1ad3e90 /internal/frontend/server.go | |
| parent | ddf96859c35103ea7898296565dc4e8272d7c6d3 (diff) | |
| download | go-x-pkgsite-576fb9481e5c52c5d6679fdefa4b07607989d00d.tar.xz | |
internal/frontend: add module and package metadata to codewiki link
- These metrics can provide further granularity for filtering usage
patterns.
Change-Id: I110854ac2cbcef54d02f1dd02cb27b917ab17705
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/735800
Auto-Submit: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/frontend/server.go')
| -rw-r--r-- | internal/frontend/server.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/frontend/server.go b/internal/frontend/server.go index 9648c5e7..5a554635 100644 --- a/internal/frontend/server.go +++ b/internal/frontend/server.go @@ -78,7 +78,7 @@ type FetchServerInterface interface { ds internal.PostgresDB, fullPath, modulePath, requestedVersion string) (err error) } -type RecordClickFunc func(ctx context.Context, url string, target string) +type RecordClickFunc func(ctx context.Context, url, target, module, pkg string) // ServerConfig contains everything needed by a Server. type ServerConfig struct { @@ -148,13 +148,15 @@ func NewServer(scfg ServerConfig) (_ *Server, err error) { func (s *Server) handleCodeWikiRedirect(w http.ResponseWriter, r *http.Request) { url := r.FormValue("url") + module := r.FormValue("module") + pkg := r.FormValue("package") if url == "" { http.Error(w, "missing url", http.StatusBadRequest) return } ctx := r.Context() if s.recordCodeWikiMetrics != nil { - s.recordCodeWikiMetrics(ctx, url, r.Header.Get("Referer")) + s.recordCodeWikiMetrics(ctx, url, r.Header.Get("Referer"), module, pkg) } http.Redirect(w, r, url, http.StatusFound) } |
