Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metrics to include repository on job-based label #3310

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/ghalistener/listener/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestNew(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, l)
})

}

func TestListener_createSession(t *testing.T) {
Expand Down Expand Up @@ -657,7 +656,7 @@ func TestListener_acquireAvailableJobs(t *testing.T) {
Return(nil, &actions.MessageQueueTokenExpiredError{}).
Once()

// First call to AcquireJobs will fail with a token expired error
// Second call should succeed
client.On("AcquireJobs", ctx, mock.Anything, mock.Anything, mock.Anything).
Run(func(args mock.Arguments) {
ids := args.Get(3).([]int64)
Expand Down
10 changes: 6 additions & 4 deletions cmd/ghalistener/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ type baseLabels struct {
func (b *baseLabels) jobLabels(jobBase *actions.JobMessageBase) prometheus.Labels {
return prometheus.Labels{
labelKeyEnterprise: b.enterprise,
labelKeyOrganization: b.organization,
labelKeyRepository: b.repository,
labelKeyOrganization: jobBase.OwnerName,
labelKeyRepository: jobBase.RepositoryName,
labelKeyJobName: jobBase.JobDisplayName,
labelKeyJobWorkflowRef: jobBase.JobWorkflowRef,
labelKeyEventName: jobBase.EventName,
Expand Down Expand Up @@ -271,8 +271,10 @@ type ServerPublisher interface {
ListenAndServe(ctx context.Context) error
}

var _ Publisher = &discard{}
var _ ServerPublisher = &exporter{}
var (
_ Publisher = &discard{}
_ ServerPublisher = &exporter{}
)

var Discard Publisher = &discard{}

Expand Down