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

[7.x](backport #27363) [Metricbeat] gcp: fix instance machineType reporting #27419

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 17, 2021

This is an automatic backport of pull request #27363 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/

Refresh instance metadata for each incoming response by updating the
`s.computeMetadata` field in the `metadataCollector` struct.

The code was applying a sort of caching to the computeMetadata, but in
the wrong place. Most probably it was a leftover, as a proper caching
for instance metadata is implemented in the `instance` function on line
146.
Due to this check `computeMetadata` were not refreshed for each
response.
`metadataCollector` is instanciated only once for the entire module.
Thus by not overriding `computeMetadata` the metadata of the first
response handled was used for all subsequent events.

Removing the check make the code update the `s.computeMetadata` property
for each new response. With this update the correct metadata based on
the instance ID reported in the response are used.

Fixes a bug were all metrics were being reported with the same
`machineType`.

NOTE: the code update the same struct field at each iteration; this is
most probably not safe in a parallel execution context; this code is not
running multiple times in different threads so for the moment this
change should not have negative side effects.

(cherry picked from commit 5339327)
@mergify mergify bot added the backport label Aug 17, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 17, 2021
@endorama endorama added the Team:Integrations Label for the Integrations team label Aug 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 17, 2021
@elasticmachine
Copy link
Collaborator

💚 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: 2021-08-17T11:43:16.042+0000

  • Duration: 71 min 42 sec

  • Commit: b0665f6

Test stats 🧪

Test Results
Failed 0
Passed 2648
Skipped 232
Total 2880

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2648
Skipped 232
Total 2880

@endorama endorama merged commit b69b8da into 7.x Aug 17, 2021
@endorama endorama deleted the mergify/bp/7.x/pr-27363 branch August 17, 2021 13:00
@mergify
Copy link
Contributor Author

mergify bot commented Nov 16, 2021

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 mergify/bp/7.x/pr-27363 upstream/mergify/bp/7.x/pr-27363
git merge upstream/7.x
git push upstream mergify/bp/7.x/pr-27363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants