You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case where a proxy is configured on the application, the agents SHOULD attempt to make
253
253
the calls to the metadata endpoint directly, without using the proxy.
@@ -265,14 +265,19 @@ From the returned metadata, the following fields are useful
265
265
266
266
| Cloud metadata field | GCP Metadata field |
267
267
| -------------------- | ------------------- |
268
-
|`instance.id`|`instance.id`|
268
+
|`instance.id`|`instance.id`as a string [1]|
269
269
|`instance.name`|`instance.name`|
270
-
|`project.id`|`project.numericProjectId` as a string |
271
-
|`project.name`|`project.projectId`|
270
+
|`project.id`|`project.projectId`[2]|
272
271
|`availability_zone`| last part of `instance.zone`, split by `/`|
273
272
|`machine.type`| last part of `instance.machineType`, split by `/`|
274
273
|`provider`| gcp |
275
-
|`region`| last part of `instance.zone`, split by `-`|
274
+
|`region`| last part of `instance.zone` split by '/', then remove the last '-'-delimited part (e.g., `us-west1` from `projects/123456789012/zones/us-west1-b`)|
275
+
276
+
[1]: Beware JSON parsing the `instance.id` field from the HTTP response body, because it is formatted as an integer that is larger [JavaScript's `Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER). It may require native support for or explicit usage of BigInt types.
277
+
[2]: Google cloud project identifiers are [described here](https://cloud.google.com/resource-manager/docs/creating-managing-projects#before_you_begin).
278
+
279
+
(For comparison and consistency, here is the equivalent collection code for
0 commit comments