Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricBuilder ¶
type MetricBuilder struct {
// contains filtered or unexported fields
}
MetricBuilder is the basic metric type that must be used by any potential metric added to the system. It allows user to create a prom collector which will be used to push.
func NewMetricBuilder ¶
func NewMetricBuilder(opts MetricOpts, value float64, labelKeyValues map[string]string) (*MetricBuilder, error)
NewMetricBuilder creates a new MetricBuilder object with the default values for the field.
func (*MetricBuilder) AddLabelValue ¶
func (m *MetricBuilder) AddLabelValue(key string, value string) error
AddLabelValue takes in a key and value and sets it to the map in metric builder.
func (MetricBuilder) PromCollector ¶
func (m MetricBuilder) PromCollector() (prometheus.Collector, error)
PromCollector function creates the required prometheus collector object with the values it has in the MetricBuilder calling object.
func (*MetricBuilder) SetValue ¶
func (m *MetricBuilder) SetValue(value float64)
SetValue is a setter function that assigns value to the metric builder.
type MetricOpts ¶
type MetricOpts struct { // labels contains the list of all label keys that the collector object will have. Labels []string // desc describes the metric that is being created. This field will be shown on Prometheus // dashboard as a help text. Desc string // name describes the name of the metric that needs to be pushed. Name string // buckets keeps a list of bucket values that will be used during the creation of a Histogram // object. Buckets []float64 // metricType defines what type of a collector object should the PromCollector function return. MetricType MetricType }
MetricOpts contains the properties that are required to create a MetricBuilder object.
type MetricType ¶
type MetricType string
MetricType defines what types of metrics can be created. Restricted by the types of the Prometheus Collector types.
const ( // Histogram denotes that the type of the collector object should be a Prometheus Histogram. Histogram MetricType = "Histogram" // Counter denotes that the type of the collector object should be a Prometheus Counter. Counter MetricType = "Counter" )