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

[CIVIS-2859] Remove application key requirement for ITR #104

Merged
merged 5 commits into from
May 22, 2024
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# https://help.github.com/en/articles/about-code-owners
#

* @nachoBonafonte @DataDog/swift
* @ypopovych @DataDog/swift

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
}
],
"defaultOptions" : {
"codeCoverage" : false,
"environmentVariableEntries" : [
{
"key" : "GITHUB_REPOSITORY",
Expand Down
2 changes: 0 additions & 2 deletions Sources/DatadogSDKTesting/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ final class Config {

/// Datatog Configuration values
var apiKey: String? = nil
var applicationKey: String? = nil
var service: String? = nil
var tags: [String: String] = [:]
var customConfigurations: [String: String] = [:]
Expand Down Expand Up @@ -77,7 +76,6 @@ final class Config {
isEnabled = env.has(.isEnabled) ? env[.isEnabled] ?? false : nil

apiKey = env[.apiKey] ?? env.get(info: "DatadogApiKey")
applicationKey = env[.applicationKey] ?? env[.appKey] ?? env.get(info: "DatadogApplicationKey")
environment = env[.environment]

let tracerUnderTesting = env.has(env: .testOutputFile)
Expand Down
6 changes: 0 additions & 6 deletions Sources/DatadogSDKTesting/DDTestMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,6 @@ internal class DDTestMonitor {
// Activate Intelligent Test Runner
if itrBackendConfig?.testsSkipping ?? false {
Log.debug("ITR Enabled")

if DDTestMonitor.config.applicationKey == nil {
Log.print("APPLICATION_KEY env variable is not set, this is needed for Intelligent Test Runner")
itr = nil
return
}

itr = IntelligentTestRunner(configurations: DDTestMonitor.baseConfigurationTags)
itr?.start()
Expand Down
1 change: 0 additions & 1 deletion Sources/DatadogSDKTesting/DDTracer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ internal class DDTracer {
environment: env.environment,
hostname: hostnameToReport,
apiKey: conf.apiKey ?? "",
applicationKey: conf.applicationKey ?? "",
endpoint: endpoint,
payloadCompression: payloadCompression,
performancePreset: .instantDataDelivery,
Expand Down
2 changes: 0 additions & 2 deletions Sources/DatadogSDKTesting/Environment/EnvironmentKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ internal enum EnvironmentKey: String, CaseIterable {
case ciVisibilityExcludedBranches = "DD_CIVISIBILITY_EXCLUDED_BRANCHES"
case ciVisibilityReportHostname = "DD_CIVISIBILITY_REPORT_HOSTNAME"
case disableSourceLocation = "DD_DISABLE_SOURCE_LOCATION"
case applicationKey = "DD_APPLICATION_KEY"
case appKey = "DD_APP_KEY"
case localTestEnvironmentPort = "DD_LOCAL_TEST_ENVIRONMENT_PORT"
case disableGitInformation = "DD_DISABLE_GIT_INFORMATION"
case testOutputFile = "TEST_OUTPUT_FILE"
Expand Down
2 changes: 1 addition & 1 deletion Sources/DatadogSDKTesting/Utils/Clock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final class NTPClock: Clock {
self._state = .synced({ Kronos.Clock.now! })
} else {
self._state = .synced({ Date() })
Log.debug("NTP server sync failed")
Log.print("NTP server sync failed")
}
waiter.signal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal class CoverageExporter {
do {
profData = try DDCoverageConversor.generateProfData(profrawFile: coverage)
} catch {
Log.debug("Prof Data genetation failed: \(error)")
Log.print("Profiler Data genetation failed: \(error)")
return
}

Expand Down
4 changes: 1 addition & 3 deletions Sources/EventsExporter/ExporterConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public struct ExporterConfiguration {

/// API key for authentication
var apiKey: String
var applicationKey: String

/// Endpoint that will be used for reporting.
var endpoint: Endpoint
Expand All @@ -37,15 +36,14 @@ public struct ExporterConfiguration {

var logger: Logger

public init(serviceName: String, libraryVersion: String, applicationName: String, applicationVersion: String, environment: String, hostname: String?, apiKey: String, applicationKey: String, endpoint: Endpoint, payloadCompression: Bool = true, source: String = "ios", performancePreset: PerformancePreset = .default, exporterId: String, logger: Logger) {
public init(serviceName: String, libraryVersion: String, applicationName: String, applicationVersion: String, environment: String, hostname: String?, apiKey: String, endpoint: Endpoint, payloadCompression: Bool = true, source: String = "ios", performancePreset: PerformancePreset = .default, exporterId: String, logger: Logger) {
self.serviceName = serviceName
self.libraryVersion = libraryVersion
self.applicationName = applicationName
self.version = applicationVersion
self.environment = environment
self.hostname = hostname
self.apiKey = apiKey
self.applicationKey = applicationKey
self.endpoint = endpoint
self.payloadCompression = payloadCompression
self.source = source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ internal class ITRService {
device: Device.current
),
.apiKeyHeader(apiKey: config.apiKey),
.applicationKeyHeader(applicationKey: config.applicationKey),
.traceIDHeader(traceID: config.exporterId),
.parentSpanIDHeader(parentSpanID: config.exporterId),
.samplingPriorityHeader()
Expand All @@ -46,7 +45,6 @@ internal class ITRService {
device: Device.current
),
.apiKeyHeader(apiKey: config.apiKey),
.applicationKeyHeader(applicationKey: config.applicationKey),
.traceIDHeader(traceID: config.exporterId),
.parentSpanIDHeader(parentSpanID: config.exporterId),
.samplingPriorityHeader()
Expand All @@ -63,7 +61,6 @@ internal class ITRService {
device: Device.current
),
.apiKeyHeader(apiKey: config.apiKey),
.applicationKeyHeader(applicationKey: config.applicationKey),
.traceIDHeader(traceID: config.exporterId),
.parentSpanIDHeader(parentSpanID: config.exporterId),
.samplingPriorityHeader()
Expand All @@ -80,7 +77,6 @@ internal class ITRService {
device: Device.current
),
.apiKeyHeader(apiKey: config.apiKey),
.applicationKeyHeader(applicationKey: config.applicationKey),
.traceIDHeader(traceID: config.exporterId),
.parentSpanIDHeader(parentSpanID: config.exporterId),
.samplingPriorityHeader()
Expand Down
5 changes: 0 additions & 5 deletions Sources/EventsExporter/Upload/HTTPHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ struct HTTPHeader {
return HTTPHeader(field: aPIKeyHeaderField, value: .constant(apiKey))
}

/// Datadog request Application Key authentication header.
static func applicationKeyHeader(applicationKey: String) -> HTTPHeader {
return HTTPHeader(field: applicationKeyHeaderField, value: .constant(applicationKey))
}

/// Datadog request Application Key authentication header.
static func hostnameHeader(hostname: String) -> HTTPHeader {
return HTTPHeader(field: hostnameHeaderField, value: .constant(hostname))
Expand Down
1 change: 0 additions & 1 deletion Tests/EventsExporter/EventsExporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class EventsExporterTests: XCTestCase {
environment: "environment",
hostname: "hostname",
apiKey: "apikey",
applicationKey: "applicationkey",
endpoint: Endpoint.custom(
testsURL: URL(string: "http://localhost:33333/traces")!,
logsURL: URL(string: "http://localhost:33333/logs")!
Expand Down
1 change: 0 additions & 1 deletion Tests/EventsExporter/Logs/LogsExporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class LogsExporterTests: XCTestCase {
environment: "environment",
hostname: "hostname",
apiKey: "apikey",
applicationKey: "applicationkey",
endpoint: Endpoint.custom(
testsURL: URL(string: "http://localhost:33333/traces")!,
logsURL: URL(string: "http://localhost:33333/logs")!
Expand Down
1 change: 0 additions & 1 deletion Tests/EventsExporter/Spans/SpansExporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SpansExporterTests: XCTestCase {
environment: "environment",
hostname: nil,
apiKey: "apikey",
applicationKey: "applicationkey",
endpoint: Endpoint.custom(
testsURL: URL(string: "http://localhost:33333/traces")!,
logsURL: URL(string: "http://localhost:33333/logs")!
Expand Down
Loading