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

Adds support for global circuit budget #6013

Merged
merged 18 commits into from
Jan 2, 2024

Conversation

davinci26
Copy link
Contributor

Solves #6001

@davinci26 davinci26 requested a review from a team as a code owner December 12, 2023 23:07
@davinci26 davinci26 requested review from tsaarni and stevesloka and removed request for a team December 12, 2023 23:07
@sunjayBhatia sunjayBhatia requested review from a team, skriss and clayton-gonsalves and removed request for a team December 12, 2023 23:07
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a579ec3) 78.70% compared to head (e4a5cbb) 78.77%.
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6013      +/-   ##
==========================================
+ Coverage   78.70%   78.77%   +0.07%     
==========================================
  Files         138      138              
  Lines       19717    19745      +28     
==========================================
+ Hits        15518    15555      +37     
+ Misses       3895     3887       -8     
+ Partials      304      303       -1     
Files Coverage Δ
cmd/contour/servecontext.go 83.88% <100.00%> (+0.03%) ⬆️
internal/dag/gatewayapi_processor.go 93.74% <100.00%> (+<0.01%) ⬆️
internal/dag/httpproxy_processor.go 91.94% <100.00%> (+0.01%) ⬆️
internal/dag/ingress_processor.go 97.61% <100.00%> (+0.01%) ⬆️
internal/dag/policy.go 95.65% <100.00%> (+0.12%) ⬆️
pkg/config/parameters.go 86.39% <ø> (ø)
cmd/contour/serve.go 20.77% <75.00%> (+1.27%) ⬆️

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26 davinci26 removed the request for review from clayton-gonsalves December 12, 2023 23:12
@davinci26
Copy link
Contributor Author

removing @clayton-gonsalves since he is on PAT leave (if you see this feel free to review anyway).

Adding @shadialtarsha and @seth-epps as well

@davinci26 davinci26 added the release-note/small A small change that needs one line of explanation in the release notes. label Dec 12, 2023
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Copy link
Contributor

@shadialtarsha shadialtarsha left a comment

Choose a reason for hiding this comment

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

I think the code makes sense to me.
I have 2 questions:

  1. What will happen if not all GlobalCircuitBreakerDefaults attributes are defined? I think they will have the value 0 and we will default to Envoy settings again which makes sense but I would clarify this in the doc.
  2. Wondering if we can write e2e tests for this feature. I know it might be tricky.

cmd/contour/servecontext.go Outdated Show resolved Hide resolved
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @davinci26! Overall this makes sense to me, added some comments.

apis/projectcontour/v1alpha1/contourconfig.go Outdated Show resolved Hide resolved
apis/projectcontour/v1alpha1/contourconfig.go Outdated Show resolved Hide resolved
pkg/config/parameters.go Outdated Show resolved Hide resolved
pkg/config/parameters.go Outdated Show resolved Hide resolved
pkg/config/parameters.go Outdated Show resolved Hide resolved
cmd/contour/serve.go Show resolved Hide resolved
@@ -87,6 +88,8 @@ const (
statusUpdateConflict = "contour_status_update_conflict_total"
statusUpdateNoop = "contour_status_update_noop_total"
statusUpdateDurationSeconds = "contour_status_update_duration_seconds"

ContourCircuitBreakerSettings = "contour_dag_circuit_breaker_settings"
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why you want to expose this as a metric? We don't really have any other metrics like this, so it's a little unusual.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you explain why you want to expose this as a metric?

We want to alert and build graphs on this as a defence in depth. We have discovered during a deployment that we accidentally deleted those annotations and that caused issues and that was really painful to debug.

Basically it helps with the discoverability of what people are setting across the cluster.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, I would expect something like this to be exposed via resource Status or something similar rather than a Contour xDS server metric

Also I believe we have an issue/PR to expand on cluster circuit breaker metrics: https://www.envoyproxy.io/docs/envoy/latest/configuration/upstream/cluster_manager/cluster_stats#circuit-breakers-statistics (here: #5950)

I don't want to hold up the rest of the change, so maybe lets pull the metrics part out into another PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, I would expect something like this to be exposed via resource Status or something similar rather than a Contour xDS server metric

Personally I take a more liberal approach to metrics in the sense that, if contour makes the decision to set a specific value it would be useful for operators to know the decision at runtime, especially if it affect things

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 want to hold up the rest of the change, so maybe lets pull the metrics part out into another PR?

I won't die on this hill :D, So I can separate the changes into two PRs. But my general take is that adding the metric is pretty "cheap" and overall useful. I.e. there have been cases where I wish I had this metric tracked.

Signed-off-by: Sotiris Nanopoulos <[email protected]>
apis/projectcontour/v1alpha1/contourconfig.go Outdated Show resolved Hide resolved
internal/dag/policy.go Show resolved Hide resolved
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

@skriss this is ready for another review round

cmd/contour/serve.go Show resolved Hide resolved
site/content/docs/main/configuration.md Outdated Show resolved Hide resolved
changelogs/unreleased/6013-davinci26-small.md Outdated Show resolved Hide resolved
changelogs/unreleased/6013-davinci26-small.md Outdated Show resolved Hide resolved
Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26 davinci26 added release-note/minor A minor change that needs about a paragraph of explanation in the release notes. and removed release-note/small A small change that needs one line of explanation in the release notes. labels Dec 18, 2023
@davinci26
Copy link
Contributor Author

@skriss unless there is an embarrassing bug somewhere this is ready

@davinci26
Copy link
Contributor Author

@skriss maybe we close/merge this today before the holiday break?

@skriss
Copy link
Member

skriss commented Dec 20, 2023

Looks like we got some merge conflicts, if you can resolve those I'll take another look

@davinci26
Copy link
Contributor Author

@skriss merge conflicts resolved

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

This LGTM, I'm approving with comments that need to be addressed but can be done in a follow-up PR if preferred. Will leave for another maintainer to take a look as well. Thanks @davinci26!

internal/metrics/metrics.go Outdated Show resolved Hide resolved
internal/metrics/metrics.go Outdated Show resolved Hide resolved
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

@projectcontour/maintainers can someone PTAL as well

Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

i think everything LGTM minus the metric part, I wonder if we can pull that out into a separate PR so we can discuss a little more?

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

i think everything LGTM minus the metric part, I wonder if we can pull that out into a separate PR so we can discuss a little more?

Will do it in a separate PR

@davinci26
Copy link
Contributor Author

there is more cleanup to be made

Signed-off-by: Sotiris Nanopoulos <[email protected]>
@davinci26
Copy link
Contributor Author

I think I got all the references now

Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
Signed-off-by: Sotiris Nanopoulos <[email protected]>
@sunjayBhatia sunjayBhatia merged commit b474d10 into projectcontour:main Jan 2, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor A minor change that needs about a paragraph of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants