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

Add apiserver metric for number of requests dropped by 'max-inflight-requests' filters. #58340

Merged
merged 1 commit into from
Jan 19, 2018

Conversation

gmarek
Copy link
Contributor

@gmarek gmarek commented Jan 16, 2018

Useful for figuring out on which dimension master is overloaded.

cc @sttts @lavalamp @deads2k @timothysc @hulkholden

Add apiserver metric for number of requests dropped because of inflight limit.

@gmarek gmarek added the release-note-none Denotes a PR that doesn't merit a release note. label Jan 16, 2018
@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jan 16, 2018
},
)
// DroppedMutatingRequests is a number of mutating requests dropped with 'Try again later' reponse
DroppedMutatingRequests = prometheus.NewCounter(
Copy link
Member

Choose a reason for hiding this comment

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

Why can't we have a single metric with label mutating set to true or false?
I think it would be much cleaner when looking into it.

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 was considering this, but I'm not sure how prometheus is implemented. It might have a lock per variable, not variable:label-set pair, which would make two variables slightly more efficient. If that's the case we gain a bit on contention by paying a bit on cleanness of code (but also not much), which is why I chose two variables approach.

Copy link
Member

Choose a reason for hiding this comment

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

Personally I don't think it just cleanness of the code. If I don't know the metrics (and I will forget about it in few months probably), as soon as I will find the first one I will stop looking further. So i think it may be misleading for people using them.

That said, raising the lock contention here is a good point. But I'm not convinced how much effect this lock contention would have. Do we have some measurements? My personal opinion is that due to how apiserver is structures, those channels for tokens for max inflight requests, etc., the increase cost of lock contention will be negligible.

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'll take your word on that.

@gmarek gmarek added the release-note-none Denotes a PR that doesn't merit a release note. label Jan 16, 2018
@k8s-ci-robot k8s-ci-robot removed the release-note-none Denotes a PR that doesn't merit a release note. label Jan 16, 2018
@timothysc timothysc added sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 17, 2018
@@ -106,6 +107,12 @@ func WithMaxInFlightLimit(
}
}
metrics.Record(r, requestInfo, "", http.StatusTooManyRequests, 0, 0)
// We need to split this data between buckets used for throttling.
Copy link
Contributor

Choose a reason for hiding this comment

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

move to the top as droppedRequestBucket

Copy link
Contributor

Choose a reason for hiding this comment

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

or shouldn't we add all this logic to metrics.Record?

@wojtek-t
Copy link
Member

/lgtm
/approve no-issue

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gmarek, wojtek-t

Associated issue requirement bypassed by: wojtek-t

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2018
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 58446, 58459, 58340). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 07ad1f7 into kubernetes:master Jan 19, 2018
k8s-github-robot pushed a commit that referenced this pull request Jan 29, 2018
…-#58340-#58342-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #58340: Add apiserver metric for number of requests dropped by #58342: Add a metric to track usage of inflight request limit.

Cherry pick of #58340 #58342 on release-1.8.

#58340: Add apiserver metric for number of requests dropped by
#58342: Add a metric to track usage of inflight request limit.

```release-note
Add apiserver metric for current inflight-request usage and number of requests dropped because of inflight limit.
```
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jan 29, 2018
k8s-github-robot pushed a commit that referenced this pull request Jan 30, 2018
…58342-upstream-release-1.9

Automatic merge from submit-queue.

Automated cherry pick of #58340: Add apiserver metric for number of requests dropped by #58342: Add a metric to track usage of inflight request limit.

Cherry pick of #58340 #58342 on release-1.9.

#58340: Add apiserver metric for number of requests dropped by
#58342: Add a metric to track usage of inflight request limit.

```release-note
Add apiserver metric for current inflight-request usage and number of requests dropped because of inflight limit.
```
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants