-
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
[add_cloud_metadata processor] add cloud.region field to GCE cloud provider #35300
[add_cloud_metadata processor] add cloud.region field to GCE cloud provider #35300
Conversation
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
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
|
@@ -82,6 +94,10 @@ var gceMetadataFetcher = provider{ | |||
}.ApplyTo(cloud, instance) | |||
trimLeadingPath("machine.type") | |||
trimLeadingPath("availability_zone") | |||
|
|||
if zone := getValue("availability_zone"); len(zone) >= 2 { |
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.
May you clarify what 2
means in this context? My understanding is that zone
is a string, there is no region
information available and we are extracting the region from the zone
by removing the last 2 characters.
This works as zones in GCP are <region>-<zone>
(docs) but to my knowledge <zone>
is not guaranteed to be a single character.
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.
@endorama you are right, I assumed it from the list of available regions/zones, but I couldn't find naming convention for that.
I've updated implementation - cd04fee
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.
awesome 😃
…ter '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…ovider (#35300) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469)
…ovider (#35300) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469)
…ovider (#35300) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469) # Conflicts: # libbeat/processors/add_cloud_metadata/provider_google_gce_test.go
…ovider (#35300) (#35346) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469) Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…ovider (#35300) (#35347) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469) Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…on field to GCE cloud provider (#35345) * [add_cloud_metadata processor] add cloud.region field to GCE cloud provider (#35300) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 42ca469) # Conflicts: # libbeat/processors/add_cloud_metadata/provider_google_gce_test.go * Update CHANGELOG.next.asciidoc * Update provider_google_gce_test.go --------- Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…ovider (#35300) * add cloud.region field for GCE cloud provider Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * instead of relyin on assumed length of <zone>, remove last element after '-' separators Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> --------- Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
What does this PR do?
Add cloud.region field to GCE cloud provider
Why is it important?
To align with other cloud providers
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Before:
After:
Logs