prometheus/prometheus.go
func NewCounter(options *CounterOptions) (c *Counter) {
	if options == nil {
		options = new(CounterOptions)
	}
	if options.Name == "" {
		options.Name = "logging_messages_total"
	}
	if options.Help == "" {
		options.Help = "Number of log messages processed, partitioned by log level."
	}
	vector := prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: options.Name,
			Help: options.Help,
		},
		[]string{"level"},
	)
	return &Counter{
		vector:           vector,
		emergencyCounter: vector.WithLabelValues("emergency"),
		alertCounter:     vector.WithLabelValues("alert"),
		criticalCounter:  vector.WithLabelValues("critical"),
		errorCounter:     vector.WithLabelValues("error"),
		warningCounter:   vector.WithLabelValues("warning"),
		noticeCounter:    vector.WithLabelValues("notice"),
		infoCounter:      vector.WithLabelValues("info"),
		debugCounter:     vector.WithLabelValues("debug"),
	}
}
func NewCounter(options *CounterOptions) (c *Counter) {
	if options == nil {
		options = new(CounterOptions)
	}
	if options.Name == "" {
		options.Name = "logging_messages_total"
	}
	if options.Help == "" {
		options.Help = "Number of log messages processed, partitioned by log level."
	}
	vector := prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: options.Name,
			Help: options.Help,
		},
		[]string{"level"},
	)
	return &Counter{
		vector:           vector,
		emergencyCounter: vector.WithLabelValues("emergency"),
		alertCounter:     vector.WithLabelValues("alert"),
		criticalCounter:  vector.WithLabelValues("critical"),
		errorCounter:     vector.WithLabelValues("error"),
		warningCounter:   vector.WithLabelValues("warning"),
		noticeCounter:    vector.WithLabelValues("notice"),
		infoCounter:      vector.WithLabelValues("info"),
		debugCounter:     vector.WithLabelValues("debug"),
	}
}
func NewCounter ( options * CounterOptions ) ( c * Counter ) { if options == nil { options = new ( CounterOptions ) } if options . Name == " " { options . Name = " " } if options . Help == " " { options . Help = " " } vector := prometheus . NewCounterVec ( prometheus . CounterOpts { Name : options . Name , Help : options . Help , } , [ ] string { " " } , ) return & Counter { vector : vector , emergencyCounter : vector . WithLabelValues ( " " ) , alertCounter : vector . WithLabelValues ( " " ) , criticalCounter : vector . WithLabelValues ( " " ) , errorCounter : vector . WithLabelValues ( " " ) , warningCounter : vector . WithLabelValues ( " " ) , noticeCounter : vector . WithLabelValues ( " " ) , infoCounter : vector . WithLabelValues ( " " ) , debugCounter : vector . WithLabelValues ( " " ) , } }
// NewCounter creates new Counter instance.
// Options value can be nil.
NewCounter creates new Counter instance . Options value can be nil .