Skip to content

Commit

Permalink
fix merge conflict, separate owner/repo in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-jokic committed Jun 30, 2023
1 parent 175d4b1 commit 52a354a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.20.4 as builder
FROM --platform=$BUILDPLATFORM golang:1.20.5 as builder

WORKDIR /workspace

Expand Down
10 changes: 0 additions & 10 deletions cmd/githubrunnerscalesetlistener/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ var (
scaleSetLabels,
)

// TODO: add statistic
completedJobs = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Subsystem: githubScaleSetSubsystem,
Name: "completed_jobs",
Help: "Number of completed jobs by the scale set.",
},
scaleSetLabels,
)

assignedJobs = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Subsystem: githubScaleSetSubsystem,
Expand Down
15 changes: 5 additions & 10 deletions controllers/actions.github.com/ephemeralrunnerset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,13 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R
return ctrl.Result{}, nil
}

owner := parsedURL.Organization
if parsedURL.Enterprise != "" {
owner = parsedURL.Enterprise
}

metrics.SetEphemeralRunnerCountsByStatus(
metrics.CommonLabels{
Name: ephemeralRunnerSet.Labels[LabelKeyGitHubScaleSetName],
Namespace: ephemeralRunnerSet.Labels[LabelKeyGitHubScaleSetNamespace],
Repo: parsedURL.Repository,
Owner: owner,
ConfigURL: githubConfigURL,
Name: ephemeralRunnerSet.Labels[LabelKeyGitHubScaleSetName],
Namespace: ephemeralRunnerSet.Labels[LabelKeyGitHubScaleSetNamespace],
Repo: parsedURL.Repository,
Organization: parsedURL.Organization,
Enterprise: parsedURL.Enterprise,
},
len(pendingEphemeralRunners),
len(runningEphemeralRunners),
Expand Down
25 changes: 14 additions & 11 deletions controllers/actions.github.com/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@ var labels = []string{
"name",
"namespace",
"repo",
"owner",
"organization",
"enterprise",
"configUrl",
}

type CommonLabels struct {
Name string
Namespace string
Repo string
Owner string
ConfigURL string
Name string
Namespace string
Repo string
Organization string
Enterprise string
ConfigURL string
}

func (l *CommonLabels) labels() prometheus.Labels {
return prometheus.Labels{
"name": l.Name,
"namespace": l.Namespace,
"repo": l.Repo,
"owner": l.Owner,
"configUrl": l.ConfigURL,
"name": l.Name,
"namespace": l.Namespace,
"repo": l.Repo,
"organization": l.Organization,
"enterprise": l.Enterprise,
"configUrl": l.ConfigURL,
}
}

Expand Down

0 comments on commit 52a354a

Please sign in to comment.