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

[Metricbeat] Add GCP CloudSQL region filter #32943

Merged
merged 14 commits into from
Sep 19, 2022

Conversation

gpop63
Copy link
Contributor

@gpop63 gpop63 commented Aug 31, 2022

What does this PR do?

Adds GCP cloudsql region filter.

Why is it important?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 31, 2022
@gpop63 gpop63 added the Team:Cloud-Monitoring Label for the Cloud Monitoring team label Aug 31, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 31, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 31, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @gpop63? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@mergify mergify bot assigned gpop63 Aug 31, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 31, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-19T11:20:26.299+0000

  • Duration: 52 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 1316
Skipped 87
Total 1403

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Sep 8, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_gcp-cloudsql_region_filter upstream/add_gcp-cloudsql_region_filter
git merge upstream/main
git push upstream add_gcp-cloudsql_region_filter

@@ -152,7 +157,7 @@ func (r *metricsRequester) getFilterForMetric(serviceName, m string) string {
// }

region := strings.TrimSuffix(r.config.Region, "*")
f = fmt.Sprintf(`%s AND resource.labels.zone = starts_with("%s")`, f, region)
f = fmt.Sprintf(`%s AND resource.labels.region = starts_with("%s")`, f, region)
Copy link
Member

Choose a reason for hiding this comment

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

Please do not include this change here, as it's not related to CloudSQL. This change is also a breaking change, so we need to take another approach.
I would add a comment, so we can remove this in the future: FIXME: this is using zone but should use region. This is a breaking change.

@mergify
Copy link
Contributor

mergify bot commented Sep 11, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_gcp-cloudsql_region_filter upstream/add_gcp-cloudsql_region_filter
git merge upstream/main
git push upstream add_gcp-cloudsql_region_filter

@mergify
Copy link
Contributor

mergify bot commented Sep 12, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b add_gcp-cloudsql_region_filter upstream/add_gcp-cloudsql_region_filter
git merge upstream/main
git push upstream add_gcp-cloudsql_region_filter

@gpop63 gpop63 marked this pull request as ready for review September 16, 2022 08:59
@gpop63 gpop63 requested a review from a team as a code owner September 16, 2022 08:59
Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

2 minor changes required then this can be merged

Comment on lines 89 to 91
- Add GCP CloudSQL region filter {pull}32943[32943]
- Add network name to data.json {pull}32986[32986]
- Add missing cluster metadata to k8s module metricsets {pull}32979[32979]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Add GCP CloudSQL region filter {pull}32943[32943]
- Add network name to data.json {pull}32986[32986]
- Add missing cluster metadata to k8s module metricsets {pull}32979[32979]
- Add GCP CloudSQL region filter {pull}32943[32943]

@@ -198,6 +211,7 @@ func (r *metricsRequester) getFilterForMetric(serviceName, m string) string {

switch {
case r.config.Region != "":
// FIXME: using resource.labels.zone but should use region.
Copy link
Member

Choose a reason for hiding this comment

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

I though about this, let's remove it from here and do it for good separately. I'll open an issue to discuss how to address this.

Suggested change
// FIXME: using resource.labels.zone but should use region.

@gpop63 gpop63 merged commit f90a066 into elastic:main Sep 19, 2022
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* add cloudsql region filter

* add changelog entry

* fix comment for golangci-lint

* fix get filter for metric tests

* better AlignersMapToGCP comment

* revert to zone and add comment

* Revert "fix get filter for metric tests"

This reverts commit e3ea3b8.

* add cloudsql region label

* add regions filter

* fix changelog

* remove comment from metrics requester
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GCP Module] Region filtering support for cloudsql metricset
3 participants