mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting/metrics (#33547)
* moves alerting metrics to their own pkg
* adds grafana_alerting_alerts (by state) metric
* alerts_received_{total,invalid}
* embed alertmanager alerting struct in ng metrics & remove duplicated notification metrics (already embed alertmanager notifier metrics)
* use silence metrics from alertmanager lib
* fix - manager has metrics
* updates ngalert tests
* comment lint
Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
* cleaner prom registry code
* removes ngalert global metrics
* new registry use in all tests
* ngalert metrics impl service, hack testinfra code to prevent duplicate metric registrations
* nilmetrics unexported
This commit is contained in:
@@ -16,7 +16,9 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
"github.com/grafana/grafana/pkg/server"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/ini.v1"
|
||||
@@ -26,8 +28,10 @@ import (
|
||||
// The server address is returned.
|
||||
func StartGrafana(t *testing.T, grafDir, cfgPath string, sqlStore *sqlstore.SQLStore) string {
|
||||
t.Helper()
|
||||
|
||||
ctx := context.Background()
|
||||
// Prevent duplicate registration errors between tests by replacing
|
||||
// the registry used.
|
||||
metrics.GlobalMetrics.SwapRegisterer(prometheus.NewRegistry())
|
||||
|
||||
origSQLStore := registry.GetService(sqlstore.ServiceName)
|
||||
t.Cleanup(func() {
|
||||
|
||||
Reference in New Issue
Block a user