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

RUM-1836 feat(otel-tracer) integrate OpenTelemetrySwiftApi in package managers #1668

Merged
merged 1 commit into from
Feb 15, 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
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
github "microsoft/plcrashreporter" ~> 1.11.1
binary "https://raw.githubusercontent.com/DataDog/opentelemetry-swift-packages/ganeshnj/ci/pod-push/OpenTelemetryApi.json" ~> 1.9.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be changed to main branch once we have the changes merged.

1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
binary "https://raw.githubusercontent.com/DataDog/opentelemetry-swift-packages/ganeshnj/ci/pod-push/OpenTelemetryApi.json" "1.9.1"
github "microsoft/plcrashreporter" "1.11.1"
44 changes: 6 additions & 38 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
3C5D636A2B55512B00FEB4BA /* OTelTraceState+Datadog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5D63682B55512B00FEB4BA /* OTelTraceState+Datadog.swift */; };
3C5D636C2B55513500FEB4BA /* OTelTraceState+DatadogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5D636B2B55513500FEB4BA /* OTelTraceState+DatadogTests.swift */; };
3C5D636D2B55513500FEB4BA /* OTelTraceState+DatadogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5D636B2B55513500FEB4BA /* OTelTraceState+DatadogTests.swift */; };
3C6C7FDB2B45738C006F5CBC /* OpenTelemetryApi in Frameworks */ = {isa = PBXBuildFile; productRef = 3C6C7FDA2B45738C006F5CBC /* OpenTelemetryApi */; };
3C6C7FDD2B457392006F5CBC /* OpenTelemetryApi in Frameworks */ = {isa = PBXBuildFile; productRef = 3C6C7FDC2B457392006F5CBC /* OpenTelemetryApi */; };
3C5D691F2B76825500C4E07E /* OpenTelemetryApi.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1F88222B767CE200821579 /* OpenTelemetryApi.xcframework */; };
3C5D69222B76826000C4E07E /* OpenTelemetryApi.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1F88222B767CE200821579 /* OpenTelemetryApi.xcframework */; };
3C6C7FE72B459AAA006F5CBC /* OTelSpan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C6C7FE02B459AAA006F5CBC /* OTelSpan.swift */; };
3C6C7FE82B459AAA006F5CBC /* OTelSpan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C6C7FE02B459AAA006F5CBC /* OTelSpan.swift */; };
3C6C7FE92B459AAA006F5CBC /* OTelSpanBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C6C7FE12B459AAA006F5CBC /* OTelSpanBuilder.swift */; };
Expand Down Expand Up @@ -1892,11 +1892,9 @@
3C0D5DEE2A5442A900446CF9 /* EventMocks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventMocks.swift; sourceTree = "<group>"; };
3C0D5DF42A5443B100446CF9 /* DataFormatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataFormatTests.swift; sourceTree = "<group>"; };
3C1890132ABDE99200CE9E73 /* DDURLSessionInstrumentationTests+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDURLSessionInstrumentationTests+apiTests.m"; sourceTree = "<group>"; };
3C2206F22AB9CE9300DE780C /* MetaTypeExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetaTypeExtensions.swift; sourceTree = "<group>"; };
3C1F88222B767CE200821579 /* OpenTelemetryApi.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = OpenTelemetryApi.xcframework; path = ../Carthage/Build/OpenTelemetryApi.xcframework; sourceTree = "<group>"; };
3C32359C2B55386C000B4258 /* OTelSpanLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTelSpanLink.swift; sourceTree = "<group>"; };
3C32359F2B55387A000B4258 /* OTelSpanLinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTelSpanLinkTests.swift; sourceTree = "<group>"; };
3C394EF62AA5F49F008F48BA /* URLSessionDataDelegateSwizzler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionDataDelegateSwizzler.swift; sourceTree = "<group>"; };
3C394EF92AA5F4C8008F48BA /* URLSessionDataDelegateSwizzlerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionDataDelegateSwizzlerTests.swift; sourceTree = "<group>"; };
3C5D63682B55512B00FEB4BA /* OTelTraceState+Datadog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OTelTraceState+Datadog.swift"; sourceTree = "<group>"; };
3C5D636B2B55513500FEB4BA /* OTelTraceState+DatadogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OTelTraceState+DatadogTests.swift"; sourceTree = "<group>"; };
3C6C7FE02B459AAA006F5CBC /* OTelSpan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTelSpan.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2957,8 +2955,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3C5D691F2B76825500C4E07E /* OpenTelemetryApi.xcframework in Frameworks */,
D2C1A50E29C4C4EF00946C31 /* DatadogInternal.framework in Frameworks */,
3C6C7FDB2B45738C006F5CBC /* OpenTelemetryApi in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -3001,8 +2999,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3C5D69222B76826000C4E07E /* OpenTelemetryApi.xcframework in Frameworks */,
D2C1A57429C4F30000946C31 /* DatadogInternal.framework in Frameworks */,
3C6C7FDD2B457392006F5CBC /* OpenTelemetryApi in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4087,6 +4085,7 @@
61133C6F2423993200786299 /* Frameworks */ = {
isa = PBXGroup;
children = (
3C1F88222B767CE200821579 /* OpenTelemetryApi.xcframework */,
D2579591298ABCED008A1BE5 /* XCTest.framework */,
D2579593298ABCF5008A1BE5 /* XCTest.framework */,
61B03ECC274FF00E00EB1AE1 /* SwiftUI.framework */,
Expand Down Expand Up @@ -6444,7 +6443,6 @@
);
name = "DatadogTrace iOS";
packageProductDependencies = (
3C6C7FDA2B45738C006F5CBC /* OpenTelemetryApi */,
);
productName = DatadogTrace;
productReference = D25EE93429C4C3C300CE3839 /* DatadogTrace.framework */;
Expand Down Expand Up @@ -6539,7 +6537,6 @@
);
name = "DatadogTrace tvOS";
packageProductDependencies = (
3C6C7FDC2B457392006F5CBC /* OpenTelemetryApi */,
);
productName = DatadogTrace;
productReference = D2C1A55A29C4F2DF00946C31 /* DatadogTrace.framework */;
Expand Down Expand Up @@ -6818,7 +6815,6 @@
);
mainGroup = 61133B78242393DE00786299;
packageReferences = (
3C6C7FD92B457381006F5CBC /* XCRemoteSwiftPackageReference "opentelemetry-swift" */,
);
productRefGroup = 61133B83242393DE00786299 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -12954,34 +12950,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
3C6C7FD92B457381006F5CBC /* XCRemoteSwiftPackageReference "opentelemetry-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/open-telemetry/opentelemetry-swift.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.9.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3C6C7FDA2B45738C006F5CBC /* OpenTelemetryApi */ = {
isa = XCSwiftPackageProductDependency;
package = 3C6C7FD92B457381006F5CBC /* XCRemoteSwiftPackageReference "opentelemetry-swift" */;
productName = OpenTelemetryApi;
};
3C6C7FDC2B457392006F5CBC /* OpenTelemetryApi */ = {
isa = XCSwiftPackageProductDependency;
package = 3C6C7FD92B457381006F5CBC /* XCRemoteSwiftPackageReference "opentelemetry-swift" */;
productName = OpenTelemetryApi;
};
6152C83D24BE1C91006A1679 /* HTTPServerMock */ = {
isa = XCSwiftPackageProductDependency;
productName = HTTPServerMock;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 61133B79242393DE00786299 /* Project object */;
}
8 changes: 4 additions & 4 deletions DatadogTrace.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Pod::Spec.new do |s|
s.name = "DatadogTrace"
s.version = "2.7.0"
s.summary = "Datadog Trace Module."

s.homepage = "https://www.datadoghq.com"
s.social_media_url = "https://twitter.com/datadoghq"

s.license = { :type => "Apache", :file => 'LICENSE' }
s.authors = {
s.authors = {
"Maciek Grzybowski" => "maciek.grzybowski@datadoghq.com",
"Maciej Burda" => "maciej.burda@datadoghq.com",
"Maxime Epain" => "maxime.epain@datadoghq.com",
Expand All @@ -19,9 +19,9 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '11.0'

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

s.source_files = ["DatadogTrace/Sources/**/*.swift"]

s.dependency 'DatadogInternal', s.version.to_s

s.dependency 'OpenTelemetrySwiftApi', '1.9.1'
end
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ extension Dictionary where Key == String, Value == OpenTelemetryApi.AttributeVal
tags["\(key).\(nestedKey)"] = nestedValue
}
}
@unknown default:
break
}
}
return tags
Expand Down
4 changes: 4 additions & 0 deletions DatadogTrace/Sources/OpenTelemetry/OTelSpan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ internal extension OpenTelemetryApi.Status {
return 2
case .unset:
return 1
@unknown default:
return 1
}
}
}
Expand Down Expand Up @@ -202,6 +204,8 @@ internal class OTelSpan: OpenTelemetryApi.Span {
// send error log to Datadog
// Empty kind or description is equivalent to not present
ddSpan.setError(kind: "", message: description)
@unknown default:
break
}

// SpanKind maps to the `span.kind` tag in Datadog
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ all: dependencies templates

# The release version of `dd-sdk-swift-testing` to use for tests instrumentation.
DD_SDK_SWIFT_TESTING_VERSION = 2.3.2
DD_DISABLE_TEST_INSTRUMENTING = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to disable for the moment

backlog RUM-3185

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth having a code comment with ticket reference as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion/ The RUM-3185 gives enough context on why we disable it 👍. Let's include that JIRA in the PR description, so it is clear why we had to turn it off.


define DD_SDK_TESTING_XCCONFIG_CI
DD_SDK_TESTING_PATH=$$(DD_SDK_TESTING_OVERRIDE_PATH:default=$$(SRCROOT)/../instrumented-tests/)\n
Expand Down Expand Up @@ -42,7 +43,7 @@ define DD_SDK_BASE_XCCONFIG_CI
SWIFT_TREAT_WARNINGS_AS_ERRORS = YES\n
\n
// If running on CI. This value is injected to some targets through their `Info.plist`:\n
IS_CI = true\n
IS_CI = true\n
\n
// Use iOS 11 deployment target on CI as long as we use Xcode 14.x for integration\n
IPHONEOS_DEPLOYMENT_TARGET=11.0\n
Expand Down Expand Up @@ -70,15 +71,15 @@ ifeq (${ci}, true)
@echo $$DD_SDK_BASE_XCCONFIG_CI >> xcconfigs/Base.local.xcconfig;
@echo $$DD_SDK_DATADOG_XCCONFIG_CI > xcconfigs/Datadog.local.xcconfig;
ifndef DD_DISABLE_TEST_INSTRUMENTING
@echo $$DD_SDK_TESTING_XCCONFIG_CI > xcconfigs/DatadogSDKTesting.local.xcconfig;
@echo $$DD_SDK_TESTING_XCCONFIG_CI > xcconfigs/DatadogSDKTesting.local.xcconfig;
@rm -rf instrumented-tests/DatadogSDKTesting.xcframework
@rm -rf instrumented-tests/DatadogSDKTesting.zip
@rm -rf instrumented-tests/LICENSE
@gh release download ${DD_SDK_SWIFT_TESTING_VERSION} -D instrumented-tests -R https://github.com/DataDog/dd-sdk-swift-testing -p "DatadogSDKTesting.zip"
@unzip -q instrumented-tests/DatadogSDKTesting.zip -d instrumented-tests
@[ -e "instrumented-tests/DatadogSDKTesting.xcframework" ] && echo "DatadogSDKTesting.xcframework - OK" || { echo "DatadogSDKTesting.xcframework - missing"; exit 1; }
endif

endif

# Prepare project on GitLab CI (this will replace `make dependencies` once we're fully on GitLab).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
3C0F8E222B768A05004948CD /* OpenTelemetryApi.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */; };
3C0F8E232B768A05004948CD /* OpenTelemetryApi.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3C0F8E242B768A17004948CD /* OpenTelemetryApi.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */; };
3C0F8E252B768A17004948CD /* OpenTelemetryApi.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3CB135E729F6B90F0000234F /* DatadogWebViewTracking.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CB135E429F6B8F90000234F /* DatadogWebViewTracking.xcframework */; };
3CB135E829F6B90F0000234F /* DatadogWebViewTracking.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3CB135E429F6B8F90000234F /* DatadogWebViewTracking.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
617803D22A6FF2EA005FE258 /* DatadogSessionReplay.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 617803D12A6FF2EA005FE258 /* DatadogSessionReplay.xcframework */; };
Expand Down Expand Up @@ -101,6 +105,7 @@
9E9D5E8D25F90FC6002F12A0 /* DatadogCore.xcframework in Embed Frameworks */,
D20D6FEB29F6C2F200D2886E /* DatadogRUM.xcframework in Embed Frameworks */,
D2675BF42A019CF500190669 /* DatadogCrashReporting.xcframework in Embed Frameworks */,
3C0F8E232B768A05004948CD /* OpenTelemetryApi.xcframework in Embed Frameworks */,
9E9D5E8B25F90FC6002F12A0 /* DatadogObjc.xcframework in Embed Frameworks */,
D26F741929ACC61E00D25622 /* DatadogLogs.xcframework in Embed Frameworks */,
);
Expand All @@ -114,6 +119,7 @@
dstSubfolderSpec = 10;
files = (
D290BA2627CD09740019936D /* CrashReporter.xcframework in Embed Frameworks */,
3C0F8E252B768A17004948CD /* OpenTelemetryApi.xcframework in Embed Frameworks */,
D20D6FE729F6C2EB00D2886E /* DatadogRUM.xcframework in Embed Frameworks */,
D20D6FE929F6C2ED00D2886E /* DatadogTrace.xcframework in Embed Frameworks */,
D2675BFA2A019D0100190669 /* DatadogInternal.xcframework in Embed Frameworks */,
Expand All @@ -128,6 +134,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = OpenTelemetryApi.xcframework; path = Carthage/Build/OpenTelemetryApi.xcframework; sourceTree = "<group>"; };
3CB135E429F6B8F90000234F /* DatadogWebViewTracking.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = DatadogWebViewTracking.xcframework; path = Carthage/Build/DatadogWebViewTracking.xcframework; sourceTree = "<group>"; };
615519322461CDB4002A85CF /* Datadog.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Datadog.xcconfig; sourceTree = "<group>"; };
615519332461CDB4002A85CF /* Datadog.local.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Datadog.local.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -169,6 +176,7 @@
D20D6FEA29F6C2F200D2886E /* DatadogRUM.xcframework in Frameworks */,
3CB135E729F6B90F0000234F /* DatadogWebViewTracking.xcframework in Frameworks */,
9E9D5E8C25F90FC6002F12A0 /* DatadogCore.xcframework in Frameworks */,
3C0F8E222B768A05004948CD /* OpenTelemetryApi.xcframework in Frameworks */,
D2675BF32A019CF500190669 /* DatadogCrashReporting.xcframework in Frameworks */,
9E9D5E8A25F90FC6002F12A0 /* DatadogObjc.xcframework in Frameworks */,
);
Expand All @@ -193,6 +201,7 @@
buildActionMask = 2147483647;
files = (
D2B946AE29ACF6C20080CB40 /* DatadogLogs.xcframework in Frameworks */,
3C0F8E242B768A17004948CD /* OpenTelemetryApi.xcframework in Frameworks */,
D20D6FE829F6C2ED00D2886E /* DatadogTrace.xcframework in Frameworks */,
D2675BF92A019D0100190669 /* DatadogInternal.xcframework in Frameworks */,
D290BA1F27CD09740019936D /* CrashReporter.xcframework in Frameworks */,
Expand Down Expand Up @@ -287,6 +296,7 @@
61C364492437547A00C4D4E6 /* Frameworks */ = {
isa = PBXGroup;
children = (
3C0F8E212B768A05004948CD /* OpenTelemetryApi.xcframework */,
617803D12A6FF2EA005FE258 /* DatadogSessionReplay.xcframework */,
D20D6FE329F6C2D600D2886E /* DatadogRUM.xcframework */,
D2966C2329CA1C5300FC6B3C /* DatadogTrace.xcframework */,
Expand Down
1 change: 1 addition & 0 deletions dependency-manager-tests/carthage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ test:
@[ -e "Carthage/Build/DatadogCrashReporting.xcframework" ] && echo "DatadogCrashReporting.xcframework - OK" || { echo "DatadogCrashReporting.xcframework - missing"; false; }
@[ -e "Carthage/Build/CrashReporter.xcframework" ] && echo "CrashReporter.xcframework - OK" || { echo "CrashReporter.xcframework - missing"; false; }
@[ -e "Carthage/Build/DatadogWebViewTracking.xcframework" ] && echo "DatadogWebViewTracking.xcframework - OK" || { echo "DatadogWebViewTracking.xcframework - missing"; false; }
@[ -e "Carthage/Build/OpenTelemetryApi.xcframework" ] && echo "OpenTelemetryApi.xcframework - OK" || { echo "OpenTelemetryApi.xcframework - missing"; false; }
@echo "🧪 SUCCEEDED"
Loading