Skip to content

Commit 8cb4ed8

Browse files
Merge pull request #1342 from openshift-cherrypick-robot/cherry-pick-1340-to-release-4.4
[release-4.4] Bug 1809646: Update subscription_sync_count to include the package name
2 parents 243899f + c2b38e8 commit 8cb4ed8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/controller/operators/catalog/subscription/syncer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (s *subscriptionSyncer) recordMetrics(sub *v1alpha1.Subscription) {
9191
return
9292
}
9393

94-
metrics.CounterForSubscription(sub.GetName(), sub.Status.InstalledCSV, sub.Spec.Channel).Inc()
94+
metrics.CounterForSubscription(sub.GetName(), sub.Status.InstalledCSV, sub.Spec.Channel, sub.Spec.Package).Inc()
9595
}
9696

9797
func (s *subscriptionSyncer) Notify(event kubestate.ResourceEvent) {

pkg/metrics/metrics.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const (
1818
VERSION_LABEL = "version"
1919
PHASE_LABEL = "phase"
2020
REASON_LABEL = "reason"
21+
PACKAGE_LABEL = "package"
2122
)
2223

2324
// TODO(alecmerdler): Can we use this to emit Kubernetes events?
@@ -149,7 +150,7 @@ var (
149150
Name: "subscription_sync_total",
150151
Help: "Monotonic count of subscription syncs",
151152
},
152-
[]string{NAME_LABEL, INSTALLED_LABEL, CHANNEL_LABEL},
153+
[]string{NAME_LABEL, INSTALLED_LABEL, CHANNEL_LABEL, PACKAGE_LABEL},
153154
)
154155

155156
csvSucceeded = prometheus.NewGaugeVec(
@@ -183,8 +184,8 @@ func RegisterCatalog() {
183184
prometheus.MustRegister(SubscriptionSyncCount)
184185
}
185186

186-
func CounterForSubscription(name, installedCSV, channelName string) prometheus.Counter {
187-
return SubscriptionSyncCount.WithLabelValues(name, installedCSV, channelName)
187+
func CounterForSubscription(name, installedCSV, channelName, packageName string) prometheus.Counter {
188+
return SubscriptionSyncCount.WithLabelValues(name, installedCSV, channelName, packageName)
188189
}
189190

190191
func EmitCSVMetric(oldCSV *olmv1alpha1.ClusterServiceVersion, newCSV *olmv1alpha1.ClusterServiceVersion) {

0 commit comments

Comments
 (0)