Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: When a result is updated it is incorrectly marked as incremented in the metrics count #81

Closed
3 of 4 tasks
AlexsJones opened this issue May 11, 2023 · 0 comments
Assignees

Comments

@AlexsJones
Copy link
Member

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

v0.3.0

Kubernetes Version

v1.27.0

Host OS and its Version

Ubuntu

Steps to reproduce

// Update metrics
			k8sgptNumberOfResultsByType.With(prometheus.Labels{
				"kind": resultSpec.Kind,
				"name": resultSpec.Name,
			}).Inc()
			

			err = r.Create(ctx, &result)
			if err != nil {
				// if the result already exists, we will update it
				if errors.IsAlreadyExists(err) {
					// Get the actual result with metadata rather than our local construct
					var newResult corev1alpha1.Result
					err = r.Get(ctx, client.ObjectKey{Namespace: k8sgptConfig.Namespace,
						Name: name}, &newResult)
					if err != nil {
						k8sgptReconcileErrorCount.Inc()
						return r.finishReconcile(err, false)
					}

Expected behaviour

This should be moved to the create phase only

Actual behaviour

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant