Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0e030f9
Add the ability to read persisted (.clsrecord) crash files (#4762)
jasonhu-g Jan 28, 2020
b8d4454
Merge remote-tracking branch 'origin/master' into crashlytics-firelog
jasonhu-g Jan 29, 2020
8a55769
Integrate GoogleDataTransport and nanopb with Crashlytics proto (#4751)
jasonhu-g Jan 29, 2020
93f203d
Add unit tests for FIRCLSRecord* (#4770)
jasonhu-g Jan 29, 2020
610431f
Merge remote-tracking branch 'origin/master' into crashlytics-firelog
jasonhu-g Jan 30, 2020
592dec8
Create initial nanopb Crashlytics report (#4781)
jasonhu-g Jan 31, 2020
ba0dad9
Add logic to read logs/errors/user_key_value from persisted crash fil…
jasonhu-g Feb 3, 2020
e35f930
Initialize and pass GDTCoreTransport to FIRCLSReportManager (#4802)
jasonhu-g Feb 3, 2020
08392cc
Add ability to read to report_upload_variant from settings (#4817)
jasonhu-g Feb 4, 2020
f96b9c1
Add mapping logic for user defined key values
jasonhu-g Feb 4, 2020
a9d1363
Add mapping for log messages
jasonhu-g Feb 5, 2020
c561773
Add mapping logic for recorded errors
jasonhu-g Feb 6, 2020
044c79c
Fix if condition for adding a crash event
jasonhu-g Feb 6, 2020
fe9b167
Address feedback
jasonhu-g Feb 6, 2020
06a1491
Map the read values from user key value, error and log .clsrecords in…
jasonhu-g Feb 6, 2020
df702da
Test nanopb max size
jasonhu-g Feb 6, 2020
8c08fdc
Revert "Test nanopb max size"
jasonhu-g Feb 6, 2020
7b83b34
Merge branch 'crashlytics-firelog' of github.com:firebase/firebase-io…
jasonhu-g Feb 6, 2020
d18c81f
Port fix from https://github.com/firebase/firebase-ios-sdk/pull/4849:…
jasonhu-g Feb 7, 2020
1877fa6
Merge remote-tracking branch 'origin/master' into crashlytics-firelog
jasonhu-g Feb 7, 2020
a1af932
Update README instructions for regenerating the nanopb for Crashlytic…
samedson Feb 12, 2020
7400c22
Crashlytics add Exception crashes to FireLog (#4860)
samedson Feb 12, 2020
38adc6c
Fixes to get crash report to be successfully processed in the new rep…
jasonhu-g Feb 12, 2020
9c0c1d2
Crashlytics set FireLog session ended_at (#4891)
samedson Feb 12, 2020
e64f1a9
Crashlytics GDT fill in Exception part of Proto (#4894)
samedson Feb 13, 2020
2855cf1
Add the ability to send to the new and legacy crash reporting endpoin…
jasonhu-g Feb 18, 2020
10a7766
Add FIRCLSReportUploader unit tests for supporting multiple endpoints…
jasonhu-g Feb 27, 2020
c57a70e
Merge remote-tracking branch 'origin/master' into crashlytics-firelog
jasonhu-g Feb 27, 2020
1de265c
Send the .clsrecord files during crash reporting (#4931)
jasonhu-g Feb 27, 2020
c95be55
Remove TODOs that are no longer applicable
jasonhu-g Feb 27, 2020
48c162a
Merge branch 'crashlytics-firelog' of github.com:firebase/firebase-io…
jasonhu-g Feb 27, 2020
4156ff1
Merge remote-tracking branch 'origin/master' into crashlytics-firelog
jasonhu-g Mar 3, 2020
61fead8
Fix bugs:
jasonhu-g Mar 3, 2020
d9bcb68
Fix issue where Crash Free Users does not work with new GDT changes (…
jasonhu-g Mar 5, 2020
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
4 changes: 2 additions & 2 deletions Crashlytics/Crashlytics/Components/FIRCLSContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ bool FIRCLSContextInitialize(const FIRCLSContextInitData* initData) {
_firclsContext.readonly->logging.logStorage.restrictBySize = true;
_firclsContext.readonly->logging.logStorage.entryCount = NULL;
_firclsContext.readonly->logging.logStorage.aPath =
FIRCLSContextAppendToRoot(rootPath, @"log_a.clsrecord");
FIRCLSContextAppendToRoot(rootPath, FIRCLSReportLogAFile);
_firclsContext.readonly->logging.logStorage.bPath =
FIRCLSContextAppendToRoot(rootPath, @"log_b.clsrecord");
FIRCLSContextAppendToRoot(rootPath, FIRCLSReportLogBFile);
_firclsContext.readonly->logging.customExceptionStorage.aPath =
FIRCLSContextAppendToRoot(rootPath, FIRCLSReportCustomExceptionAFile);
_firclsContext.readonly->logging.customExceptionStorage.bPath =
Expand Down
3 changes: 2 additions & 1 deletion Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@class FIRCLSFileManager;
@class FIRCLSInternalReport;
@class FIRCLSSettings;
@class GDTCORTransport;
@class FIRInstallations;
@protocol FIRAnalyticsInterop;

Expand All @@ -35,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
analytics:(nullable id<FIRAnalyticsInterop>)analytics
googleAppID:(NSString *)googleAppID
dataArbiter:(FIRCLSDataCollectionArbiter *)dataArbiter
NS_DESIGNATED_INITIALIZER;
googleTransport:(GDTCORTransport *)googleTransport NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

Expand Down
43 changes: 39 additions & 4 deletions Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//
// The report manager has the ability to send to two different endpoints.
//
// The old legacy flow for a report goes through the following states/folders:
// 1. active - .clsrecords optimized for crash time persistence
// 2. processing - .clsrecords with attempted symbolication
// 3. prepared-legacy - .multipartmime of compressed .clsrecords
//
// The new flow for a report goes through the following states/folders:
// 1. active - .clsrecords optimized for crash time persistence
// 2. processing - .clsrecords with attempted symbolication
// 3. prepared - .clsrecords moved from processing with no changes
//
// The code was designed so the report processing workflows are not dramatically different from one
// another. The design will help avoid having a lot of conditional code blocks throughout the
// codebase.
//

#include <stdatomic.h>

#if __has_include(<FBLPromises/FBLPromises.h>)
Expand Down Expand Up @@ -156,6 +174,8 @@ @interface FIRCLSReportManager () <FIRCLSNetworkClientDelegate,
// Runs the operations that fetch settings and call onboarding endpoints
@property(nonatomic, strong) FIRCLSSettingsOnboardingManager *settingsAndOnboardingManager;

@property(nonatomic, strong) GDTCORTransport *googleTransport;

@end

@implementation FIRCLSReportManager
Expand All @@ -167,7 +187,8 @@ - (instancetype)initWithFileManager:(FIRCLSFileManager *)fileManager
installations:(FIRInstallations *)installations
analytics:(id<FIRAnalyticsInterop>)analytics
googleAppID:(NSString *)googleAppID
dataArbiter:(FIRCLSDataCollectionArbiter *)dataArbiter {
dataArbiter:(FIRCLSDataCollectionArbiter *)dataArbiter
googleTransport:(GDTCORTransport *)googleTransport {
self = [super init];
if (!self) {
return nil;
Expand All @@ -178,6 +199,8 @@ - (instancetype)initWithFileManager:(FIRCLSFileManager *)fileManager
_googleAppID = [googleAppID copy];
_dataArbiter = dataArbiter;

_googleTransport = googleTransport;

NSString *sdkBundleID = FIRCLSApplicationGetSDKBundleID();

_operationQueue = [NSOperationQueue new];
Expand Down Expand Up @@ -220,8 +243,14 @@ - (FIRCLSNetworkClient *)clientWithOperationQueue:(NSOperationQueue *)queue {
*/
- (int)unsentReportsCountWithPreexisting:(NSArray<NSString *> *)paths {
int count = [self countSubmittableAndDeleteUnsubmittableReportPaths:paths];

count += _fileManager.processingPathContents.count;
count += _fileManager.preparedPathContents.count;

if (self.settings.shouldUseNewReportEndpoint) {
count += _fileManager.preparedPathContents.count;
} else {
count += _fileManager.legacyPreparedPathContents.count;
}
return count;
}

Expand Down Expand Up @@ -649,7 +678,11 @@ - (void)removeReport:(FIRCLSInternalReport *)report {

- (void)removeContentsInOtherReportingDirectories {
[self removeExistingReportPaths:self.fileManager.processingPathContents];
[self removeExistingReportPaths:self.fileManager.preparedPathContents];
if (self.settings.shouldUseNewReportEndpoint) {
[self removeExistingReportPaths:self.fileManager.preparedPathContents];
} else {
[self removeExistingReportPaths:self.fileManager.legacyPreparedPathContents];
}
}

- (void)handleContentsInOtherReportingDirectoriesWithToken:(FIRCLSDataCollectionToken *)token {
Expand All @@ -673,7 +706,9 @@ - (void)handleExistingFilesInProcessingWithToken:(FIRCLSDataCollectionToken *)to
}

- (void)handleExistingFilesInPreparedWithToken:(FIRCLSDataCollectionToken *)token {
NSArray *preparedPaths = _fileManager.preparedPathContents;
NSArray *preparedPaths = self.settings.shouldUseNewReportEndpoint
? _fileManager.preparedPathContents
: _fileManager.legacyPreparedPathContents;

// Give our network client a chance to reconnect here, if needed. This attempts to avoid
// trying to re-submit a prepared file that is already in flight.
Expand Down
3 changes: 3 additions & 0 deletions Crashlytics/Crashlytics/Controllers/FIRCLSReportUploader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#import <Foundation/Foundation.h>

#import <GoogleDataTransport/GDTCORTransport.h>

@class FIRCLSDataCollectionToken;
@class FIRCLSInternalReport;
@class FIRCLSSettings;
Expand Down Expand Up @@ -73,5 +75,6 @@

- (NSString *)googleAppID;
- (FIRCLSSettings *)settings;
- (GDTCORTransport *)googleTransport;

@end
Loading