-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 Backend Service Custom Metrics. #13205
Open
efimki
wants to merge
12
commits into
GoogleCloudPlatform:main
Choose a base branch
from
efimki:custom_metrics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+255
−2
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b4ae5ff
Add Backend Service Custom Metrics.
efimki d03dbd5
Add an example.
efimki 267a5a2
Add max_utilization to an example.
efimki a64accf
Set load_balancing_scheme = "EXTERNAL_MANAGED"
efimki 6e2310a
Use hybrid NEG.
efimki 1d8b4d6
Remove provider=google-beta
efimki c822f4a
Add back provider = google-beta
efimki d4d289c
Make tests work locally.
efimki e0cfbae
Add Custom Metrics to Region Backend Service.
efimki 0c9fbe4
Fix trailing whitespace.
efimki d02c413
Merge remote-tracking branch 'upstream/main' into custom_metrics
efimki d04c045
Address review comments.
efimki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
mmv1/templates/terraform/examples/backend_service_custom_metrics.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
resource "google_compute_network" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "network_name"}}" | ||
} | ||
|
||
// Zonal NEG with GCE_VM_IP_PORT | ||
resource "google_compute_network_endpoint_group" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "default_neg_name"}}" | ||
network = google_compute_network.default.id | ||
default_port = "90" | ||
zone = "us-central1-a" | ||
network_endpoint_type = "GCE_VM_IP_PORT" | ||
} | ||
|
||
resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
name = "{{index $.Vars "backend_service_name"}}" | ||
health_checks = [google_compute_health_check.default.id] | ||
|
||
# WEIGHTED_ROUND_ROBIN and CUSTOM_METRICS require EXTERNAL_MANAGED. | ||
load_balancing_scheme = "EXTERNAL_MANAGED" | ||
locality_lb_policy = "WEIGHTED_ROUND_ROBIN" | ||
custom_metrics { | ||
name = "orca.application_utilization" | ||
# At least one metric should be not dry_run. | ||
dry_run = false | ||
} | ||
backend { | ||
group = google_compute_network_endpoint_group.default.id | ||
balancing_mode = "CUSTOM_METRICS" | ||
custom_metrics { | ||
name = "orca.cpu_utilization" | ||
max_utilization = 0.9 | ||
dry_run = true | ||
} | ||
custom_metrics { | ||
name = "orca.named_metrics.foo" | ||
# At least one metric should be not dry_run. | ||
dry_run = false | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_health_check" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "health_check_name"}}" | ||
timeout_sec = 1 | ||
check_interval_sec = 1 | ||
|
||
tcp_health_check { | ||
port = "80" | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
mmv1/templates/terraform/examples/region_backend_service_ilb_custom_metrics.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
resource "google_compute_network" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "network_name"}}" | ||
} | ||
|
||
// Zonal NEG with GCE_VM_IP_PORT | ||
resource "google_compute_network_endpoint_group" "default" { | ||
provider = google-beta | ||
name = "{{index $.Vars "default_neg_name"}}" | ||
network = google_compute_network.default.id | ||
default_port = "90" | ||
zone = "us-central1-a" | ||
network_endpoint_type = "GCE_VM_IP_PORT" | ||
} | ||
|
||
resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { | ||
provider = google-beta | ||
|
||
region = "us-central1" | ||
name = "{{index $.Vars "region_backend_service_name"}}" | ||
health_checks = [google_compute_health_check.health_check.id] | ||
load_balancing_scheme = "INTERNAL_MANAGED" | ||
locality_lb_policy = "WEIGHTED_ROUND_ROBIN" | ||
custom_metrics { | ||
name = "orca.application_utilization" | ||
# At least one metric should be not dry_run. | ||
dry_run = false | ||
} | ||
backend { | ||
group = google_compute_network_endpoint_group.default.id | ||
balancing_mode = "CUSTOM_METRICS" | ||
custom_metrics { | ||
name = "orca.cpu_utilization" | ||
max_utilization = 0.9 | ||
dry_run = true | ||
} | ||
custom_metrics { | ||
name = "orca.named_metrics.foo" | ||
# At least one metric should be not dry_run. | ||
dry_run = false | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_health_check" "health_check" { | ||
provider = google-beta | ||
name = "{{index $.Vars "health_check_name"}}" | ||
http_health_check { | ||
port = 80 | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not need maxUtilization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, only customMetrics that are set on the Backend (as opposed to BackendService) need maxUtilization.