Export newMetrics function and metrics struct (#2523)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
Ganesh Vernekar 2021-03-24 12:37:58 +05:30 committed by GitHub
parent 72deec44a8
commit 10757eb5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -231,7 +231,7 @@ type NotificationLog interface {
Query(params ...nflog.QueryParam) ([]*nflogpb.Entry, error)
}
type metrics struct {
type Metrics struct {
numNotifications *prometheus.CounterVec
numTotalFailedNotifications *prometheus.CounterVec
numNotificationRequestsTotal *prometheus.CounterVec
@ -239,8 +239,8 @@ type metrics struct {
notificationLatencySeconds *prometheus.HistogramVec
}
func newMetrics(r prometheus.Registerer) *metrics {
m := &metrics{
func NewMetrics(r prometheus.Registerer) *Metrics {
m := &Metrics{
numNotifications: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "alertmanager",
Name: "notifications_total",
@ -293,12 +293,12 @@ func newMetrics(r prometheus.Registerer) *metrics {
}
type PipelineBuilder struct {
metrics *metrics
metrics *Metrics
}
func NewPipelineBuilder(r prometheus.Registerer) *PipelineBuilder {
return &PipelineBuilder{
metrics: newMetrics(r),
metrics: NewMetrics(r),
}
}
@ -332,7 +332,7 @@ func createReceiverStage(
integrations []Integration,
wait func() time.Duration,
notificationLog NotificationLog,
metrics *metrics,
metrics *Metrics,
) Stage {
var fs FanoutStage
for i := range integrations {
@ -638,11 +638,11 @@ func (n *DedupStage) Exec(ctx context.Context, _ log.Logger, alerts ...*types.Al
type RetryStage struct {
integration Integration
groupName string
metrics *metrics
metrics *Metrics
}
// NewRetryStage returns a new instance of a RetryStage.
func NewRetryStage(i Integration, groupName string, metrics *metrics) *RetryStage {
func NewRetryStage(i Integration, groupName string, metrics *Metrics) *RetryStage {
return &RetryStage{
integration: i,
groupName: groupName,

View File

@ -392,7 +392,7 @@ func TestRetryStageWithError(t *testing.T) {
}
r := RetryStage{
integration: i,
metrics: newMetrics(prometheus.NewRegistry()),
metrics: NewMetrics(prometheus.NewRegistry()),
}
alerts := []*types.Alert{
@ -433,7 +433,7 @@ func TestRetryStageNoResolved(t *testing.T) {
}
r := RetryStage{
integration: i,
metrics: newMetrics(prometheus.NewRegistry()),
metrics: NewMetrics(prometheus.NewRegistry()),
}
alerts := []*types.Alert{
@ -487,7 +487,7 @@ func TestRetryStageSendResolved(t *testing.T) {
}
r := RetryStage{
integration: i,
metrics: newMetrics(prometheus.NewRegistry()),
metrics: NewMetrics(prometheus.NewRegistry()),
}
alerts := []*types.Alert{