-
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
x-pack/metricbeat/module/gcp: Add Organization ID and display name to cloud labels #40461
Conversation
This pull request doesn't have a |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
This pull request is now in conflicts. Could you fix it? 🙏
|
This pull request is now in conflicts. Could you fix it? 🙏
|
CHANGELOG.next.asciidoc
Outdated
@@ -176,6 +176,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] | |||
- Update beat module with apm-server monitoring metrics fields {pull}40127[40127] | |||
- Fix Azure Monitor metric timespan to restore Storage Account PT1H metrics {issue}40376[40376] {pull}40367[40367] | |||
- Remove excessive info-level logs in cgroups setup {pull}40491[40491] | |||
- Add GCP organization ID and display name to ECS cloud fields. {issue}39203[39203] {pull}40461[40461] |
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.
Should this be a bug fix or enhancement?
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.
Yeah, it's a challenging call. It feels both.
- enhancement: we're adding project IDs and names that were unavailable.
- bugfix: setting organization IDs and names with the correct values, according to ECS. This feels like an alignment with the spec and part of a fix.
IMO, this change is 75% an enhancement and 25% a fix. It's not a blocker; I'll leave the final call to you, @Linu-Elias.
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.
Overall it looks good. Can we add some documentation on the new fields and also change the existing field definition to reflect this change please? Thank you!
@kaiyan-sheng I'm not sure if you’re referring to this Documentation, but we already have appropriate field definitions here. |
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.
The PR looks good; thank you for working on this, @Linu-Elias!
Besides the comments about the constant name and the additional API call to get the project name, we should pay attention to one aspect: the rollout to users.
This change is a breaking change (by design).
The cloud.project.id
field is OK; we're adding a missing field.
However, the cloud.account.id
and cloud.account.name
fields now contain the correct values instead of the project ID. Even if wrong, users may have grown using them.
@lucabelluccini, I know it is not your responsibility, but you probably have experience with problematic rollouts, so you are my expert.
What's the best way to communicate a change in field availability and value?
In this PR, we are:
- adding a new field
cloud.project.id
(and maybecloud.project.name
) - fixing the
cloud.account.id
andcloud.account.name
fields, setting them with the actual organization ID and name instead of the project ID cloud.account.id
andcloud.account.name
may not be available (the service account may lack the required permissions to get the information), while before this change, they were always present.
@@ -53,14 +57,19 @@ func (s *StackdriverTimeSeriesMetadataCollector) Metadata(ctx context.Context, i | |||
|
|||
ecs := mapstr.M{ | |||
ECSCloud: mapstr.M{ | |||
ECSCloudAccount: mapstr.M{ | |||
ECSCloudProject: mapstr.M{ | |||
ECSCloudAccountID: accountID, | |||
ECSCloudAccountName: accountID, |
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.
I think we need to change the names of these constants; even if the values are correct ("id" and "name"), the name is misleading.
They contain "CloudAccount" while we use them for the ECSCloudProject:
ECSCloudAccountID = "id"
ECSCloudAccountName = "name"
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.
The ECSCloudAccountID
and ECSCloudAccountName
is used in two places - for setting organization(id and name) and Project(id and name) hence the field name can be something generic like- ECSCloudID
and ECSCloudName
?
Thanks @zmoog on the callout! I think:
It would be good to have those 2 workarounds tested (if needed I can help setting them up if you have an accessible cluster where you have the data) and documented in a KB or in the docs. |
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.
LGTM!
We need to add two follow-up actions to the #39203 issue to implement the suggestions from @lucabelluccini.
I think:
- Make this clear in the changelog/release notes of both GCP Module & GCP Integration as much as possible
- This is a good enhancement/fix, but I see eventually some users who might complain of the change. As before all fields were identical, I think we might leverage one of the following:
- A custom ingest pipeline to put the fields as they were (just processors to copy the
cloud.project.id
intocloud.account.id
andcloud.account.name
)- Runtime fields to shadow the real content of the fields with the "old" value (just define 2 runtime fields
cloud.account.id
andcloud.account.name
, making them read the value fromcloud.project.id
)It would be good to have those 2 workarounds tested (if needed I can help setting them up if you have an accessible cluster where you have the data) and documented in a KB or in the docs.
- We need to update the release notes for the GCP module
- We need to update the GCP integration docs
- Provide a tested copy-and-paste solution to revert this change for those users who may rely on the previous behavior (I lean towards the custom pipeline, mainly because it feels easier to understand, but maybe I'm biased).
@Linu-Elias, we can work on these follow-up actions separately from this PR, which is ready.
CHANGELOG.next.asciidoc
Outdated
@@ -176,6 +176,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] | |||
- Update beat module with apm-server monitoring metrics fields {pull}40127[40127] | |||
- Fix Azure Monitor metric timespan to restore Storage Account PT1H metrics {issue}40376[40376] {pull}40367[40367] | |||
- Remove excessive info-level logs in cgroups setup {pull}40491[40491] | |||
- Add GCP organization ID and display name to ECS cloud fields. {issue}39203[39203] {pull}40461[40461] |
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.
Yeah, it's a challenging call. It feels both.
- enhancement: we're adding project IDs and names that were unavailable.
- bugfix: setting organization IDs and names with the correct values, according to ECS. This feels like an alignment with the spec and part of a fix.
IMO, this change is 75% an enhancement and 25% a fix. It's not a blocker; I'll leave the final call to you, @Linu-Elias.
@kilfoyle, sorry for pinging you directly! 🙇 This PR introduces a breaking change in the GCP metricset. We are changing the content of the What do you think the best way is to communicate this change in the release notes? Do you have an example at hand we can imitate? |
Hi @zmoog, good question! I haven't really worked with the Beats docs but it looks like we'd need:
|
|
@kilfoyle, pages like Breaking changes in 8.0 seem an excellent place for reporting breaking changes for the stack as a whole. In this case, we want to report a breaking change in the Metricbeat's module for GCP, a humble and more limited scope. Should we target the Metricbeat release notes? Do you think it's appropriate? |
@zmoog Ah, yes! Sorry, I didn't realize that there are different versions of breaking changes depending on scope. Definitely you could duplicate the breaking changes section in those 8.15 docs. So that would mean updating the 8.15.1 changelog with something like:
|
Great, we'll add this section to the target release! Thank you @kilfoyle! |
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.
LGTM.
Before merging, please add an example of how to restore the previous behavior.
After the merge, update the integration docs when we bump the min stack version to bring this to the Elastic Agent integration.
CHANGELOG.asciidoc
Outdated
=== Beats version 8.15.1 | ||
https://github.com/elastic/beats/compare/v8.15.0\...v8.15.1[View commits] | ||
|
||
==== Breaking changes | ||
|
||
*Metricbeat* | ||
|
||
- Add GCP organization and project details to ECS cloud fields. {pull}40461[40461] |
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 seems to be in the 8.15.1 section of the release notes, but I guess we're shipping in 8.15.2 at the earliest, right?
We have updated our field names to align with ECS semantics. As part of this change: | ||
|
||
* `cloud.account.id` will now contain the Google Cloud Organization ID (previously, it contained the project ID). | ||
* `cloud.account.name` will now contain the Google Cloud Organization Display Name (previously, it contained the project name). | ||
* New fields `cloud.project.id` and `cloud.project.name` will be added to store the actual project ID and project name, respectively. | ||
|
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.
As @lucabelluccini suggested, could you also explain how to revert to the previous behavior for users who may depend on having the project ID in the cloud.account.*
fields?
I think adding a processor in the @Custom pipeline is good enough.
We need to do the same in the Elastic Agent integrations docs.
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.
Something like this?
[
{
"set": {
"field": "cloud.account.id",
"value": "{{cloud.project.id}}",
"if": "ctx?.cloud?.project?.id != null"
}
},
{
"set": {
"field": "cloud.account.name",
"value": "{{cloud.project.name}}",
"if": "ctx?.cloud?.project?.name != null"
}
},
{
"remove": {
"field": [
"cloud.project.id",
"cloud.project.name"
],
"ignore_missing": true
}
}
]
Labels with current implementation:
"cloud": {
"account": {
"id": "992493199029"
},
"project": {
"id": "elastic-observability",
"name": "elastic-observability"
},
},
After pipeline:
"cloud": {
"project": {},
"account": {
"name": "elastic-observability",
"id": "elastic-observability"
}
},
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.
yep!
This pull request is now in conflicts. Could you fix it? 🙏
|
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.
LGTM
… cloud labels (#40461) * issue fix * add change.log * formatting * change.log * error-fix * resolved comments * resolved comments * context added * resolve comments * error handling * doc changes * change.log * Update gcp.asciidoc * Update CHANGELOG.asciidoc * doc changes (cherry picked from commit 355ed04)
… ID and display name to cloud labels (#40899) * x-pack/metricbeat/module/gcp: Add Organization ID and display name to cloud labels (#40461) * issue fix * add change.log * formatting * change.log * error-fix * resolved comments * resolved comments * context added * resolve comments * error handling * doc changes * change.log * Update gcp.asciidoc * Update CHANGELOG.asciidoc * doc changes (cherry picked from commit 355ed04) * Update x-pack/metricbeat/module/gcp/timeseries_metadata_collector.go Co-authored-by: Harnish Chavda <[email protected]> * Update metadata.go * Update metadata.go * Update CHANGELOG.asciidoc * Update CHANGELOG.asciidoc * Update CHANGELOG.asciidoc * Delete CHANGELOG.asciidoc * Revert "Delete CHANGELOG.asciidoc" This reverts commit c1bd932. * fix changelog * Update CHANGELOG.asciidoc * Update CHANGELOG.next.asciidoc --------- Co-authored-by: Linu-Elias <[email protected]> Co-authored-by: Harnish Chavda <[email protected]> Co-authored-by: Gabriel Pop <[email protected]>
Proposed commit message
cloud.project.id field
(currently missing)cloud.account.id field
(currently contains the project ID)cloud.account.name
field (currently contains the project ID)Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
With Project that belong to "No Organization Category" and Compute Service
With Project that belong to "No Organization Category" and Spanner Service
Logs