From cd3b30dcabc77a4cd13516f1dcc339daadcbf187 Mon Sep 17 00:00:00 2001 From: Dusty A Date: Fri, 12 Apr 2024 10:39:00 -0500 Subject: [PATCH] resolve issues with sending trace and store metadata --- sdk/src/main/java/io/tebex/sdk/platform/Platform.java | 4 ++-- sdk/src/main/java/io/tebex/sdk/triage/TriageEvent.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/src/main/java/io/tebex/sdk/platform/Platform.java b/sdk/src/main/java/io/tebex/sdk/platform/Platform.java index e7f84f1..54d42bd 100644 --- a/sdk/src/main/java/io/tebex/sdk/platform/Platform.java +++ b/sdk/src/main/java/io/tebex/sdk/platform/Platform.java @@ -190,8 +190,8 @@ default void sendTriageEvent(String errorMessage) { StringWriter traceWriter = new StringWriter(); new Exception("stack trace for error message").printStackTrace(new PrintWriter(traceWriter)); HashMap metadata = new HashMap<>(); - - TriageEvent.fromPlatform(this).withErrorMessage(errorMessage).send(); + metadata.put("trace", traceWriter.toString()); + TriageEvent.fromPlatform(this).withErrorMessage(errorMessage).withMetadata(metadata).send(); } default void sendTriageEvent(Throwable exception) { diff --git a/sdk/src/main/java/io/tebex/sdk/triage/TriageEvent.java b/sdk/src/main/java/io/tebex/sdk/triage/TriageEvent.java index 6053b5c..787cd59 100644 --- a/sdk/src/main/java/io/tebex/sdk/triage/TriageEvent.java +++ b/sdk/src/main/java/io/tebex/sdk/triage/TriageEvent.java @@ -125,7 +125,7 @@ public void send() { .withBody(this.toJsonString(), "POST"); // Store name is set automatically by fromPlatform - if (this.storeName.equals("")) { + if (this.storeName != null && this.storeName.equals("")) { _platform.debug("No store info while sending triage event, ignoring event"); return; }