From 184cb02314999e1d274debac4a5953c25d33b82e Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Mon, 21 Jun 2021 10:53:44 +0200 Subject: [PATCH 1/2] RUMM-1397 Update Endpoints --- .../Datadog/Core/FeaturesConfiguration.swift | 2 +- Sources/Datadog/DatadogConfiguration.swift | 90 ++++++++++++++++++- .../DatadogConfiguration+objc.swift | 36 ++++++++ .../Core/FeaturesConfigurationTests.swift | 56 +++++++++++- .../DatadogConfigurationBuilderTests.swift | 22 ++--- .../Datadog/Mocks/CoreMocks.swift | 14 +-- .../DatadogObjc/DDConfigurationTests.swift | 22 +++-- 7 files changed, 211 insertions(+), 31 deletions(-) diff --git a/Sources/Datadog/Core/FeaturesConfiguration.swift b/Sources/Datadog/Core/FeaturesConfiguration.swift index 12024ca521..052fb55049 100644 --- a/Sources/Datadog/Core/FeaturesConfiguration.swift +++ b/Sources/Datadog/Core/FeaturesConfiguration.swift @@ -262,7 +262,7 @@ extension FeaturesConfiguration { sdkServiceName: "dd-sdk-ios", sdkEnvironment: "prod", logsUploadURLWithClientToken: try ifValid( - endpointURLString: Datadog.Configuration.DatadogEndpoint.us.logsEndpoint.url, + endpointURLString: Datadog.Configuration.DatadogEndpoint.us1.logsEndpoint.url, clientToken: internalMonitoringClientToken ) ) diff --git a/Sources/Datadog/DatadogConfiguration.swift b/Sources/Datadog/DatadogConfiguration.swift index 08c7e84e1e..b0dafa676f 100644 --- a/Sources/Datadog/DatadogConfiguration.swift +++ b/Sources/Datadog/DatadogConfiguration.swift @@ -38,16 +38,35 @@ extension Datadog { public enum DatadogEndpoint { /// US based servers. /// Sends data to [app.datadoghq.com](https://app.datadoghq.com/). + case us1 + /// US based servers. + /// Sends data to [app.datadoghq.com](https://us3.datadoghq.com/). + case us3 + /// Europe based servers. + /// Sends data to [app.datadoghq.eu](https://app.datadoghq.eu/). + case eu1 + /// US based servers, FedRAMP compatible. + /// Sends data to [app.ddog-gov.com](https://app.ddog-gov.com/). + case us1_fed + /// US based servers. + /// Sends data to [app.datadoghq.com](https://app.datadoghq.com/). + @available(*, deprecated, message: "Renamed to us1") case us /// Europe based servers. /// Sends data to [app.datadoghq.eu](https://app.datadoghq.eu/). + @available(*, deprecated, message: "Renamed to eu1") case eu /// Gov servers. /// Sends data to [app.ddog-gov.com](https://app.ddog-gov.com/). + @available(*, deprecated, message: "Renamed to us1_fed") case gov internal var logsEndpoint: LogsEndpoint { switch self { + case .us1: return .us1 + case .us3: return .us3 + case .eu1: return .eu1 + case .us1_fed: return .us1_fed case .us: return .us case .eu: return .eu case .gov: return .gov @@ -56,6 +75,10 @@ extension Datadog { internal var tracesEndpoint: TracesEndpoint { switch self { + case .us1: return .us1 + case .us3: return .us3 + case .eu1: return .eu1 + case .us1_fed: return .us1_fed case .us: return .us case .eu: return .eu case .gov: return .gov @@ -64,6 +87,10 @@ extension Datadog { internal var rumEndpoint: RUMEndpoint { switch self { + case .us1: return .us1 + case .us3: return .us3 + case .eu1: return .eu1 + case .us1_fed: return .us1_fed case .us: return .us case .eu: return .eu case .gov: return .gov @@ -75,18 +102,37 @@ extension Datadog { public enum LogsEndpoint { /// US based servers. /// Sends logs to [app.datadoghq.com](https://app.datadoghq.com/). + case us1 + /// US based servers. + /// Sends logs to [app.datadoghq.com](https://us3.datadoghq.com/). + case us3 + /// Europe based servers. + /// Sends logs to [app.datadoghq.eu](https://app.datadoghq.eu/). + case eu1 + /// US based servers, FedRAMP compatible. + /// Sends logs to [app.ddog-gov.com](https://app.ddog-gov.com/). + case us1_fed + /// US based servers. + /// Sends logs to [app.datadoghq.com](https://app.datadoghq.com/). + @available(*, deprecated, message: "Renamed to us1") case us /// Europe based servers. /// Sends logs to [app.datadoghq.eu](https://app.datadoghq.eu/). + @available(*, deprecated, message: "Renamed to eu1") case eu /// Gov servers. /// Sends logs to [app.ddog-gov.com](https://app.ddog-gov.com/). + @available(*, deprecated, message: "Renamed to us1_fed") case gov /// User-defined server. case custom(url: String) internal var url: String { switch self { + case .us1: return "https://logs.browser-intake-datadoghq.com/v1/input/" + case .us3: return "https://logs.browser-intake-us3-datadoghq.com/v1/input/" + case .eu1: return "https://mobile-http-intake.logs.datadoghq.eu/v1/input/" + case .us1_fed: return "https://logs.browser-intake-ddog-gov.com/v1/input/" case .us: return "https://mobile-http-intake.logs.datadoghq.com/v1/input/" case .eu: return "https://mobile-http-intake.logs.datadoghq.eu/v1/input/" case .gov: return "https://logs.browser-intake-ddog-gov.com/v1/input/" @@ -99,18 +145,37 @@ extension Datadog { public enum TracesEndpoint { /// US based servers. /// Sends traces to [app.datadoghq.com](https://app.datadoghq.com/). + case us1 + /// US based servers. + /// Sends traces to [app.datadoghq.com](https://us3.datadoghq.com/). + case us3 + /// Europe based servers. + /// Sends traces to [app.datadoghq.eu](https://app.datadoghq.eu/). + case eu1 + /// US based servers, FedRAMP compatible. + /// Sends traces to [app.ddog-gov.com](https://app.ddog-gov.com/). + case us1_fed + /// US based servers. + /// Sends traces to [app.datadoghq.com](https://app.datadoghq.com/). + @available(*, deprecated, message: "Renamed to us1") case us /// Europe based servers. /// Sends traces to [app.datadoghq.eu](https://app.datadoghq.eu/). + @available(*, deprecated, message: "Renamed to eu1") case eu /// Gov servers. /// Sends traces to [app.ddog-gov.com](https://app.ddog-gov.com/). + @available(*, deprecated, message: "Renamed to us1_fed") case gov /// User-defined server. case custom(url: String) internal var url: String { switch self { + case .us1: return "https://trace.browser-intake-datadoghq.com/v1/input/" + case .us3: return "https://trace.browser-intake-us3-datadoghq.com/v1/input/" + case .eu1: return "https:/public-trace-http-intake.logs.datadoghq.eu/v1/input/" + case .us1_fed: return "https://trace.browser-intake-ddog-gov.com/v1/input/" case .us: return "https://public-trace-http-intake.logs.datadoghq.com/v1/input/" case .eu: return "https://public-trace-http-intake.logs.datadoghq.eu/v1/input/" case .gov: return "https://trace.browser-intake-ddog-gov.com/v1/input/" @@ -123,18 +188,37 @@ extension Datadog { public enum RUMEndpoint { /// US based servers. /// Sends RUM events to [app.datadoghq.com](https://app.datadoghq.com/). + case us1 + /// US based servers. + /// Sends RUM events to [app.datadoghq.com](https://us3.datadoghq.com/). + case us3 + /// Europe based servers. + /// Sends RUM events to [app.datadoghq.eu](https://app.datadoghq.eu/). + case eu1 + /// US based servers, FedRAMP compatible. + /// Sends RUM events to [app.ddog-gov.com](https://app.ddog-gov.com/). + case us1_fed + /// US based servers. + /// Sends RUM events to [app.datadoghq.com](https://app.datadoghq.com/). + @available(*, deprecated, message: "Renamed to us1") case us /// Europe based servers. /// Sends RUM events to [app.datadoghq.eu](https://app.datadoghq.eu/). + @available(*, deprecated, message: "Renamed to eu1") case eu /// Gov servers. /// Sends RUM events to [app.ddog-gov.com](https://app.ddog-gov.com/). + @available(*, deprecated, message: "Renamed to us1_fed") case gov /// User-defined server. case custom(url: String) internal var url: String { switch self { + case .us1: return "https://rum.browser-intake-datadoghq.com/v1/input/" + case .us3: return "https://rum.browser-intake-us3-datadoghq.com/v1/input/" + case .eu1: return "https://rum-http-intake.logs.datadoghq.eu/v1/input/" + case .us1_fed: return "https://rum.browser-intake-ddog-gov.com/v1/input/" case .us: return "https://rum-http-intake.logs.datadoghq.com/v1/input/" case .eu: return "https://rum-http-intake.logs.datadoghq.eu/v1/input/" case .gov: return "https://rum.browser-intake-ddog-gov.com/v1/input/" @@ -237,9 +321,9 @@ extension Datadog { customLogsEndpoint: nil, customTracesEndpoint: nil, customRUMEndpoint: nil, - logsEndpoint: .us, - tracesEndpoint: .us, - rumEndpoint: .us, + logsEndpoint: .us1, + tracesEndpoint: .us1, + rumEndpoint: .us1, serviceName: nil, firstPartyHosts: nil, spanEventMapper: nil, diff --git a/Sources/DatadogObjc/DatadogConfiguration+objc.swift b/Sources/DatadogObjc/DatadogConfiguration+objc.swift index 2a9b1a7a00..ee8e4aa86b 100644 --- a/Sources/DatadogObjc/DatadogConfiguration+objc.swift +++ b/Sources/DatadogObjc/DatadogConfiguration+objc.swift @@ -17,6 +17,18 @@ public class DDEndpoint: NSObject { // MARK: - Public + @objc + public static func us1() -> DDEndpoint { .init(sdkEndpoint: .us1) } + + @objc + public static func us3() -> DDEndpoint { .init(sdkEndpoint: .us3) } + + @objc + public static func eu1() -> DDEndpoint { .init(sdkEndpoint: .eu1) } + + @objc + public static func us1_fed() -> DDEndpoint { .init(sdkEndpoint: .us1_fed) } + @objc public static func eu() -> DDEndpoint { .init(sdkEndpoint: .eu) } @@ -37,6 +49,18 @@ public class DDLogsEndpoint: NSObject { // MARK: - Public + @objc + public static func us1() -> DDLogsEndpoint { .init(sdkEndpoint: .us1) } + + @objc + public static func us3() -> DDLogsEndpoint { .init(sdkEndpoint: .us3) } + + @objc + public static func eu1() -> DDLogsEndpoint { .init(sdkEndpoint: .eu1) } + + @objc + public static func us1_fed() -> DDLogsEndpoint { .init(sdkEndpoint: .us1_fed) } + @objc public static func eu() -> DDLogsEndpoint { .init(sdkEndpoint: .eu) } @@ -60,6 +84,18 @@ public class DDTracesEndpoint: NSObject { // MARK: - Public + @objc + public static func us1() -> DDTracesEndpoint { .init(sdkEndpoint: .us1) } + + @objc + public static func us3() -> DDTracesEndpoint { .init(sdkEndpoint: .us3) } + + @objc + public static func eu1() -> DDTracesEndpoint { .init(sdkEndpoint: .eu1) } + + @objc + public static func us1_fed() -> DDTracesEndpoint { .init(sdkEndpoint: .us1_fed) } + @objc public static func eu() -> DDTracesEndpoint { .init(sdkEndpoint: .eu) } diff --git a/Tests/DatadogTests/Datadog/Core/FeaturesConfigurationTests.swift b/Tests/DatadogTests/Datadog/Core/FeaturesConfigurationTests.swift index 8011517fb0..dc5a2925c7 100644 --- a/Tests/DatadogTests/Datadog/Core/FeaturesConfigurationTests.swift +++ b/Tests/DatadogTests/Datadog/Core/FeaturesConfigurationTests.swift @@ -137,6 +137,22 @@ class FeaturesConfigurationTests: XCTestCase { ) } + XCTAssertEqual( + try configuration(datadogEndpoint: .us1).logging?.uploadURLWithClientToken.absoluteString, + "https://logs.browser-intake-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us3).logging?.uploadURLWithClientToken.absoluteString, + "https://logs.browser-intake-us3-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .eu1).logging?.uploadURLWithClientToken.absoluteString, + "https://mobile-http-intake.logs.datadoghq.eu/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us1_fed).logging?.uploadURLWithClientToken.absoluteString, + "https://logs.browser-intake-ddog-gov.com/v1/input/" + clientToken + ) XCTAssertEqual( try configuration(datadogEndpoint: .us).logging?.uploadURLWithClientToken.absoluteString, "https://mobile-http-intake.logs.datadoghq.com/v1/input/" + clientToken @@ -150,6 +166,22 @@ class FeaturesConfigurationTests: XCTestCase { "https://logs.browser-intake-ddog-gov.com/v1/input/" + clientToken ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us1).tracing?.uploadURLWithClientToken.absoluteString, + "https://trace.browser-intake-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us3).tracing?.uploadURLWithClientToken.absoluteString, + "https://trace.browser-intake-us3-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .eu1).tracing?.uploadURLWithClientToken.absoluteString, + "https:/public-trace-http-intake.logs.datadoghq.eu/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us1_fed).tracing?.uploadURLWithClientToken.absoluteString, + "https://trace.browser-intake-ddog-gov.com/v1/input/" + clientToken + ) XCTAssertEqual( try configuration(datadogEndpoint: .us).tracing?.uploadURLWithClientToken.absoluteString, "https://public-trace-http-intake.logs.datadoghq.com/v1/input/" + clientToken @@ -163,6 +195,22 @@ class FeaturesConfigurationTests: XCTestCase { "https://trace.browser-intake-ddog-gov.com/v1/input/" + clientToken ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us1).rum?.uploadURLWithClientToken.absoluteString, + "https://rum.browser-intake-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us3).rum?.uploadURLWithClientToken.absoluteString, + "https://rum.browser-intake-us3-datadoghq.com/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .eu1).rum?.uploadURLWithClientToken.absoluteString, + "https://rum-http-intake.logs.datadoghq.eu/v1/input/" + clientToken + ) + XCTAssertEqual( + try configuration(datadogEndpoint: .us1_fed).rum?.uploadURLWithClientToken.absoluteString, + "https://rum.browser-intake-ddog-gov.com/v1/input/" + clientToken + ) XCTAssertEqual( try configuration(datadogEndpoint: .us).rum?.uploadURLWithClientToken.absoluteString, "https://rum-http-intake.logs.datadoghq.com/v1/input/" + clientToken @@ -543,7 +591,7 @@ class FeaturesConfigurationTests: XCTestCase { XCTAssertEqual(configuration.sdkEnvironment, "prod", "Internal monitoring data should be available under \"env:prod\"") XCTAssertEqual( configuration.logsUploadURLWithClientToken.absoluteString, - "https://mobile-http-intake.logs.datadoghq.com/v1/input/" + internalMonitoringClientToken + "https://logs.browser-intake-datadoghq.com/v1/input/" + internalMonitoringClientToken ) } @@ -690,9 +738,9 @@ class FeaturesConfigurationTests: XCTestCase { customLogsEndpoint: URL? = nil, customTracesEndpoint: URL? = nil, customRUMEndpoint: URL? = nil, - logsEndpoint: Datadog.Configuration.LogsEndpoint = .us, - tracesEndpoint: Datadog.Configuration.TracesEndpoint = .us, - rumEndpoint: Datadog.Configuration.RUMEndpoint = .us + logsEndpoint: Datadog.Configuration.LogsEndpoint = .us1, + tracesEndpoint: Datadog.Configuration.TracesEndpoint = .us1, + rumEndpoint: Datadog.Configuration.RUMEndpoint = .us1 ) throws -> FeaturesConfiguration { return try FeaturesConfiguration( configuration: .mockWith( diff --git a/Tests/DatadogTests/Datadog/DatadogConfigurationBuilderTests.swift b/Tests/DatadogTests/Datadog/DatadogConfigurationBuilderTests.swift index 020fa76c9f..40812a72c2 100644 --- a/Tests/DatadogTests/Datadog/DatadogConfigurationBuilderTests.swift +++ b/Tests/DatadogTests/Datadog/DatadogConfigurationBuilderTests.swift @@ -38,9 +38,9 @@ class DatadogConfigurationBuilderTests: XCTestCase { XCTAssertNil(configuration.customLogsEndpoint) XCTAssertNil(configuration.customTracesEndpoint) XCTAssertNil(configuration.customRUMEndpoint) - XCTAssertEqual(configuration.logsEndpoint, .us) - XCTAssertEqual(configuration.tracesEndpoint, .us) - XCTAssertEqual(configuration.rumEndpoint, .us) + XCTAssertEqual(configuration.logsEndpoint, .us1) + XCTAssertEqual(configuration.tracesEndpoint, .us1) + XCTAssertEqual(configuration.rumEndpoint, .us1) XCTAssertNil(configuration.serviceName) XCTAssertNil(configuration.firstPartyHosts) XCTAssertNil(configuration.spanEventMapper) @@ -73,7 +73,7 @@ class DatadogConfigurationBuilderTests: XCTestCase { .enableTracing(false) .enableRUM(false) .enableCrashReporting(using: mockCrashReportingPlugin) - .set(endpoint: .eu) + .set(endpoint: .eu1) .set(customLogsEndpoint: URL(string: "https://api.custom.logs/")!) .set(customTracesEndpoint: URL(string: "https://api.custom.traces/")!) .set(customRUMEndpoint: URL(string: "https://api.custom.rum/")!) @@ -118,7 +118,7 @@ class DatadogConfigurationBuilderTests: XCTestCase { XCTAssertFalse(configuration.tracingEnabled) XCTAssertFalse(configuration.rumEnabled) XCTAssertTrue(configuration.crashReportingPlugin === mockCrashReportingPlugin) - XCTAssertEqual(configuration.datadogEndpoint, .eu) + XCTAssertEqual(configuration.datadogEndpoint, .eu1) XCTAssertEqual(configuration.customLogsEndpoint, URL(string: "https://api.custom.logs/")!) XCTAssertEqual(configuration.customTracesEndpoint, URL(string: "https://api.custom.traces/")!) XCTAssertEqual(configuration.customRUMEndpoint, URL(string: "https://api.custom.rum/")!) @@ -145,16 +145,16 @@ class DatadogConfigurationBuilderTests: XCTestCase { func testDeprecatedAPIs() { let builder = Datadog.Configuration.builderUsing(clientToken: "abc-123", environment: "tests") _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(tracedHosts: ["example.com"]) - _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(logsEndpoint: .eu) - _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(tracesEndpoint: .eu) - _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(rumEndpoint: .eu) + _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(logsEndpoint: .eu1) + _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(tracesEndpoint: .eu1) + _ = (builder as ConfigurationBuilderDeprecatedAPIs).set(rumEndpoint: .eu1) let configuration = builder.build() XCTAssertEqual(configuration.firstPartyHosts, ["example.com"]) - XCTAssertEqual(configuration.logsEndpoint, .eu) - XCTAssertEqual(configuration.tracesEndpoint, .eu) - XCTAssertEqual(configuration.rumEndpoint, .eu) + XCTAssertEqual(configuration.logsEndpoint, .eu1) + XCTAssertEqual(configuration.tracesEndpoint, .eu1) + XCTAssertEqual(configuration.rumEndpoint, .eu1) } } diff --git a/Tests/DatadogTests/Datadog/Mocks/CoreMocks.swift b/Tests/DatadogTests/Datadog/Mocks/CoreMocks.swift index 665488a9e0..418476debc 100644 --- a/Tests/DatadogTests/Datadog/Mocks/CoreMocks.swift +++ b/Tests/DatadogTests/Datadog/Mocks/CoreMocks.swift @@ -44,9 +44,9 @@ extension Datadog.Configuration { customLogsEndpoint: URL? = nil, customTracesEndpoint: URL? = nil, customRUMEndpoint: URL? = nil, - logsEndpoint: LogsEndpoint = .us, - tracesEndpoint: TracesEndpoint = .us, - rumEndpoint: RUMEndpoint = .us, + logsEndpoint: LogsEndpoint = .us1, + tracesEndpoint: TracesEndpoint = .us1, + rumEndpoint: RUMEndpoint = .us1, serviceName: String? = .mockAny(), firstPartyHosts: Set? = nil, rumSessionsSamplingRate: Float = 100.0, @@ -113,25 +113,25 @@ extension BundleType: CaseIterable { extension Datadog.Configuration.DatadogEndpoint { static func mockRandom() -> Self { - return [.us, .eu, .gov].randomElement()! + return [.us1, .us3, .eu1, .us1_fed, .us, .eu, .gov].randomElement()! } } extension Datadog.Configuration.LogsEndpoint { static func mockRandom() -> Self { - return [.us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! + return [.us1, .us3, .eu1, .us1_fed, .us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! } } extension Datadog.Configuration.TracesEndpoint { static func mockRandom() -> Self { - return [.us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! + return [.us1, .us3, .eu1, .us1_fed, .us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! } } extension Datadog.Configuration.RUMEndpoint { static func mockRandom() -> Self { - return [.us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! + return [.us1, .us3, .eu1, .us1_fed, .us, .eu, .gov, .custom(url: "http://example.com/api/")].randomElement()! } } diff --git a/Tests/DatadogTests/DatadogObjc/DDConfigurationTests.swift b/Tests/DatadogTests/DatadogObjc/DDConfigurationTests.swift index 573765ad6c..05d466fe35 100644 --- a/Tests/DatadogTests/DatadogObjc/DDConfigurationTests.swift +++ b/Tests/DatadogTests/DatadogObjc/DDConfigurationTests.swift @@ -11,7 +11,7 @@ import XCTest extension Datadog.Configuration.LogsEndpoint: Equatable { public static func == (_ lhs: Datadog.Configuration.LogsEndpoint, _ rhs: Datadog.Configuration.LogsEndpoint) -> Bool { switch (lhs, rhs) { - case (.us, .us), (.eu, .eu), (.gov, .gov): return true + case (.us, .us), (.eu, .eu), (.gov, .gov), (.us1, .us1), (.us3, .us3), (.eu1, .eu1), (.us1_fed, .us1_fed): return true case let (.custom(lhsURL), .custom(rhsURL)): return lhsURL == rhsURL default: return false } @@ -21,7 +21,7 @@ extension Datadog.Configuration.LogsEndpoint: Equatable { extension Datadog.Configuration.TracesEndpoint: Equatable { public static func == (_ lhs: Datadog.Configuration.TracesEndpoint, _ rhs: Datadog.Configuration.TracesEndpoint) -> Bool { switch (lhs, rhs) { - case (.us, .us), (.eu, .eu), (.gov, .gov): return true + case (.us, .us), (.eu, .eu), (.gov, .gov), (.us1, .us1), (.us3, .us3), (.eu1, .eu1), (.us1_fed, .us1_fed): return true case let (.custom(lhsURL), .custom(rhsURL)): return lhsURL == rhsURL default: return false } @@ -48,9 +48,9 @@ class DDConfigurationTests: XCTestCase { XCTAssertTrue(configuration.loggingEnabled) XCTAssertTrue(configuration.tracingEnabled) XCTAssertNil(configuration.crashReportingPlugin) - XCTAssertEqual(configuration.logsEndpoint, .us) - XCTAssertEqual(configuration.tracesEndpoint, .us) - XCTAssertEqual(configuration.rumEndpoint, .us) + XCTAssertEqual(configuration.logsEndpoint, .us1) + XCTAssertEqual(configuration.tracesEndpoint, .us1) + XCTAssertEqual(configuration.rumEndpoint, .us1) XCTAssertEqual(configuration.environment, "tests") XCTAssertNil(configuration.serviceName) XCTAssertNil(configuration.firstPartyHosts) @@ -91,6 +91,18 @@ class DDConfigurationTests: XCTestCase { objcBuilder.enableCrashReporting(using: crashReportingPlugin) XCTAssertTrue(objcBuilder.build().sdkConfiguration.crashReportingPlugin === crashReportingPlugin) + objcBuilder.set(endpoint: .eu1()) + XCTAssertEqual(objcBuilder.build().sdkConfiguration.datadogEndpoint, .eu1) + + objcBuilder.set(endpoint: .us1()) + XCTAssertEqual(objcBuilder.build().sdkConfiguration.datadogEndpoint, .us1) + + objcBuilder.set(endpoint: .us3()) + XCTAssertEqual(objcBuilder.build().sdkConfiguration.datadogEndpoint, .us3) + + objcBuilder.set(endpoint: .us1_fed()) + XCTAssertEqual(objcBuilder.build().sdkConfiguration.datadogEndpoint, .us1_fed) + objcBuilder.set(endpoint: .eu()) XCTAssertEqual(objcBuilder.build().sdkConfiguration.datadogEndpoint, .eu) From 4ff0cd8f8db14fa3aa8b5400159409298955b6b8 Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Mon, 21 Jun 2021 15:08:44 +0200 Subject: [PATCH 2/2] RUMM-1397 Update endpoint documentation --- docs/log_collection.md | 2 +- docs/rum_collection.md | 2 +- docs/trace_collection.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/log_collection.md b/docs/log_collection.md index 0359c1b2ec..57e303fee3 100644 --- a/docs/log_collection.md +++ b/docs/log_collection.md @@ -70,7 +70,7 @@ Datadog.initialize( configuration: Datadog.Configuration .builderUsing(clientToken: "", environment: "") .set(serviceName: "app-name") - .set(endpoint: .eu) + .set(endpoint: .eu1) .build() ) ``` diff --git a/docs/rum_collection.md b/docs/rum_collection.md index c2bde6d8cb..e008261a25 100644 --- a/docs/rum_collection.md +++ b/docs/rum_collection.md @@ -79,7 +79,7 @@ Datadog.initialize( environment: "" ) .set(serviceName: "app-name") - .set(endpoint: .eu) + .set(endpoint: .eu1) .build() ) ``` diff --git a/docs/trace_collection.md b/docs/trace_collection.md index 1a79353de6..c8690e05ca 100644 --- a/docs/trace_collection.md +++ b/docs/trace_collection.md @@ -68,7 +68,7 @@ Datadog.initialize( configuration: Datadog.Configuration .builderUsing(clientToken: "", environment: "") .set(serviceName: "app-name") - .set(endpoint: .eu) + .set(endpoint: .eu1) .build() ) ```