Skip to content

Commit

Permalink
internal/frontend: remove frontend_version_type/result_count metric
Browse files Browse the repository at this point in the history
go-discovery/frontend_version_type/result_count doesn't seem to be
used anywhere so remove it.

For golang/go#61399

Change-Id: I496cb5b68ab7deb250f553cd5cfc6e6abc8ef990
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523511
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
  • Loading branch information
matloob committed Aug 29, 2023
1 parent ebe617b commit 4b63fb5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
1 change: 0 additions & 1 deletion cmd/frontend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ func main() {
postgres.SearchResponseCount,
fetchserver.FetchLatencyDistribution,
fetchserver.FetchResponseCount,
frontend.VersionTypeCount,
middleware.CacheResultCount,
middleware.CacheErrorCount,
middleware.CacheLatency,
Expand Down
31 changes: 0 additions & 31 deletions internal/frontend/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import (
"golang.org/x/pkgsite/internal/frontend/urlinfo"
mstats "golang.org/x/pkgsite/internal/middleware/stats"

"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
"golang.org/x/mod/semver"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/stdlib"
)
Expand Down Expand Up @@ -90,33 +86,6 @@ func stdlibRedirectURL(fullPath string) string {
return "/" + urlPath2
}

var (
keyVersionType = tag.MustNewKey("frontend.version_type")
versionTypeResults = stats.Int64(
"go-discovery/frontend_version_type_count",
"The version type of a request to package, module, or directory page.",
stats.UnitDimensionless,
)
VersionTypeCount = &view.View{
Name: "go-discovery/frontend_version_type/result_count",
Measure: versionTypeResults,
Aggregation: view.Count(),
Description: "version type results, by latest, master, or semver",
TagKeys: []tag.Key{keyVersionType},
}
)

func recordVersionTypeMetric(ctx context.Context, requestedVersion string) {
// Tag versions based on latest, master and semver.
v := requestedVersion
if semver.IsValid(v) {
v = "semver"
}
stats.RecordWithTags(ctx, []tag.Mutator{
tag.Upsert(keyVersionType, v),
}, versionTypeResults.M(1))
}

func checkExcluded(ctx context.Context, ds internal.DataSource, fullPath string) error {
db, ok := ds.(internal.PostgresDB)
if !ok {
Expand Down
1 change: 0 additions & 1 deletion internal/frontend/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func (s *Server) serveUnitPage(ctx context.Context, w http.ResponseWriter, r *ht
return s.serveJSONPage(w, r, d)
}

recordVersionTypeMetric(ctx, info.RequestedVersion)
if _, ok := internal.DefaultBranches[info.RequestedVersion]; ok {
// Since path@master is a moving target, we don't want it to be stale.
// As a result, we enqueue every request of path@master to the frontend
Expand Down

0 comments on commit 4b63fb5

Please sign in to comment.