From c3942ea6a7ba3fe094e7971010cd30840675aacf Mon Sep 17 00:00:00 2001 From: losalex <90795544+losalex@users.noreply.github.com> Date: Tue, 15 Nov 2022 14:07:33 -0800 Subject: [PATCH] fix: Wrong order of libraries info in instrumentation (#1196) --- .../main/java/com/google/cloud/logging/Instrumentation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java index a026b29ca..31af8deeb 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java @@ -163,8 +163,7 @@ private static ListValue generateLibrariesList( } Struct libraryInfo = createInfoStruct(libraryName, libraryVersion); ListValue.Builder libraryList = ListValue.newBuilder(); - // Append first the library info for this library - libraryList.addValues(Value.newBuilder().setStructValue(libraryInfo).build()); + // First add instrumentation data of other libraries to a list if any if (existingLibraryList != null) { for (Value val : existingLibraryList.getValuesList()) { if (val.hasStructValue()) { @@ -190,6 +189,8 @@ private static ListValue generateLibrariesList( } } } + // At last, append this library info to a list + libraryList.addValues(Value.newBuilder().setStructValue(libraryInfo).build()); return libraryList.build(); }