Provisioning: Add metrics around webhooks (#111453)

This commit is contained in:
Stephanie Hingtgen
2025-09-22 16:53:50 -05:00
committed by GitHub
parent 8b1caccc72
commit 63e1d52663
9 changed files with 196 additions and 18 deletions
@@ -7,6 +7,7 @@ import (
"fmt"
"testing"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -759,7 +760,7 @@ func TestCalculateChanges(t *testing.T) {
}
return "http://host/"
})
}, prometheus.NewPedanticRegistry())
pullRequest := provisioning.PullRequestJobOptions{
Ref: "ref",
@@ -890,6 +891,7 @@ func TestRenderScreenshotFromGrafanaURL(t *testing.T) {
},
}
metrics := registerScreenshotMetrics(prometheus.NewPedanticRegistry())
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
renderer := NewMockScreenshotRenderer(t)
@@ -900,7 +902,7 @@ func TestRenderScreenshotFromGrafanaURL(t *testing.T) {
Name: "repo",
}
got, err := renderScreenshotFromGrafanaURL(context.Background(), tt.baseURL, renderer, repo, tt.grafanaURL)
got, err := renderScreenshotFromGrafanaURL(context.Background(), tt.baseURL, renderer, repo, tt.grafanaURL, metrics)
if tt.wantErr != "" {
require.Error(t, err)
require.Contains(t, err.Error(), tt.wantErr)