MCPcopy
hub / github.com/prometheus/client_golang / exactSumFor

Method exactSumFor

prometheus/go_collector_latest.go:402–412  ·  view source on GitHub ↗

exactSumFor takes a runtime/metrics metric name (that is assumed to be of kind KindFloat64Histogram) and returns its exact sum and whether its exact sum exists. The runtime/metrics API for histograms doesn't currently expose exact sums, but some of the other metrics are in fact exact sums of histog

(rmName string)

Source from the content-addressed store, hash-verified

400// The runtime/metrics API for histograms doesn't currently expose exact
401// sums, but some of the other metrics are in fact exact sums of histograms.
402func (c *goCollector) exactSumFor(rmName string) float64 {
403 sumName, ok := c.rmExactSumMapForHist[rmName]
404 if !ok {
405 return 0
406 }
407 s, ok := c.sampleMap[sumName]
408 if !ok {
409 return 0
410 }
411 return unwrapScalarRMValue(s.Value)
412}
413
414func memStatsFromRM(ms *runtime.MemStats, rm map[string]*metrics.Sample) {
415 lookupOrZero := func(name string) uint64 {

Callers 1

CollectMethod · 0.95

Calls 1

unwrapScalarRMValueFunction · 0.85

Tested by

no test coverage detected