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

Update master with 1.7.0-beta4 fixes #585

Merged
merged 8 commits into from
Sep 3, 2021
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
28 changes: 28 additions & 0 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@
61B3BD52266128D300A9BEF0 /* LoggerE2ETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B3BD51266128D300A9BEF0 /* LoggerE2ETests.swift */; };
61B558CF2469561C001460D3 /* LoggerBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B558CE2469561C001460D3 /* LoggerBuilderTests.swift */; };
61B558D42469CDD8001460D3 /* TracingUUIDGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B558D32469CDD8001460D3 /* TracingUUIDGeneratorTests.swift */; };
61B5E42126DF85C7000B0A5F /* DDRUMMonitor+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5E42026DF85C7000B0A5F /* DDRUMMonitor+apiTests.m */; };
61B5E42526DFAFBC000B0A5F /* DDGlobal+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5E42426DFAFBC000B0A5F /* DDGlobal+apiTests.m */; };
61B5E42726DFB145000B0A5F /* DDDatadog+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5E42626DFB145000B0A5F /* DDDatadog+apiTests.m */; };
61B5E42926DFB60A000B0A5F /* DDConfiguration+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5E42826DFB60A000B0A5F /* DDConfiguration+apiTests.m */; };
61B5E42B26DFC433000B0A5F /* DDNSURLSessionDelegate+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5E42A26DFC433000B0A5F /* DDNSURLSessionDelegate+apiTests.m */; };
61B6811F25F0EA860015B4AF /* CrashReportingWithLoggingScenarioTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B6811E25F0EA860015B4AF /* CrashReportingWithLoggingScenarioTests.swift */; };
61B6815E25F135890015B4AF /* CrashReportingWithRUMScenarioTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B6815D25F135890015B4AF /* CrashReportingWithRUMScenarioTests.swift */; };
61B7885D25C180CB002675B5 /* DatadogCrashReporting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7885425C180CB002675B5 /* DatadogCrashReporting.framework */; };
Expand Down Expand Up @@ -948,6 +953,11 @@
61B3BD51266128D300A9BEF0 /* LoggerE2ETests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggerE2ETests.swift; sourceTree = "<group>"; };
61B558CE2469561C001460D3 /* LoggerBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggerBuilderTests.swift; sourceTree = "<group>"; };
61B558D32469CDD8001460D3 /* TracingUUIDGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TracingUUIDGeneratorTests.swift; sourceTree = "<group>"; };
61B5E42026DF85C7000B0A5F /* DDRUMMonitor+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDRUMMonitor+apiTests.m"; sourceTree = "<group>"; };
61B5E42426DFAFBC000B0A5F /* DDGlobal+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDGlobal+apiTests.m"; sourceTree = "<group>"; };
61B5E42626DFB145000B0A5F /* DDDatadog+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDDatadog+apiTests.m"; sourceTree = "<group>"; };
61B5E42826DFB60A000B0A5F /* DDConfiguration+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDConfiguration+apiTests.m"; sourceTree = "<group>"; };
61B5E42A26DFC433000B0A5F /* DDNSURLSessionDelegate+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDNSURLSessionDelegate+apiTests.m"; sourceTree = "<group>"; };
61B6811E25F0EA860015B4AF /* CrashReportingWithLoggingScenarioTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportingWithLoggingScenarioTests.swift; sourceTree = "<group>"; };
61B6815D25F135890015B4AF /* CrashReportingWithRUMScenarioTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportingWithRUMScenarioTests.swift; sourceTree = "<group>"; };
61B7885425C180CB002675B5 /* DatadogCrashReporting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DatadogCrashReporting.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1550,6 +1560,7 @@
61133C132423990D00786299 /* DatadogObjc */ = {
isa = PBXGroup;
children = (
61B5E41F26DF857E000B0A5F /* ObjcAPITests */,
61133C142423990D00786299 /* DDDatadogTests.swift */,
61133C162423990D00786299 /* DDConfigurationTests.swift */,
616B6683259CAE3300968EE8 /* DDGlobalTests.swift */,
Expand Down Expand Up @@ -2605,6 +2616,18 @@
path = Logging;
sourceTree = "<group>";
};
61B5E41F26DF857E000B0A5F /* ObjcAPITests */ = {
isa = PBXGroup;
children = (
61B5E42626DFB145000B0A5F /* DDDatadog+apiTests.m */,
61B5E42826DFB60A000B0A5F /* DDConfiguration+apiTests.m */,
61B5E42026DF85C7000B0A5F /* DDRUMMonitor+apiTests.m */,
61B5E42A26DFC433000B0A5F /* DDNSURLSessionDelegate+apiTests.m */,
61B5E42426DFAFBC000B0A5F /* DDGlobal+apiTests.m */,
);
path = ObjcAPITests;
sourceTree = "<group>";
};
61B6811D25F0E8480015B4AF /* CrashReporting */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3890,6 +3913,7 @@
61133C672423990D00786299 /* LogConsoleOutputTests.swift in Sources */,
6114FDEC257659E90084E372 /* FeatureDirectoriesMock.swift in Sources */,
61122EE825B1C92500F9C7F5 /* SpanSanitizerTests.swift in Sources */,
61B5E42526DFAFBC000B0A5F /* DDGlobal+apiTests.m in Sources */,
61FB222D244A21ED00902D19 /* LoggingFeatureMocks.swift in Sources */,
617B954224BF4E7600E6F443 /* RUMMonitorConfigurationTests.swift in Sources */,
614BF37E2670AE9D002379C8 /* AttributesMocks.swift in Sources */,
Expand Down Expand Up @@ -3978,12 +4002,14 @@
614B0A5124EBDC8000A2A780 /* RUMConnectivityInfoProviderTests.swift in Sources */,
611F82032563C66100CB9BDB /* UIKitRUMViewsPredicateTests.swift in Sources */,
61133C652423990D00786299 /* LogBuilderTests.swift in Sources */,
61B5E42B26DFC433000B0A5F /* DDNSURLSessionDelegate+apiTests.m in Sources */,
61F8CC092469295500FE2908 /* DatadogConfigurationBuilderTests.swift in Sources */,
61F1A623249B811200075390 /* Encoding.swift in Sources */,
6114FE3B25768AA90084E372 /* ConsentProviderTests.swift in Sources */,
61133C642423990D00786299 /* LoggerTests.swift in Sources */,
617B953D24BF4D8F00E6F443 /* RUMMonitorTests.swift in Sources */,
61F187FC25FA7DD60022CE9A /* InternalMonitoringFeatureTests.swift in Sources */,
61B5E42126DF85C7000B0A5F /* DDRUMMonitor+apiTests.m in Sources */,
61786F7724FCDE05009E6BAB /* RUMDebuggingTests.swift in Sources */,
61F9CA712512450B000A5E61 /* RUMAutoInstrumentationTests.swift in Sources */,
6156CB9324DDAA34008CB2B2 /* RUMCurrentContextTests.swift in Sources */,
Expand All @@ -4004,9 +4030,11 @@
61F2724925C943C500D54BF8 /* CrashReporterTests.swift in Sources */,
6172472725D673D7007085B3 /* CrashContextTests.swift in Sources */,
61BAD46A26415FCE001886CA /* OTSpanTests.swift in Sources */,
61B5E42726DFB145000B0A5F /* DDDatadog+apiTests.m in Sources */,
6121627C247D220500AC5D67 /* LoggingForTracingAdapterTests.swift in Sources */,
61133C532423990D00786299 /* MobileDeviceTests.swift in Sources */,
61FF282124B8981D000B3D9B /* RUMEventBuilderTests.swift in Sources */,
61B5E42926DFB60A000B0A5F /* DDConfiguration+apiTests.m in Sources */,
61345613244756E300E7DA6B /* PerformancePresetTests.swift in Sources */,
616A9CD22535D38200DB83CF /* UIKitHierarchyInspectorTests.swift in Sources */,
);
Expand Down
1 change: 1 addition & 0 deletions DatadogSDKCrashReporting.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '11.0'

s.source = { :git => 'https://github.com/DataDog/dd-sdk-ios.git', :tag => s.version.to_s }
s.static_framework = true

s.source_files = "Sources/DatadogCrashReporting/**/*.swift"
s.dependency 'DatadogSDK', '1.7.0-beta4'
Expand Down
1 change: 1 addition & 0 deletions DatadogSDKCrashReporting.podspec.src
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '11.0'

s.source = { :git => 'https://github.com/DataDog/dd-sdk-ios.git', :tag => s.version.to_s }
s.static_framework = true

s.source_files = "Sources/DatadogCrashReporting/**/*.swift"
s.dependency 'DatadogSDK', '__DATADOG_VERSION__'
Expand Down
7 changes: 7 additions & 0 deletions Sources/DatadogObjc/Datadog+objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,11 @@ public class DDDatadog: NSObject {
public static func setTrackingConsent(consent: DDTrackingConsent) {
Datadog.set(trackingConsent: consent.sdkConsent)
}

#if DD_SDK_COMPILED_FOR_TESTING
@objc
public static func flushAndDeinitialize() {
Datadog.flushAndDeinitialize()
}
#endif
}
2 changes: 2 additions & 0 deletions Sources/DatadogObjc/RUMMonitor+objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class DDRUMView: NSObject {
/// - Parameters:
/// - name: the RUM View name, appearing as `VIEW NAME` in RUM Explorer.
/// - attributes: additional attributes to associate with the RUM View.
@objc
public init(name: String, attributes: [String: Any]) {
swiftView = RUMView(
name: name,
Expand Down Expand Up @@ -71,6 +72,7 @@ public class DDRUMAction: NSObject {
/// - Parameters:
/// - name: the RUM Action name, appearing as `ACTION NAME` in RUM Explorer.
/// - attributes: additional attributes to associate with the RUM Action.
@objc
public init(name: String, attributes: [String: Any]) {
swiftAction = RUMAction(
name: name,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

#import <XCTest/XCTest.h>
@import DatadogObjc;
@import DatadogCrashReporting;

// MARK: - DDUIKitRUMViewsPredicate

@interface CustomDDUIKitRUMViewsPredicate: NSObject
@end

@interface CustomDDUIKitRUMViewsPredicate () <DDUIKitRUMViewsPredicate>
@end

@implementation CustomDDUIKitRUMViewsPredicate
- (DDRUMView * _Nullable)rumViewFor:(UIViewController * _Nonnull)viewController { return nil; }
@end

// MARK: - DDUIKitRUMViewsPredicate

@interface CustomDDUIKitRUMUserActionsPredicate: NSObject
@end

@interface CustomDDUIKitRUMUserActionsPredicate () <DDUIKitRUMUserActionsPredicate>
@end

@implementation CustomDDUIKitRUMUserActionsPredicate
- (DDRUMAction * _Nullable)rumActionWithTargetView:(UIView * _Nonnull)targetView { return nil; }
@end

// MARK: - Tests

@interface DDConfiguration_apiTests : XCTestCase
@end

/*
* `DatadogObjc` APIs smoke tests - only check if the interface is available to Objc.
*/
@implementation DDConfiguration_apiTests

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"

- (void)testDDEndpointAPI {
[DDEndpoint eu];
[DDEndpoint eu1];
[DDEndpoint gov];
[DDEndpoint us];
[DDEndpoint us1];
[DDEndpoint us1];
[DDEndpoint us1_fed];
[DDEndpoint us3];
}

- (void)testDDBatchSizeAPI {
DDBatchSizeSmall; DDBatchSizeMedium; DDBatchSizeLarge;
}

- (void)testDDUploadFrequencyAPI {
DDUploadFrequencyRare; DDUploadFrequencyAverage; DDUploadFrequencyFrequent;
}

- (void)testDDConfigurationAPI {
[DDConfiguration builderWithClientToken:@"" environment:@""];
[DDConfiguration builderWithRumApplicationID:@"" clientToken:@"" environment:@""];
}

- (void)testDDConfigurationBuilderAPI {
DDConfigurationBuilder *builder = [DDConfiguration builderWithClientToken:@"" environment:@""];
[builder enableLogging:YES];
[builder enableTracing:YES];
[builder enableRUM:YES];
[builder enableCrashReportingUsing:[DDCrashReportingPlugin new]];
[builder setWithEndpoint:[DDEndpoint us]];
[builder setWithCustomLogsEndpoint:[NSURL new]];
[builder setWithCustomTracesEndpoint:[NSURL new]];
[builder setWithCustomRUMEndpoint:[NSURL new]];
[builder trackURLSessionWithFirstPartyHosts:[NSSet setWithArray:@[]]];
[builder setWithServiceName:@""];
[builder setWithRumSessionsSamplingRate:50];
[builder trackUIKitRUMViews];
[builder trackUIKitRUMViewsUsing:[CustomDDUIKitRUMViewsPredicate new]];
[builder trackUIKitRUMActions];
[builder trackUIKitRUMActionsUsing:[CustomDDUIKitRUMUserActionsPredicate new]];
[builder setRUMViewEventMapper:^DDRUMViewEvent * _Nonnull(DDRUMViewEvent * _Nonnull viewEvent) {
viewEvent.view.url = @"";
return viewEvent;
}];
[builder setRUMResourceEventMapper:^DDRUMResourceEvent * _Nullable(DDRUMResourceEvent * _Nonnull resourceEvent) {
resourceEvent.resource.url = @"";
return resourceEvent;
}];
[builder setRUMActionEventMapper:^DDRUMActionEvent * _Nullable(DDRUMActionEvent * _Nonnull actionEvent) {
return nil;
}];
[builder setRUMErrorEventMapper:^DDRUMErrorEvent * _Nullable(DDRUMErrorEvent * _Nonnull errorEvent) {
return nil;
}];
[builder setWithBatchSize:DDBatchSizeMedium];
[builder setWithUploadFrequency:DDUploadFrequencyAverage];
[builder setWithAdditionalConfiguration:@{}];
[builder build];
}

#pragma clang diagnostic pop

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

#import <XCTest/XCTest.h>
@import DatadogObjc;

@interface DDDatadog_apiTests : XCTestCase
@end

/*
* `DatadogObjc` APIs smoke tests - only check if the interface is available to Objc.
*/
@implementation DDDatadog_apiTests

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"

- (void)testDDTrackingConsentAPI {
[DDTrackingConsent granted];
[DDTrackingConsent notGranted];
[DDTrackingConsent pending];
}

- (void)testDDAppContextAPI {
[[DDAppContext alloc] initWithMainBundle:[NSBundle mainBundle]];
[[DDAppContext alloc] init];
}

- (void)testDDDatadog {
DDConfiguration *configuration = [[DDConfiguration builderWithClientToken:@"abc" environment:@"def"] build];

[DDDatadog initializeWithAppContext:[[DDAppContext alloc] init]
trackingConsent:[DDTrackingConsent notGranted]
configuration:configuration];

DDSDKVerbosityLevel verbosity = [DDDatadog verbosityLevel];
[DDDatadog setVerbosityLevel:verbosity];

[DDDatadog setUserInfoWithId:@"" name:@"" email:@"" extraInfo:@{}];
[DDDatadog setTrackingConsentWithConsent:[DDTrackingConsent notGranted]];

[DDDatadog flushAndDeinitialize];
}

#pragma clang diagnostic pop

@end
28 changes: 28 additions & 0 deletions Tests/DatadogTests/DatadogObjc/ObjcAPITests/DDGlobal+apiTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

#import <XCTest/XCTest.h>
@import DatadogObjc;

@interface DDGlobal_apiTests : XCTestCase
@end

/*
* `DatadogObjc` APIs smoke tests - only check if the interface is available to Objc.
*/
@implementation DDGlobal_apiTests

- (void)testSharedTracerAPI {
id tracer = DDGlobal.sharedTracer;
DDGlobal.sharedTracer = tracer;
}

- (void)testRUMAPI {
id rum = DDGlobal.rum;
DDGlobal.rum = rum;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

#import <XCTest/XCTest.h>
@import DatadogObjc;

@interface DDNSURLSessionDelegate_apiTests : XCTestCase
@end

/*
* `DatadogObjc` APIs smoke tests - only check if the interface is available to Objc.
*/
@implementation DDNSURLSessionDelegate_apiTests

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"

- (void)testDDNSURLSessionDelegateAPI {
[[DDNSURLSessionDelegate alloc] init];
[[DDNSURLSessionDelegate alloc] initWithAdditionalFirstPartyHosts:[NSSet setWithArray:@[]]];
}

#pragma clang diagnostic pop

@end
Loading