Skip to content

Commit

Permalink
Change 'cloud.project.id' for GCP metadata to be the 'project-id' (#3316
Browse files Browse the repository at this point in the history
)

Closes: #3311

Co-authored-by: Jonas Kunz <[email protected]>
  • Loading branch information
trentm and JonasKunz authored Sep 13, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b5e4bf0 commit 481ee25
Showing 3 changed files with 11 additions and 11 deletions.
15 changes: 8 additions & 7 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
@@ -31,21 +31,22 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
=== Unreleased
[float]
===== Bug fixes
* Prevent bad serialization in edge cases for span compression - {pull}3293[#3293]
* Allow overriding of transaction type for Servlet-API transactions - {pull}3226[#3226]
* Fix micrometer histogram serialization - {pull}3290[#3290], {pull}3304[#3304]
* Fix transactions not being correctly handled in certain edge cases - {pull}3294[#3294]
[float]
===== Features
* Add support for Elasticsearch client 8.9 - {pull}3283[#3283]
* Added `baggage_to_attach` config option to allow automatic lifting of baggage into transaction, span and error attributes - {pull}3288[#3288], {pull}3289[#3289]
* Exclude elasticsearch 8.10 and newer clients from instrumentation because they natively support OpenTelemetry - {pull}3303[#3303]
* Switched to OpenTelemetry compatible context propagation for Kafka - {pull}3300[#3300]
* Changed `cloud.project.id` collected in Google Cloud (GCP) to be the `project-id` - {issues}3311[#3311]
* Allow running the IntelliJ debug agent in parallel - {pull}3315[#3315]
[float]
===== Bug fixes
* Prevent bad serialization in edge cases for span compression - {pull}3293[#3293]
* Allow overriding of transaction type for Servlet-API transactions - {pull}3226[#3226]
* Fix micrometer histogram serialization - {pull}3290[#3290], {pull}3304[#3304]
* Fix transactions not being correctly handled in certain edge cases - {pull}3294[#3294]
[[release-notes-1.x]]
=== Java Agent version 1.x
Original file line number Diff line number Diff line change
@@ -343,8 +343,7 @@ static CloudProviderInfo deserializeGcpMetadata(@Nullable String rawMetadata) th
if (projectData instanceof Map) {
@SuppressWarnings("unchecked") Map<String, Object> projectMap = (Map<String, Object>) projectData;
String projectId = projectMap.get("projectId") instanceof String ? (String) projectMap.get("projectId") : null;
Long numericProjectId = projectMap.get("numericProjectId") instanceof Long ? (Long) projectMap.get("numericProjectId") : null;
cloudProviderInfo.setProject(new NameAndIdField(projectId, numericProjectId));
cloudProviderInfo.setProject(new NameAndIdField(null, projectId));
} else {
logger.warn("Error while parsing GCP metadata - expecting the value of the 'project' entry to be a map but it is not");
}
Original file line number Diff line number Diff line change
@@ -41,8 +41,8 @@ void gcpMetadataDeserializeTest() throws IOException {
assertThat(gcpMetadata.getInstance().getId()).isEqualTo("4306570268266786072");
assertThat(gcpMetadata.getInstance().getName()).isEqualTo("basepi-test");
assertThat(gcpMetadata.getAccount()).isNull();
assertThat(gcpMetadata.getProject().getId()).isEqualTo("513326162531");
assertThat(gcpMetadata.getProject().getName()).isEqualTo("elastic-apm");
assertThat(gcpMetadata.getProject().getId()).isEqualTo("elastic-apm");
assertThat(gcpMetadata.getProject().getName()).isNull();
assertThat(gcpMetadata.getMachine().getType()).isEqualTo("n1-standard-1");
}

0 comments on commit 481ee25

Please sign in to comment.