Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSideEffectPublishMessageToPrometheus ¶
func GetSideEffectPublishMessageToPrometheus(reg *Registerer) func(context.Context, interface{}) (interface{}, error)
Types ¶
type Counter ¶
type Counter struct { SourceId peer.ID Name string Desc string LabelPairs []LabelPair LastPublishedVal uint64 LastPublishedAt time.Time // contains filtered or unexported fields }
Counter dMetric uint counter struct
func NewCounter ¶
func NewCounter(sourceId peer.ID, name string, desc string, val uint64, labelPairs []LabelPair) *Counter
NewCounter create a new counter
func (*Counter) OnPublished ¶
func (c *Counter) OnPublished()
OnPublished for Publishable interface update LastPublishedVal upon published
func (*Counter) ShouldBePublished ¶
ShouldBePublished for Publishable interface return true if LastPublishedVal is not the same as uintVal
func (*Counter) ToJsonBytes ¶
ToJsonBytes for Marshalable interface return json.Marshal of Message
type CounterVec ¶
CounterVec collection of counters
func NewCounterVec ¶
func NewCounterVec(sourceId peer.ID, name string, desc string) *CounterVec
NewCounterVec create a new CounterVec
func (*CounterVec) GetValueOf ¶
func (cv *CounterVec) GetValueOf(labelPairs []LabelPair) uint64
GetValueOf return the value of the target counter
func (*CounterVec) Inc ¶
func (cv *CounterVec) Inc(labelPairs []LabelPair)
Inc increase the value of the target counter, or create a new one if needed
type LabelPair ¶
func GetLabelPairsFromLabelMap ¶
GetLabelPairsFromLabelMap return []LabelPair with a sorted map
type LabelPairs ¶
type LabelPairs []LabelPair
func (LabelPairs) String ¶
func (lps LabelPairs) String() string
func (LabelPairs) ToMap ¶
func (lps LabelPairs) ToMap() map[string]string
type Message ¶
type Message struct { SourceId peer.ID `json:"sourceId"` Type MetricType `json:"type"` Name string `json:"name"` LabelPairs []LabelPair `json:"labelPairs"` UIntVal uint64 `json:"uintVal"` }
func (Message) GetLabelPairsMap ¶
func (Message) GetLabelPairsStr ¶
type MetricType ¶
type MetricType uint64
const ( MetricTypeUndefined MetricType = iota MetricTypeCounter )
type Registerer ¶
func NewRegisterer ¶
func NewRegisterer() *Registerer
Click to show internal directories.
Click to hide internal directories.