MCPcopy Create free account
hub / github.com/couchbase/cbft / getNsIndexStatsKey

Function getNsIndexStatsKey

prometheus.go:166–188  ·  view source on GitHub ↗
(indexName, sourceName, params string)

Source from the content-addressed store, hash-verified

164}
165
166func getNsIndexStatsKey(indexName, sourceName, params string) string {
167 var colNames string
168 // look up the scope/collection details from the cache.
169 sname, cnames := metaFieldValCache.getScopeCollectionNames(indexName)
170 // compute afresh for a cache miss.
171 if len(sname) == 0 && len(cnames) == 0 {
172 sname, cnames = scopeCollNames(params, sourceName)
173 if sname == "" && len(cnames) == 0 {
174 sname = "_default"
175 cnames = []string{"_default"}
176 }
177 }
178
179 for i, colName := range cnames {
180 if i > 0 {
181 colName = "," + colName
182 }
183 colNames += colName
184 }
185
186 return ` {bucket="` + sourceName + `",scope="` + sname + `"` +
187 `,collection="` + colNames + `",index="` + indexName + `"}`
188}
189
190// PrometheusMetricsHandler is a REST handler that provides low
191// cardinality stats/metrics for consumption by ns_server/prometheus.

Callers 1

gatherIndexStatsFunction · 0.85

Calls 2

scopeCollNamesFunction · 0.85

Tested by

no test coverage detected