-
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] gcp: fix instance machineType reporting #27363
[Metricbeat] gcp: fix instance machineType reporting #27363
Conversation
Pinging @elastic/integrations (Team:Integrations) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
This pull request is now in conflicts. Could you fix it? 🙏
|
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.
5cb8a59
to
5df3115
Compare
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.
Please, just modify the Changelog in case any user reads it looking for reasons to update their metricbeat
CHANGELOG.next.asciidoc
Outdated
@@ -407,6 +407,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d | |||
- Fix cloudwatch metricset collecting duplicate data points. {pull}27248[27248] | |||
- Fix flaky test TestAddCounterInvalidArgWhenQueryClosed. {issue}27312[27312] {pull}27313[27313] | |||
- Add percent formatters to system/process {pull}27374[27374] | |||
- Fix instance machineType reporting {pull}27363[27363] |
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.
Add here "In compute metricset of GCP module" (for example)
Merging without waiting for CI as I've only updated the Changelog description and CI was green at previous commit. |
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)
💔 Build Failed
Expand to view the summary
Build stats
Trends 🧪Steps errorsExpand to view the steps failures
|
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)
…orting (#27419) 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) Co-authored-by: endorama <526307+endorama@users.noreply.github.com>
…porting (#27420) 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) Co-authored-by: endorama <526307+endorama@users.noreply.github.com>
What does this PR do?
Refresh instance metadata for each incoming response by updating the
s.computeMetadata
field in themetadataCollector
struct.Why is it important?
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 theinstance
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.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI would like to add an integration test (as I have been able to reproduce it in a pristine environment)
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs