From 69ca840419405f0b7fad8e13bb3fbdaac397acd8 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 18 May 2024 23:53:00 +0100 Subject: [PATCH] Drop "type" from paste views metric --- cmd/tclipd/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/tclipd/main.go b/cmd/tclipd/main.go index 269f8fb..f0088ae 100644 --- a/cmd/tclipd/main.go +++ b/cmd/tclipd/main.go @@ -75,7 +75,7 @@ var ( pasteViews = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "tclip_paste_views", Help: "Number of times a paste has been viewed", - }, []string{"id", "origin", "type"}) + }, []string{"id", "origin"}) ) func dataLocation() string { @@ -590,7 +590,7 @@ WHERE p.id = $1` w.WriteHeader(http.StatusOK) fmt.Fprint(w, data) - pasteViews.With(prometheus.Labels{"id": id, "origin": origin, "type": "raw"}).Inc() + pasteViews.With(prometheus.Labels{"id": id, "origin": origin}).Inc() return // download file to disk (plain text view plus download hint) @@ -601,7 +601,7 @@ WHERE p.id = $1` w.WriteHeader(http.StatusOK) fmt.Fprint(w, data) - pasteViews.With(prometheus.Labels{"id": id, "origin": origin, "type": "download"}).Inc() + pasteViews.With(prometheus.Labels{"id": id, "origin": origin}).Inc() return case "": @@ -625,7 +625,7 @@ WHERE p.id = $1` title = ogTitle } } - pasteViews.With(prometheus.Labels{"id": id, "origin": origin, "type": "fancy"}).Inc() + pasteViews.With(prometheus.Labels{"id": id, "origin": origin}).Inc() err = s.tmpls.ExecuteTemplate(w, "fancypost.html", struct { Title string @@ -658,7 +658,7 @@ WHERE p.id = $1` remoteUserID = up.ID } - pasteViews.With(prometheus.Labels{"id": id, "origin": origin, "type": "normal"}).Inc() + pasteViews.With(prometheus.Labels{"id": id, "origin": origin}).Inc() err = s.tmpls.ExecuteTemplate(w, "showpaste.html", struct { UserInfo *tailcfg.UserProfile