From e9a50089c8d4cde284faf177d68469c82f5303f5 Mon Sep 17 00:00:00 2001 From: Ben Hymers Date: Fri, 10 Jan 2025 08:35:29 +0000 Subject: [PATCH] Expose BacktraceMetrics.SessionId and BacktraceClient.AttributeProvider This is useful to allow SessionId and other attributes (e.g. 'guid') to be written to 'dying memory' on platforms that support it (e.g. Switch, PlayStation), which the Backtrace server is then able to parse on importing from platform crash reporting services, and set on the imported errors. It can then be correlated with other errors from the same session. --- Runtime/BacktraceClient.cs | 2 +- Runtime/Interfaces/IBacktraceMetrics.cs | 5 ++++- Runtime/Services/BacktraceMetrics.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Runtime/BacktraceClient.cs b/Runtime/BacktraceClient.cs index 0f7972d9..77081674 100644 --- a/Runtime/BacktraceClient.cs +++ b/Runtime/BacktraceClient.cs @@ -50,7 +50,7 @@ public IBacktraceBreadcrumbs Breadcrumbs /// /// Client attribute provider /// - internal AttributeProvider AttributeProvider + public AttributeProvider AttributeProvider { get { diff --git a/Runtime/Interfaces/IBacktraceMetrics.cs b/Runtime/Interfaces/IBacktraceMetrics.cs index fc743c80..9aef5aff 100644 --- a/Runtime/Interfaces/IBacktraceMetrics.cs +++ b/Runtime/Interfaces/IBacktraceMetrics.cs @@ -1,4 +1,5 @@ -using Backtrace.Unity.Model.Attributes; +using System; +using Backtrace.Unity.Model.Attributes; using Backtrace.Unity.Model.Metrics; using System.Collections.Generic; @@ -16,6 +17,8 @@ public interface IBacktraceMetrics : IScopeAttributeProvider /// //LinkedList UniqueEvents { get; } + Guid SessionId { get; } + /// /// Maximum number of summed events in store. If number of events in store hit the limit /// BacktraceMetrics instance will send data to Backtrace. diff --git a/Runtime/Services/BacktraceMetrics.cs b/Runtime/Services/BacktraceMetrics.cs index faf8d102..c6aa2840 100644 --- a/Runtime/Services/BacktraceMetrics.cs +++ b/Runtime/Services/BacktraceMetrics.cs @@ -16,7 +16,7 @@ internal sealed class BacktraceMetrics : IBacktraceMetrics /// /// Session Id /// - public readonly Guid SessionId = Guid.NewGuid(); + public Guid SessionId { get; } = Guid.NewGuid(); /// /// Default submission URL