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

Propagate Metric status changes to the API. #7525

Merged

Conversation

markusthoemmes
Copy link
Contributor

Proposed Changes

The Metric status changes have never been reflected to the API itself, which make them not very useful. This does a few things:

  1. Move status determination into the reconciler.
  2. Connect the collector with the reconciler to be able to inform it about changes of status. The mechanism is the same as for the Multiscaler/KPA reconciler.
  3. Actually set a status that is reflected into the API.

Release Note

Metric status is now reflected in the API.

/assign @taragu @vagababov

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 7, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 7, 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.

In response to this:

Proposed Changes

The Metric status changes have never been reflected to the API itself, which make them not very useful. This does a few things:

  1. Move status determination into the reconciler.
  2. Connect the collector with the reconciler to be able to inform it about changes of status. The mechanism is the same as for the Multiscaler/KPA reconciler.
  3. Actually set a status that is reflected into the API.

Release Note

Metric status is now reflected in the API.

/assign @taragu @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

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/API API objects and controllers area/autoscale labels Apr 7, 2020
pkg/autoscaler/metrics/collector.go Show resolved Hide resolved
logger = logger.Named("collector").With(
zap.String(logkey.Key, fmt.Sprintf("%s/%s", metric.Namespace, metric.Name)))
key := types.NamespacedName{Namespace: metric.Namespace, Name: metric.Name}
logger = logger.Named("collector").With(zap.String(logkey.Key, key.String()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd just go WithValue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do the zap.String thing everywhere we use logkey.Key and a stringified "namespace/name"

pkg/autoscaler/metrics/collector.go Outdated Show resolved Hide resolved
@@ -66,5 +66,7 @@ func NewController(
},
})

collector.Watch(impl.EnqueueKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here it presumes metrics name == pa name.
Probably fine, but 🤷‍♂

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 don't think it does? The collector manages metrics and this keys off of metrics. Both are Metric names.

pkg/reconciler/metric/metric.go Outdated Show resolved Hide resolved
@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 97.0% 95.8% -1.3
pkg/reconciler/metric/controller.go 85.7% 86.7% 1.0

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

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2020
@knative-prow-robot knative-prow-robot merged commit d1c1e34 into knative:master Apr 7, 2020
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.

6 participants