Skip to content

Commit

Permalink
chore: this fix will only increment metrics if there are actually res…
Browse files Browse the repository at this point in the history
…ults which implies the backend was called (#295)

Signed-off-by: Alex Jones <[email protected]>
  • Loading branch information
AlexsJones authored Dec 14, 2023
1 parent 87b8767 commit f496f3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/k8sgpt_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (r *K8sGPTReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
return r.finishReconcile(err, false)
}
// Update metrics count
if k8sgptConfig.Spec.AI.Enabled {
if k8sgptConfig.Spec.AI.Enabled && len(response.Results) > 0 {
k8sgptNumberOfBackendAICalls.With(prometheus.Labels{
"backend": k8sgptConfig.Spec.AI.Backend,
"deployment": deployment.Name,
Expand Down

0 comments on commit f496f3e

Please sign in to comment.