Skip to content

Commit

Permalink
Reset metric
Browse files Browse the repository at this point in the history
  • Loading branch information
bmangoen committed Mar 1, 2023
1 parent 0ada02a commit a0ba354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/controller/servicemesh/memberroll/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ func (r *MemberRollReconciler) reconcileObject(ctx context.Context, roll *maistr
switch len(meshList.Items) {
case 0:
mesh = nil
internalmetrics.ResetMemberCounter()
case 1:
mesh = &meshList.Items[0]
internalmetrics.ResetMemberCounter()
default: // more than 1 SMCP found
reason := maistrav1.ConditionReasonMultipleSMCP
message := "Multiple ServiceMeshControlPlane resources exist in the namespace"
Expand Down
4 changes: 4 additions & 0 deletions pkg/internalmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ func GetMemberCounter(smcpNamespace, smcpVersion, smcpMode string) prometheus.Ga
labelSMCPMode: smcpMode,
})
}

func ResetMemberCounter() {
Metrics.MemberCounter.Reset()
}

0 comments on commit a0ba354

Please sign in to comment.