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

Combine ready, not ready, terminating, and pending pod counter reporters #6617

Merged
merged 2 commits into from
Jan 30, 2020

Conversation

taragu
Copy link
Contributor

@taragu taragu commented Jan 23, 2020

/lint

Addresses #6476 (comment)

Proposed Changes

Combine ready, not ready, terminating, and pending pod counter reporters

Release Note

NONE

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jan 23, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 23, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@taragu: 0 warnings.

In response to this:

/lint

Addresses #6476 (comment)

Proposed Changes

Combine ready, not ready, terminating, and pending pod counter reporters

Release Note

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.


// ReportTerminatingPodCount of a mockReporter does nothing and return nil for error.
func (r *mockReporter) ReportTerminatingPodCount(v int64) error {
func (r *mockReporter) ReportActualPodCount(ready, notReady, terminating, pending int64) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

the name should probably be ReportPodCounts since ActualPodCount refers to the ready pods in the metrics.

I wonder if we should change actual_pods to ready_pods here for the metrics to match better with the rest of the metrics we report. wdyt @vagababov @markusthoemmes ?

return r.report(terminatingPodCountM.M(v))
// ReportActualPodCount captures values for ready, not ready, terminating, and pending pod count measure.
func (r *Reporter) ReportActualPodCount(ready, notReady, terminating, pending int64) error {
var err error
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this error variable is needed.

// ReportActualPodCount captures values for ready, not ready, terminating, and pending pod count measure.
func (r *Reporter) ReportActualPodCount(ready, notReady, terminating, pending int64) error {
var err error
if err = r.report(actualPodCountM.M(ready)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if err = r.report(actualPodCountM.M(ready)); err != nil {
if err := r.report(actualPodCountM.M(ready)); err != nil {

Apply to all others as well.

@markusthoemmes
Copy link
Contributor

/assign

var err error
if err = r.report(actualPodCountM.M(ready)); err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The only error in those is

if !r.initialized {
		return errors.New("StatsReporter is not initialized yet")
	}

which means we can just check it at the beginning and then just call report.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or ditch this check altogether 😂

Copy link
Contributor

Choose a reason for hiding this comment

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

I am all for ditching checks 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an orthogonal cleanup and probably was added for a reason (not sure which, but 🤷‍♂ )

Copy link
Contributor

Choose a reason for hiding this comment

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

you mean the PR or the check?

I asked @taragu to do the PR as a followup to this conversation: #6476 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

the check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we ditch r.initialized altogether? It seems it's not being used elsewhere except for the check

if !r.initialized {
		return errors.New("StatsReporter is not initialized yet")
	}

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah afaik it doesn't do something useful.

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 30, 2020
@taragu taragu force-pushed the cleanup-report-podcounts branch from 1ef9553 to 6518de6 Compare January 30, 2020 21:26
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/autoscaler/stats_reporter.go 96.8% 96.3% -0.5
pkg/reconciler/autoscaling/kpa/kpa.go 91.9% 91.7% -0.2

Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: taragu, vagababov

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2020
@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests pull-knative-serving-integration-tests 1/3

Automatically retrying due to test flakiness...
/test pull-knative-serving-integration-tests

@knative-prow-robot knative-prow-robot merged commit 4ab91ed into knative:master Jan 30, 2020
@taragu taragu deleted the cleanup-report-podcounts branch February 18, 2020 15:07
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. area/API API objects and controllers area/autoscale cla: yes Indicates the PR's author has signed the CLA. 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.

8 participants