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

TemplateInstance metrics update #19133

Merged
merged 2 commits into from
Mar 29, 2018
Merged

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Mar 28, 2018

tweak of #18650

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 28, 2018
@bparees
Copy link
Contributor Author

bparees commented Mar 28, 2018

@gabemontero ptal

Copy link
Contributor

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

Just a minor question around the time function used wrt the core prometheus stuff ... if there is an unexpected inconsistency, let's address

if it was intentional, some comments explaining when time.Now() vs. time.Unix() are used (unless there is some commonality between those I'm forgetting ... didn't bring up the golang doc to see)

otherwise generally looks like what I remember from Jim's original pull and am assuming you transported those as is

}

func (c *TemplateInstanceController) Collect(ch chan<- prometheus.Metric) {
templateInstanceCompleted.Collect(ch)

now := c.clock.Now()
Copy link
Contributor

Choose a reason for hiding this comment

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

I forget, was there a reason that unix epoch time was not used here?

Curious on the req here vs. what we had to the for build's active metric

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, c.clock will be an instance of RealClock which has as its Now implementation:

// Now returns the current time.
func (RealClock) Now() time.Time {
	return time.Now()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(it was done this way to provide an abstraction for the clock implementation so tests could plug in their own clock impl)

`

clock := &fakeClock{now: time.Unix(0, 0)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah here we are using unix epoch ...

@@ -80,6 +83,7 @@ func NewTemplateInstanceController(config *rest.Config, kc kclientsetinternal.In
informer: informer.Informer(),
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "openshift_template_instance_controller"),
readinessLimiter: workqueue.NewItemFastSlowRateLimiter(5*time.Second, 20*time.Second, 200),
clock: clock.RealClock{},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gabemontero
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, gabemontero

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2018
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@bparees
Copy link
Contributor Author

bparees commented Mar 28, 2018

@adambkaplan mildly relevant to your interests.

@bparees bparees added the lgtm Indicates that a PR is ready to be merged. label Mar 29, 2018
@openshift-merge-robot openshift-merge-robot merged commit b58be93 into openshift:master Mar 29, 2018
@bparees bparees deleted the metrics branch April 2, 2018 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants