internal: rename variable for latency measures
postgres.keySearchLatency and frontend.keyFrontendFetchLatency are
renamed to searchLatency and frontendFetchLatency, since they are
measures, not keys.
Change-Id: Iacdb925a12b599b4fcc6eaae7e99ff48cb3b5c97
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239980
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/frontend/fetch.go b/internal/frontend/fetch.go
index 182ef5d..7d71c4c 100644
--- a/internal/frontend/fetch.go
+++ b/internal/frontend/fetch.go
@@ -44,9 +44,9 @@
keyFrontendFetchVersion = tag.MustNewKey("frontend-fetch.version")
// keyFrontendFetchStatus is a census tag for frontend fetch status types.
keyFrontendFetchStatus = tag.MustNewKey("frontend-fetch.status")
- // keyFrontendFetchLatency holds observed latency in individual
+ // frontendFetchLatency holds observed latency in individual
// frontend fetch queries.
- keyFrontendFetchLatency = stats.Float64(
+ frontendFetchLatency = stats.Float64(
"go-discovery/frontend-fetch/latency",
"Latency of a frontend fetch request.",
stats.UnitMilliseconds,
@@ -55,7 +55,7 @@
// latency by status code.
FrontendFetchLatencyDistribution = &view.View{
Name: "go-discovery/frontend-fetch/latency",
- Measure: keyFrontendFetchLatency,
+ Measure: frontendFetchLatency,
Aggregation: ochttp.DefaultLatencyDistribution,
Description: "FrontendFetch latency, by result source query type.",
TagKeys: []tag.Key{keyFrontendFetchStatus},
@@ -63,7 +63,7 @@
// FrontendFetchResponseCount counts frontend fetch responses by response type.
FrontendFetchResponseCount = &view.View{
Name: "go-discovery/frontend-fetch/count",
- Measure: keyFrontendFetchLatency,
+ Measure: frontendFetchLatency,
Aggregation: view.Count(),
Description: "Frontend fetch request count",
TagKeys: []tag.Key{keyFrontendFetchStatus},
@@ -480,5 +480,5 @@
stats.RecordWithTags(context.Background(), []tag.Mutator{
tag.Upsert(keyFrontendFetchStatus, strconv.Itoa(status)),
tag.Upsert(keyFrontendFetchVersion, v),
- }, keyFrontendFetchLatency.M(l))
+ }, frontendFetchLatency.M(l))
}
diff --git a/internal/postgres/search.go b/internal/postgres/search.go
index e5e3494..c93e1c0 100644
--- a/internal/postgres/search.go
+++ b/internal/postgres/search.go
@@ -28,8 +28,8 @@
)
var (
- // keySearchLatency holds observed latency in individual search queries.
- keySearchLatency = stats.Float64(
+ // searchLatency holds observed latency in individual search queries.
+ searchLatency = stats.Float64(
"go-discovery/search/latency",
"Latency of a search query.",
stats.UnitMilliseconds,
@@ -40,7 +40,7 @@
// query type.
SearchLatencyDistribution = &view.View{
Name: "go-discovery/search/latency",
- Measure: keySearchLatency,
+ Measure: searchLatency,
Aggregation: ochttp.DefaultLatencyDistribution,
Description: "Search latency, by result source query type.",
TagKeys: []tag.Key{keySearchSource},
@@ -48,7 +48,7 @@
// SearchResponseCount counts search responses by search query type.
SearchResponseCount = &view.View{
Name: "go-discovery/search/count",
- Measure: keySearchLatency,
+ Measure: searchLatency,
Aggregation: view.Count(),
Description: "Search count, by result source query type.",
TagKeys: []tag.Key{keySearchSource},
@@ -263,7 +263,7 @@
latency := float64(time.Since(searchStart)) / float64(time.Millisecond)
stats.RecordWithTags(ctx,
[]tag.Mutator{tag.Upsert(keySearchSource, resp.source)},
- keySearchLatency.M(latency))
+ searchLatency.M(latency))
// To avoid fighting with the query planner, our searches only hit the
// search_documents table and we enrich after getting the results. In the
// future, we may want to fully denormalize and put all search data in the