Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add session attribute and backtrace reporter name to every error report #108

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class BacktraceAttributes {
/**
* Metrics session ID
*/
private static String sessionId;
private static String sessionId = UUID.randomUUID().toString();

/**
* Create instance of Backtrace Attribute
Expand Down Expand Up @@ -84,12 +84,6 @@ public BacktraceAttributes(Context context, BacktraceReport report, Map<String,
setAppInformation();
setDeviceInformation(includeDynamicAttributes);
setScreenInformation(includeDynamicAttributes);

// For tracking crash-free sessions we need to add
// application.session and application.version to Backtrace attributes
if (isMetricsEnabled) {
this.attributes.put("application.session", sessionId);
}
}

public Map<String, Object> getComplexAttributes() {
Expand Down Expand Up @@ -126,6 +120,8 @@ private void setAppInformation() {
// But we keep version attribute name as to not break any customer workflows
this.attributes.put("version", version);
}
this.attributes.put("application.session", sessionId);
this.attributes.put("backtrace.agent", "backtrace-android");
this.attributes.put("backtrace.version", BacktraceClient.version);
}

Expand Down Expand Up @@ -257,12 +253,4 @@ public Map<String, Object> getAllAttributes() {
attributes.putAll(this.complexAttributes);
return attributes;
}

public static void enableMetrics() {
BacktraceAttributes.isMetricsEnabled = true;

// Create a session ID for metrics session tracking
String sessionId = UUID.randomUUID().toString();
BacktraceAttributes.sessionId = sessionId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ public void enable(BacktraceMetricsSettings settings, String uniqueEventName) {
}
setStartupUniqueEventName(uniqueEventName);
this.settings = settings;
BacktraceAttributes.enableMetrics();

try {
startMetricsEventHandlers(backtraceApi);
sendStartupEvent();
Expand Down
Loading