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] improve efficiency of quering instance metadata in GCP metrics #30154

Merged
merged 2 commits into from
Mar 16, 2022

Conversation

kwinstonix
Copy link
Contributor

@kwinstonix kwinstonix commented Feb 2, 2022

Type of change

  • Enhancement

What does this PR do?

details in #30153

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.

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 2, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 2, 2022

This pull request does not have a backport label. Could you fix it @kwinstonix? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Feb 2, 2022
@kwinstonix kwinstonix force-pushed the fix_gcp_compute_metadata branch from 16ffb3a to 36cab27 Compare February 2, 2022 11:03
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 2, 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-03-15T10:57:19.914+0000

  • Duration: 53 min 4 sec

Test stats 🧪

Test Results
Failed 0
Passed 1083
Skipped 90
Total 1173

💚 Flaky test report

Tests succeeded.

🤖 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 Feb 2, 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 fix_gcp_compute_metadata upstream/fix_gcp_compute_metadata
git merge upstream/master
git push upstream fix_gcp_compute_metadata

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.

Some question and small nitpicks but it looks good. Thanks for the contribution!

x-pack/metricbeat/module/gcp/metrics/compute/metadata.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/gcp/metrics/compute/metadata.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/gcp/metrics/compute/metadata.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@endorama endorama added the Team:Cloud-Monitoring Label for the Cloud Monitoring team label Feb 16, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 16, 2022
@endorama endorama added the backport-v8.1.0 Automated backport with mergify label Feb 16, 2022
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Feb 16, 2022
@masci masci assigned endorama and unassigned kwinstonix Feb 23, 2022
@kwinstonix kwinstonix force-pushed the fix_gcp_compute_metadata branch 3 times, most recently from 4f25e83 to 05724d3 Compare March 5, 2022 06:01
@kwinstonix
Copy link
Contributor Author

@endorama The PR is ready.

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.

A small nitpick but looks good; as soon the comment is resolved I'll merge this!

x-pack/metricbeat/module/gcp/metrics/compute/metadata.go Outdated Show resolved Hide resolved
@kwinstonix kwinstonix force-pushed the fix_gcp_compute_metadata branch from bf5e11b to 7488a4a Compare March 10, 2022 09:49
@kwinstonix
Copy link
Contributor Author

kwinstonix commented Mar 10, 2022

A new commit is pushed. The PR has been rebased on main branch and need be squashed. Is that ok ?

@mergify
Copy link
Contributor

mergify bot commented Mar 10, 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 fix_gcp_compute_metadata upstream/fix_gcp_compute_metadata
git merge upstream/main
git push upstream fix_gcp_compute_metadata

…etrics. (elastic#30153)

*  replace `instance.get` with `instance.aggregatedList` api.
*  remove side effect on metadataCollector instance in instanceMetadata function.
@kwinstonix kwinstonix force-pushed the fix_gcp_compute_metadata branch from 7488a4a to 08a8c29 Compare March 11, 2022 01:42
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.

Thank you for the contribution! Looks good to me

@endorama
Copy link
Member

/test

@endorama
Copy link
Member

I'm removing the backport to 8.1.0 as this is an enhancement and not a bugfix. Target release is 8.2.0.

I asked @gpop63 to test it to have a couple of eyes more, will merge as soon as tests pass!

@endorama endorama removed the backport-v8.1.0 Automated backport with mergify label Mar 15, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 15, 2022

This pull request does not have a backport label. Could you fix it @kwinstonix? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Mar 15, 2022
@gpop63
Copy link
Contributor

gpop63 commented Mar 15, 2022

I tested getting metrics from a compute instance with these changes, and it worked for me.
"metricbeat":{"gcp":{"compute":{"events":4,"failures":0,"success":4}}}

@endorama
Copy link
Member

Merging! @kwinstonix thank you again for the contribution, next step for us will be to investigate #30098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Metricbeat] gcp metrics module should improve efficiency of querying instance metatdata
4 participants