Skip to content

Commit 414a56f

Browse files
committed
chore: send class name in exceptions and filter out java modules from in-app flagging
1 parent 8860c0b commit 414a56f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/net/hollowcube/posthog/PostHogClientImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,11 @@ public void captureException(@NotNull Throwable throwable, @Nullable String dist
434434
// We lie and tell PostHog that this is a Python exception because they don't actually support
435435
// Java yet :) As far as i can tell this is only actually used for syntax highlighting in source
436436
// code (which we don't send) so this is probably OK for now.
437-
frame.addProperty("platform", "java");
438-
frame.addProperty("filename", element.getFileName());
437+
frame.addProperty("platform", "python");
438+
var fileName = element.getClassName();
439+
if (element.getModuleName() != null)
440+
fileName = element.getModuleName() + "/" + fileName;
441+
frame.addProperty("filename", fileName);
439442
frame.addProperty("abs_path", element.getFileName());
440443

441444
frame.addProperty("module", element.getClassName());
@@ -450,7 +453,9 @@ public void captureException(@NotNull Throwable throwable, @Nullable String dist
450453
frame.add("pre_context", new JsonArray());
451454
frame.add("context_line", JsonNull.INSTANCE);
452455
frame.add("post_context", new JsonArray());
453-
frame.addProperty("in_app", true);
456+
457+
// TODO: expand this further to allow user specified in-app filters.
458+
frame.addProperty("in_app", element.getModuleName() == null || !element.getModuleName().startsWith("java."));
454459

455460
stackFrames.add(frame);
456461
}

0 commit comments

Comments
 (0)