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 new error.number attribute to error reports #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions Runtime/BacktraceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ internal ReportLimitWatcher ReportLimitWatcher
}
}

/// <summary>
/// Count of errors sent so far by this client.
/// Added to reports as "error.number" attribute.
/// First report will be sent with error.number = 1 (as reports *without* an error.number will appear as the default 0, so we need a way to tell the difference).
/// </summary>
private int _errorNumber = 1;

/// <summary>
/// Initialize new Backtrace integration
/// </summary>
Expand Down Expand Up @@ -848,6 +855,10 @@ private IEnumerator CollectDataAndSend(BacktraceReport report, Action<BacktraceR
yield break;
}
}

// At this point we have committed to sending the report, so increment _errorNumber to make sure the next report gets its error.number incremented.
++_errorNumber;

BacktraceDatabaseRecord record = null;

if (Database != null && Database.Enabled())
Expand Down Expand Up @@ -958,6 +969,8 @@ private BacktraceData SetupBacktraceData(BacktraceReport report)
report.SetReportFingerprint(Configuration.UseNormalizedExceptionMessage);
report.AttachmentPaths.AddRange(_clientReportAttachments);

report.Attributes[ "error.number" ] = _errorNumber.ToString();

// pass copy of dictionary to prevent overriding client attributes
var result = report.ToBacktraceData(null, GameObjectDepth);
AttributeProvider.AddAttributes(result.Attributes.Attributes);
Expand Down