Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Added prometheus metrics around bundle condition transitions #300

Merged
merged 4 commits into from
Jun 29, 2018

Conversation

ychen-atlassian
Copy link
Contributor

This adds a bunch of metrics into prometheus endpoint about bundle transitions, which would be useful for alerting purposes.

Also proposal for the same PR: How about expanding the error enums?

E.g. for resources we often just spit out the error but it would be useful to categorize if the Spec was wrong or service catalog didn't respond or if the resource couldn't be created.

	spec, err := st.evalSpec(res, actual)
	if err != nil {
		return resourceInfo{
			status: resourceStatusError{
 /// this thing could have something like "ResourceSpecInvalidError"?
				err: err,
			},
		}

ash2k
ash2k previously requested changes Jun 28, 2018
Copy link
Contributor

@ash2k ash2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but I don't fully understand it - see the question in comments. "Needs work" because of some minor issues with boolen ORing.

blockedUpdated := updateResourceCondition(st.bundle, res.Name, &blockedCond) || bundleUpdated
inProgressUpdated := updateResourceCondition(st.bundle, res.Name, &inProgressCond) || bundleUpdated
readyUpdated := updateResourceCondition(st.bundle, res.Name, &readyCond) || bundleUpdated
errorUpdated := updateResourceCondition(st.bundle, res.Name, &errorCond) || bundleUpdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove || bundleUpdated here and above.

bundleUpdated = updateBundleCondition(st.bundle, &errorCond) || bundleUpdated
inProgressUpdated := updateBundleCondition(st.bundle, &inProgressCond) || bundleUpdated
readyUpdated := updateBundleCondition(st.bundle, &readyCond) || bundleUpdated
errorUpdated := updateBundleCondition(st.bundle, &errorCond) || bundleUpdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove || bundleUpdated here and above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops - vim replacement errors

st.bundleTransitionCounter.
WithLabelValues(st.bundle.GetNamespace(), st.bundle.GetName(), string(errorCond.Type), errorCond.Reason).
Inc()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all these ifs can be moved to updateBundleCondition(), right? Same with updateResourceCondition().

WithLabelValues(st.bundle.GetNamespace(), st.bundle.GetName(), string(readyCond.Type), readyCond.Reason).
Inc()
}
if errorUpdated && errorCond.Status == smith_v1.ConditionTrue {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is the logic here? We increment when a condition becomes true. But what does that show? Why not when it becomes false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment on the other PR

@ash2k ash2k requested a review from a team June 28, 2018 10:40
@ash2k
Copy link
Contributor

ash2k commented Jun 29, 2018

Also proposal for the same PR: How about expanding the error enums?

Forgot to answer. We need to rework how we propagate errors within Smith. We have #276 for this work, lets do it in another PR.

@ychen-atlassian ychen-atlassian force-pushed the add-bundle-transition-metrics branch from 83296d2 to 0b5c921 Compare June 29, 2018 02:28
@ychen-atlassian ychen-atlassian dismissed ash2k’s stale review June 29, 2018 03:18

I did the review, but this thing won't let me close the "requested changes"

@ychen-atlassian ychen-atlassian merged commit 0902d29 into master Jun 29, 2018
@ash2k ash2k deleted the add-bundle-transition-metrics branch June 29, 2018 07:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants