Skip to content

Commit

Permalink
Chore/metrics data (#94)
Browse files Browse the repository at this point in the history
* fix: bug in the name matching of results

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: fixing bad metric data

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: fixing bad metric data

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

---------

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones committed May 12, 2023
1 parent 0843174 commit d136a6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/k8sgpt_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,15 @@ func (r *K8sGPTReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
if len(resultList.Items) > 0 {
// If the result does not exist in the map we will delete it
for _, result := range resultList.Items {
fmt.Printf("Checking if %s is still relevant\n", result.Name)
if _, ok := rawResults[result.Name]; !ok {
err = r.Delete(ctx, &result)
if err != nil {
k8sgptReconcileErrorCount.Inc()
return r.finishReconcile(err, false)
} else {
k8sgptNumberOfResultsByType.With(prometheus.Labels{
"kind": result.Kind,
"kind": result.Spec.Kind,
"name": result.Name,
}).Dec()
}
Expand All @@ -246,7 +247,7 @@ func (r *K8sGPTReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
return r.finishReconcile(err, false)
} else {
k8sgptNumberOfResultsByType.With(prometheus.Labels{
"kind": result.Kind,
"kind": result.Spec.Kind,
"name": result.Name,
}).Inc()
}
Expand Down

0 comments on commit d136a6c

Please sign in to comment.