Skip to content

Gave the collector code a good scrub.#7961

Merged
knative-prow-robot merged 1 commit intoknative:masterfrom
markusthoemmes:cleanup-collector
May 15, 2020
Merged

Gave the collector code a good scrub.#7961
knative-prow-robot merged 1 commit intoknative:masterfrom
markusthoemmes:cleanup-collector

Conversation

@markusthoemmes
Copy link
Contributor

Proposed Changes

  • Removed overkill double-checked locking for more code clarity.
  • Reorganized code fragments to group common pieces.
  • Defer ticker.Stop() for extra sanity.
  • Renamed error to reflect true meaning.
  • Removed unnecessary function indirection.
  • Used fake tickProvider in the last missing test to push test runtimes from 3s to ~15ms.

Release Note

NONE

/assign @julz @vagababov

- Removed overkill double-checked locking for more code clarity.
- Reorganized code fragments to group common pieces.
- Defer ticker.Stop() for extra sanity.
- Renamed error to reflect true meaning.
- Removed unnecessary function indirection.
- Used fake tickProvider in the last missing test to push test runtimes from 3s to ~15ms.
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 15, 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.

@markusthoemmes: 0 warnings.

Details

In response to this:

Proposed Changes

  • Removed overkill double-checked locking for more code clarity.
  • Reorganized code fragments to group common pieces.
  • Defer ticker.Stop() for extra sanity.
  • Renamed error to reflect true meaning.
  • Removed unnecessary function indirection.
  • Used fake tickProvider in the last missing test to push test runtimes from 3s to ~15ms.

Release Note

NONE

/assign @julz @vagababov

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.

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markusthoemmes

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

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. area/autoscale labels May 15, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 15, 2020
}
key := types.NamespacedName{Namespace: metric.Namespace, Name: metric.Name}

c.collectionsMutex.RLock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before y'all yell at me: The maximum concurrency at this piece of code is 2. I think I only put this in here because doubly-checked locking was my favorite toy at the time. 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

😂

@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/metrics/collector.go 95.8% 98.3% 2.5

@julz
Copy link
Contributor

julz commented May 15, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 15, 2020
@knative-prow-robot knative-prow-robot merged commit abe4357 into knative:master May 15, 2020
@julz julz mentioned this pull request Jul 23, 2020
3 tasks
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/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.

6 participants