-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Metricbeat] Add support for multiple regions in GCP #32964
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
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.
A couple of things I think needs to be improved before merging, but overall 👍
return f | ||
} | ||
|
||
switch serviceName { | ||
case gcp.ServiceCompute: | ||
if r.config.Region != "" && r.config.Zone != "" { |
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.
This condition should take into account the case where region
and regions
are both configured
} | ||
|
||
f = fmt.Sprintf(`%s AND resource.labels.location = "%s"`, f, r.config.Region) | ||
return f |
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.
Is this return needed? If not I would remove it there is just one return at the end (where we also log the full filter).
if len(r.config.Regions) != 0 { | ||
regionsFilter := r.buildRegionsFilter(r.config.Regions, gcp.ComputeResourceLabelZone) | ||
f = fmt.Sprintf("%s AND %s", f, regionsFilter) | ||
} | ||
case gcp.ServiceGKE: | ||
if r.config.Region != "" && r.config.Zone != "" { |
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.
This cThis condition should take into account the case where region
and regions
are both configured
} | ||
case gcp.ServicePubsub, gcp.ServiceLoadBalancing, gcp.ServiceCloudFunctions, gcp.ServiceFirestore, gcp.ServiceDataproc: | ||
return f | ||
case gcp.ServiceStorage: | ||
if r.config.Region == "" { | ||
return f | ||
switch { |
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.
Here should be added the warning about region
taking precedence over regions
@gpop63 I notice we use a |
5883353
to
ecc40c6
Compare
* add regions config setting and pass it as argument * add services region resource label constants * add buildRegionsFilter and update getFilterForMetric logic * add getFilterForMetric and buildRegionsFilter tests * add changelog entry * minor changes for golangci-lint * add warn logs and remove redundant return * add missing argument in warnf log (cherry picked from commit 3bcefab)
I'm going to backport this to 7.17, otherwise this change would make our integration not compatible with the 7.x branch. |
* add regions config setting and pass it as argument * add services region resource label constants * add buildRegionsFilter and update getFilterForMetric logic * add getFilterForMetric and buildRegionsFilter tests * add changelog entry * minor changes for golangci-lint * add warn logs and remove redundant return * add missing argument in warnf log (cherry picked from commit 3bcefab) # Conflicts: # x-pack/metricbeat/module/gcp/metrics/compute/metadata.go # x-pack/metricbeat/module/gcp/metrics/metrics_requester.go # x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go # x-pack/metricbeat/module/gcp/metrics/metricset.go
Removing backport as backport is not needed. |
@@ -145,6 +145,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. | |||
- Add regex support for drop_fields processor. | |||
- Improve compatibility and reduce flakyness of Python tests {pull}31588[31588] | |||
- Added `.python-version` file {pull}32323[32323] | |||
- Add support for multiple regions in GCP {pull}32964[32964] |
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.
Just saw this changelog is under developer changelog, should this be under CHANGELOG-next?
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.
You're right! @gpop63 may you please add this line to CHANGELOG.next
with a separate PR?
* add regions config setting and pass it as argument * add services region resource label constants * add buildRegionsFilter and update getFilterForMetric logic * add getFilterForMetric and buildRegionsFilter tests * add changelog entry * minor changes for golangci-lint * add warn logs and remove redundant return * add missing argument in warnf log
What does this PR do?
Adds support for multiple regions in
GCP
.Why is it important?
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs