在Prometheus中使用计数器时,我们是否会遇到达到计数器最大限制的问题(假设应用程序永不重启)?如果是这样,它将影响正在尝试公开该指标的基础应用程序,还是会受到Prometheus的照顾?
答案 0 :(得分:1)
如果您查看counter
中的prometheus/client_golang
度量标准类型的声明。
type counter struct {
// valBits contains the bits of the represented float64 value, while
// valInt stores values that are exact integers. Both have to go first
// in the struct to guarantee alignment for atomic operations.
// http://golang.org/pkg/sync/atomic/#pkg-note-BUG
valBits uint64
valInt uint64
selfCollector
desc *Desc
labelPairs []*dto.LabelPair
}
他们将unsigned int64
类型用于valInt
计数器。因此,一旦超出限制int64
,它将再次设置为zero
。我想其他客户端库也是如此。