Skip to content

Commit 0c3035c

Browse files
committed
Add CLOUD_ACCOUNT_ID to all supported platforms
1 parent eb613b6 commit 0c3035c

File tree

10 files changed

+87
-21
lines changed

10 files changed

+87
-21
lines changed

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/AttributeKeys.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*/
2222
public final class AttributeKeys {
2323
// GCE Attributes
24-
public static final String GCE_PROJECT_ID = AttributeKeys.PROJECT_ID;
2524
public static final String GCE_AVAILABILITY_ZONE = AttributeKeys.AVAILABILITY_ZONE;
2625
public static final String GCE_CLOUD_REGION = AttributeKeys.CLOUD_REGION;
2726
public static final String GCE_INSTANCE_ID = AttributeKeys.INSTANCE_ID;
@@ -53,7 +52,6 @@ public final class AttributeKeys {
5352
public static final String SERVERLESS_COMPUTE_CLOUD_REGION = AttributeKeys.CLOUD_REGION;
5453
public static final String SERVERLESS_COMPUTE_INSTANCE_ID = AttributeKeys.INSTANCE_ID;
5554

56-
static final String PROJECT_ID = "project_id";
5755
static final String AVAILABILITY_ZONE = "availability_zone";
5856
static final String CLOUD_REGION = "cloud_region";
5957
static final String INSTANCE_ID = "instance_id";

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/DetectedPlatform.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ public interface DetectedPlatform {
2727
*/
2828
GCPPlatformDetector.SupportedPlatform getSupportedPlatform();
2929

30+
/**
31+
* Method to retrieve the GCP Project ID in which the GCP specific platform exists. Every valid
32+
* platform must have a GCP Project ID associated with it.
33+
*
34+
* @return the Google Cloud project ID.
35+
*/
36+
String getProjectId();
37+
3038
/**
3139
* Method to retrieve the attributes associated with the compute platform on which the application
32-
* is running as key-value pairs.
40+
* is running as key-value pairs. The valid keys to query on this {@link Map} are specified in the
41+
* {@link AttributeKeys}.
3342
*
3443
* @return a {@link Map} of attributes specific to the underlying compute platform.
3544
*/

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleAppEngine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public GCPPlatformDetector.SupportedPlatform getSupportedPlatform() {
6060
return GCPPlatformDetector.SupportedPlatform.GOOGLE_APP_ENGINE;
6161
}
6262

63+
@Override
64+
public String getProjectId() {
65+
return this.metadataConfig.getProjectId();
66+
}
67+
6368
@Override
6469
public Map<String, String> getAttributes() {
6570
return this.availableAttributes;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleComputeEngine.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static com.google.cloud.opentelemetry.detectors.AttributeKeys.GCE_INSTANCE_ID;
2222
import static com.google.cloud.opentelemetry.detectors.AttributeKeys.GCE_INSTANCE_NAME;
2323
import static com.google.cloud.opentelemetry.detectors.AttributeKeys.GCE_MACHINE_TYPE;
24-
import static com.google.cloud.opentelemetry.detectors.AttributeKeys.GCE_PROJECT_ID;
2524

2625
import java.util.Collections;
2726
import java.util.HashMap;
@@ -38,7 +37,6 @@ final class GoogleComputeEngine implements DetectedPlatform {
3837

3938
private Map<String, String> prepareAttributes() {
4039
Map<String, String> map = new HashMap<>();
41-
map.put(GCE_PROJECT_ID, this.metadataConfig.getProjectId());
4240
map.put(GCE_AVAILABILITY_ZONE, this.metadataConfig.getZone());
4341
map.put(GCE_CLOUD_REGION, this.metadataConfig.getRegionFromZone());
4442
map.put(GCE_INSTANCE_ID, this.metadataConfig.getInstanceId());
@@ -53,6 +51,11 @@ public GCPPlatformDetector.SupportedPlatform getSupportedPlatform() {
5351
return GCPPlatformDetector.SupportedPlatform.GOOGLE_COMPUTE_ENGINE;
5452
}
5553

54+
@Override
55+
public String getProjectId() {
56+
return this.metadataConfig.getProjectId();
57+
}
58+
5659
@Override
5760
public Map<String, String> getAttributes() {
5861
return this.availableAttributes;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleKubernetesEngine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public GCPPlatformDetector.SupportedPlatform getSupportedPlatform() {
6363
return GCPPlatformDetector.SupportedPlatform.GOOGLE_KUBERNETES_ENGINE;
6464
}
6565

66+
@Override
67+
public String getProjectId() {
68+
return this.metadataConfig.getProjectId();
69+
}
70+
6671
@Override
6772
public Map<String, String> getAttributes() {
6873
return this.availableAttributes;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/GoogleServerlessCompute.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ private Map<String, String> prepareAttributes() {
4545
return Collections.unmodifiableMap(map);
4646
}
4747

48+
@Override
49+
public String getProjectId() {
50+
return this.metadataConfig.getProjectId();
51+
}
52+
4853
@Override
4954
public Map<String, String> getAttributes() {
5055
return this.availableAttributes;

detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detectors/UnknownPlatform.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public GCPPlatformDetector.SupportedPlatform getSupportedPlatform() {
2727
return GCPPlatformDetector.SupportedPlatform.UNKNOWN_PLATFORM;
2828
}
2929

30+
@Override
31+
public String getProjectId() {
32+
return "";
33+
}
34+
3035
@Override
3136
public Map<String, String> getAttributes() {
3237
return Collections.emptyMap();

detectors/resources-support/src/test/java/com/google/cloud/opentelemetry/detectors/GCPPlatformDetectorTest.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public void testGCEResourceWithGCEAttributesSucceeds() {
9696
assertEquals(
9797
GCPPlatformDetector.SupportedPlatform.GOOGLE_COMPUTE_ENGINE,
9898
detector.detectPlatform().getSupportedPlatform());
99+
assertEquals("GCE-pid", detector.detectPlatform().getProjectId());
99100
Map<String, String> detectedAttributes = detector.detectPlatform().getAttributes();
100101
assertEquals(new GoogleComputeEngine(mockMetadataConfig).getAttributes(), detectedAttributes);
101-
assertEquals(7, detectedAttributes.size());
102+
assertEquals(6, detectedAttributes.size());
102103

103-
assertEquals("GCE-pid", detectedAttributes.get(GCE_PROJECT_ID));
104104
assertEquals("country-gce_region-gce_zone", detectedAttributes.get(GCE_AVAILABILITY_ZONE));
105105
assertEquals("country-gce_region", detectedAttributes.get(GCE_CLOUD_REGION));
106106
assertEquals("GCE-instance-id", detectedAttributes.get(GCE_INSTANCE_ID));
@@ -135,6 +135,7 @@ public void testGKEResourceWithGKEAttributesSucceedsLocationZone() {
135135
detector.detectPlatform().getSupportedPlatform());
136136
assertEquals(
137137
new GoogleKubernetesEngine(mockMetadataConfig).getAttributes(), detectedAttributes);
138+
assertEquals("GKE-pid", detector.detectPlatform().getProjectId());
138139
assertEquals(4, detectedAttributes.size());
139140

140141
assertEquals(GKE_LOCATION_TYPE_ZONE, detectedAttributes.get(GKE_CLUSTER_LOCATION_TYPE));
@@ -168,7 +169,9 @@ public void testGKEResourceWithGKEAttributesSucceedsLocationRegion() {
168169
detector.detectPlatform().getSupportedPlatform());
169170
assertEquals(
170171
new GoogleKubernetesEngine(mockMetadataConfig).getAttributes(), detectedAttributes);
172+
assertEquals("GKE-pid", detector.detectPlatform().getProjectId());
171173
assertEquals(4, detectedAttributes.size());
174+
172175
assertEquals(GKE_LOCATION_TYPE_REGION, detectedAttributes.get(GKE_CLUSTER_LOCATION_TYPE));
173176
assertEquals("country-region", detectedAttributes.get(GKE_CLUSTER_LOCATION));
174177
assertEquals("GKE-cluster-name", detectedAttributes.get(GKE_CLUSTER_NAME));
@@ -202,7 +205,9 @@ public void testGKEResourceDetectionWithInvalidLocations(String clusterLocation)
202205
detector.detectPlatform().getSupportedPlatform());
203206
assertEquals(
204207
new GoogleKubernetesEngine(mockMetadataConfig).getAttributes(), detectedAttributes);
208+
assertEquals("GKE-pid", detector.detectPlatform().getProjectId());
205209
assertEquals(4, detectedAttributes.size());
210+
206211
assertEquals("", detector.detectPlatform().getAttributes().get(GKE_CLUSTER_LOCATION_TYPE));
207212
if (clusterLocation == null || clusterLocation.isEmpty()) {
208213
assertNull(detectedAttributes.get(GKE_CLUSTER_LOCATION));
@@ -234,7 +239,9 @@ public void testGCFResourceWithCloudFunctionAttributesSucceeds() {
234239
detector.detectPlatform().getSupportedPlatform());
235240
assertEquals(
236241
new GoogleCloudFunction(mockEnv, mockMetadataConfig).getAttributes(), detectedAttributes);
242+
assertEquals("GCF-pid", detector.detectPlatform().getProjectId());
237243
assertEquals(5, detectedAttributes.size());
244+
238245
assertEquals("cloud-function-hello", detectedAttributes.get(SERVERLESS_COMPUTE_NAME));
239246
assertEquals("cloud-function-hello.1", detectedAttributes.get(SERVERLESS_COMPUTE_REVISION));
240247
assertEquals(
@@ -262,6 +269,7 @@ public void testGCFDetectionWhenGCRAttributesPresent() {
262269
assertEquals(
263270
GCPPlatformDetector.SupportedPlatform.GOOGLE_CLOUD_FUNCTIONS,
264271
detector.detectPlatform().getSupportedPlatform());
272+
assertEquals("GCF-pid", detector.detectPlatform().getProjectId());
265273
assertEquals(
266274
new GoogleCloudFunction(mockEnv, mockMetadataConfig).getAttributes(),
267275
detector.detectPlatform().getAttributes());
@@ -288,7 +296,9 @@ public void testGCFResourceWithCloudRunAttributesSucceeds() {
288296
detector.detectPlatform().getSupportedPlatform());
289297
assertEquals(
290298
new GoogleCloudFunction(mockEnv, mockMetadataConfig).getAttributes(), detectedAttributes);
299+
assertEquals("GCR-pid", detector.detectPlatform().getProjectId());
291300
assertEquals(5, detectedAttributes.size());
301+
292302
assertEquals("cloud-run-hello", detectedAttributes.get(SERVERLESS_COMPUTE_NAME));
293303
assertEquals("cloud-run-hello.1", detectedAttributes.get(SERVERLESS_COMPUTE_REVISION));
294304
assertEquals(
@@ -321,7 +331,9 @@ public void testGAEResourceWithAppEngineAttributesSucceeds(String gaeEnvironment
321331
detector.detectPlatform().getSupportedPlatform());
322332
assertEquals(
323333
new GoogleAppEngine(mockEnv, mockMetadataConfig).getAttributes(), detectedAttributes);
334+
assertEquals("GAE-pid", detector.detectPlatform().getProjectId());
324335
assertEquals(5, detectedAttributes.size());
336+
325337
if (gaeEnvironmentVar != null && gaeEnvironmentVar.equals("standard")) {
326338
assertEquals(
327339
"country-region1", detector.detectPlatform().getAttributes().get(GAE_CLOUD_REGION));

detectors/resources/src/main/java/com/google/cloud/opentelemetry/detectors/GCPResourceProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public Attributes getAttributes() {
6262
// This is running on some sort of GCPCompute - figure out the platform
6363
AttributesBuilder attrBuilder = Attributes.builder();
6464
attrBuilder.put(ResourceAttributes.CLOUD_PROVIDER, ResourceAttributes.CloudProviderValues.GCP);
65+
attrBuilder.put(ResourceAttributes.CLOUD_ACCOUNT_ID, detectedPlatform.getProjectId());
6566

6667
switch (detectedPlatform.getSupportedPlatform()) {
6768
case GOOGLE_KUBERNETES_ENGINE:
@@ -102,8 +103,6 @@ private void addGCEAttributes(AttributesBuilder attrBuilder, Map<String, String>
102103
ResourceAttributes.CLOUD_PLATFORM,
103104
ResourceAttributes.CloudPlatformValues.GCP_COMPUTE_ENGINE);
104105

105-
Optional.ofNullable(attributesMap.get(GCE_PROJECT_ID))
106-
.ifPresent(projectId -> attrBuilder.put(ResourceAttributes.CLOUD_ACCOUNT_ID, projectId));
107106
Optional.ofNullable(attributesMap.get(GCE_AVAILABILITY_ZONE))
108107
.ifPresent(zone -> attrBuilder.put(ResourceAttributes.CLOUD_AVAILABILITY_ZONE, zone));
109108
Optional.ofNullable(attributesMap.get(GCE_CLOUD_REGION))

detectors/resources/src/test/java/com/google/cloud/opentelemetry/detectors/GCPResourceProviderTest.java

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.mockito.Mockito;
3333

3434
public class GCPResourceProviderTest {
35-
35+
private static final String DUMMY_PROJECT_ID = "123456789";
3636
private final ConfigProperties mockConfigProps = Mockito.mock(ConfigProperties.class);
3737
private final Map<String, String> mockGKECommonAttributes =
3838
new HashMap<>() {
@@ -47,7 +47,6 @@ private DetectedPlatform generateMockGCEPlatform() {
4747
Map<String, String> mockAttributes =
4848
new HashMap<>() {
4949
{
50-
put(GCE_PROJECT_ID, "test-project-id");
5150
put(GCE_CLOUD_REGION, "australia-southeast1");
5251
put(GCE_AVAILABILITY_ZONE, "australia-southeast1-b");
5352
put(GCE_INSTANCE_ID, "random-id");
@@ -60,6 +59,7 @@ private DetectedPlatform generateMockGCEPlatform() {
6059
Mockito.when(mockGCEPlatform.getSupportedPlatform())
6160
.thenReturn(GCPPlatformDetector.SupportedPlatform.GOOGLE_COMPUTE_ENGINE);
6261
Mockito.when(mockGCEPlatform.getAttributes()).thenReturn(mockAttributes);
62+
Mockito.when(mockGCEPlatform.getProjectId()).thenReturn(DUMMY_PROJECT_ID);
6363
return mockGCEPlatform;
6464
}
6565

@@ -76,6 +76,7 @@ private DetectedPlatform generateMockGKEPlatform(String gkeClusterLocationType)
7676
Mockito.when(mockGKEPlatform.getSupportedPlatform())
7777
.thenReturn(GCPPlatformDetector.SupportedPlatform.GOOGLE_KUBERNETES_ENGINE);
7878
Mockito.when(mockGKEPlatform.getAttributes()).thenReturn(mockAttributes);
79+
Mockito.when(mockGKEPlatform.getProjectId()).thenReturn(DUMMY_PROJECT_ID);
7980
return mockGKEPlatform;
8081
}
8182

@@ -101,6 +102,7 @@ private DetectedPlatform generateMockServerlessPlatform(
101102
DetectedPlatform mockServerlessPlatform = Mockito.mock(DetectedPlatform.class);
102103
Mockito.when(mockServerlessPlatform.getSupportedPlatform()).thenReturn(platform);
103104
Mockito.when(mockServerlessPlatform.getAttributes()).thenReturn(mockAttributes);
105+
Mockito.when(mockServerlessPlatform.getProjectId()).thenReturn(DUMMY_PROJECT_ID);
104106
return mockServerlessPlatform;
105107
}
106108

@@ -119,6 +121,7 @@ private DetectedPlatform generateMockGAEPlatform() {
119121
Mockito.when(mockGAEPlatform.getSupportedPlatform())
120122
.thenReturn(GCPPlatformDetector.SupportedPlatform.GOOGLE_APP_ENGINE);
121123
Mockito.when(mockGAEPlatform.getAttributes()).thenReturn(mockAttributes);
124+
Mockito.when(mockGAEPlatform.getProjectId()).thenReturn(DUMMY_PROJECT_ID);
122125
return mockGAEPlatform;
123126
}
124127

@@ -146,15 +149,15 @@ public void testGCEResourceAttributesMapping() {
146149

147150
Resource gotResource = new GCPResourceProvider(mockDetector).createResource(mockConfigProps);
148151

152+
assertEquals(
153+
mockPlatform.getProjectId(),
154+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
149155
assertEquals(
150156
ResourceAttributes.CloudPlatformValues.GCP_COMPUTE_ENGINE,
151157
gotResource.getAttributes().get(ResourceAttributes.CLOUD_PLATFORM));
152158
assertEquals(
153159
ResourceAttributes.CloudProviderValues.GCP,
154160
gotResource.getAttributes().get(ResourceAttributes.CLOUD_PROVIDER));
155-
assertEquals(
156-
mockPlatform.getAttributes().get(GCE_PROJECT_ID),
157-
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
158161
assertEquals(
159162
mockPlatform.getAttributes().get(GCE_INSTANCE_ID),
160163
gotResource.getAttributes().get(ResourceAttributes.HOST_ID));
@@ -188,11 +191,14 @@ public void testGKEResourceAttributesMapping_LocationTypeRegion() {
188191
Resource gotResource = new GCPResourceProvider(mockDetector).createResource(mockConfigProps);
189192

190193
verifyGKEMapping(gotResource, mockPlatform);
194+
assertEquals(
195+
mockPlatform.getProjectId(),
196+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
191197
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_AVAILABILITY_ZONE));
192198
assertEquals(
193199
mockPlatform.getAttributes().get(GKE_CLUSTER_LOCATION),
194200
gotResource.getAttributes().get(ResourceAttributes.CLOUD_REGION));
195-
assertEquals(5, gotResource.getAttributes().size());
201+
assertEquals(6, gotResource.getAttributes().size());
196202
}
197203

198204
@Test
@@ -204,11 +210,14 @@ public void testGKEResourceAttributesMapping_LocationTypeZone() {
204210
Resource gotResource = new GCPResourceProvider(mockDetector).createResource(mockConfigProps);
205211

206212
verifyGKEMapping(gotResource, mockPlatform);
213+
assertEquals(
214+
mockPlatform.getProjectId(),
215+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
207216
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_REGION));
208217
assertEquals(
209218
mockPlatform.getAttributes().get(GKE_CLUSTER_LOCATION),
210219
gotResource.getAttributes().get(ResourceAttributes.CLOUD_AVAILABILITY_ZONE));
211-
assertEquals(5, gotResource.getAttributes().size());
220+
assertEquals(6, gotResource.getAttributes().size());
212221
}
213222

214223
@Test
@@ -221,15 +230,19 @@ public void testGKEResourceAttributesMapping_LocationTypeInvalid() {
221230
DetectedPlatform mockPlatform = Mockito.mock(DetectedPlatform.class);
222231
Mockito.when(mockPlatform.getSupportedPlatform())
223232
.thenReturn(GCPPlatformDetector.SupportedPlatform.GOOGLE_KUBERNETES_ENGINE);
233+
Mockito.when(mockPlatform.getProjectId()).thenReturn(DUMMY_PROJECT_ID);
224234
Mockito.when(mockPlatform.getAttributes()).thenReturn(mockGKEAttributes);
225235
Mockito.when(mockDetector.detectPlatform()).thenReturn(mockPlatform);
226236

227237
Resource gotResource = new GCPResourceProvider(mockDetector).createResource(mockConfigProps);
228238

229239
verifyGKEMapping(gotResource, mockPlatform);
240+
assertEquals(
241+
mockPlatform.getProjectId(),
242+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
230243
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_REGION));
231244
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_AVAILABILITY_ZONE));
232-
assertEquals(4, gotResource.getAttributes().size());
245+
assertEquals(5, gotResource.getAttributes().size());
233246
}
234247

235248
@Test
@@ -241,9 +254,12 @@ public void testGKEResourceAttributesMapping_LocationMissing() {
241254
Resource gotResource = new GCPResourceProvider(mockDetector).createResource(mockConfigProps);
242255

243256
verifyGKEMapping(gotResource, mockPlatform);
257+
assertEquals(
258+
mockPlatform.getProjectId(),
259+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
244260
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_REGION));
245261
assertNull(gotResource.getAttributes().get(ResourceAttributes.CLOUD_AVAILABILITY_ZONE));
246-
assertEquals(4, gotResource.getAttributes().size());
262+
assertEquals(5, gotResource.getAttributes().size());
247263
}
248264

249265
private void verifyGKEMapping(Resource gotResource, DetectedPlatform detectedPlatform) {
@@ -272,8 +288,11 @@ public void testGCRResourceAttributesMapping() {
272288
assertEquals(
273289
ResourceAttributes.CloudPlatformValues.GCP_CLOUD_RUN,
274290
gotResource.getAttributes().get(ResourceAttributes.CLOUD_PLATFORM));
291+
assertEquals(
292+
mockPlatform.getProjectId(),
293+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
275294
verifyServerlessMapping(gotResource, mockPlatform);
276-
assertEquals(7, gotResource.getAttributes().size());
295+
assertEquals(8, gotResource.getAttributes().size());
277296
}
278297

279298
@Test
@@ -288,8 +307,11 @@ public void testGCFResourceAttributeMapping() {
288307
assertEquals(
289308
ResourceAttributes.CloudPlatformValues.GCP_CLOUD_FUNCTIONS,
290309
gotResource.getAttributes().get(ResourceAttributes.CLOUD_PLATFORM));
310+
assertEquals(
311+
mockPlatform.getProjectId(),
312+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
291313
verifyServerlessMapping(gotResource, mockPlatform);
292-
assertEquals(7, gotResource.getAttributes().size());
314+
assertEquals(8, gotResource.getAttributes().size());
293315
}
294316

295317
private void verifyServerlessMapping(Resource gotResource, DetectedPlatform detectedPlatform) {
@@ -326,6 +348,9 @@ public void testGAEResourceAttributeMapping() {
326348
assertEquals(
327349
ResourceAttributes.CloudProviderValues.GCP,
328350
gotResource.getAttributes().get(ResourceAttributes.CLOUD_PROVIDER));
351+
assertEquals(
352+
mockPlatform.getProjectId(),
353+
gotResource.getAttributes().get(ResourceAttributes.CLOUD_ACCOUNT_ID));
329354
assertEquals(
330355
mockPlatform.getAttributes().get(GAE_MODULE_NAME),
331356
gotResource.getAttributes().get(ResourceAttributes.FAAS_NAME));
@@ -341,7 +366,7 @@ public void testGAEResourceAttributeMapping() {
341366
assertEquals(
342367
mockPlatform.getAttributes().get(GAE_CLOUD_REGION),
343368
gotResource.getAttributes().get(ResourceAttributes.CLOUD_REGION));
344-
assertEquals(7, gotResource.getAttributes().size());
369+
assertEquals(8, gotResource.getAttributes().size());
345370
}
346371

347372
@Test

0 commit comments

Comments
 (0)