diff --git a/.gitignore b/.gitignore index 3ef5127..4258574 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,6 @@ playground.xcworkspace # Package.pins # Package.resolved .build/ -*.xcodeproj/ # CocoaPods # @@ -69,4 +68,6 @@ fastlane/screenshots/**/*.png fastlane/test_output .DS_Store -OpenTracing.xcodeproj/ \ No newline at end of file + +# Exclude SPM-generated project +./OpenTracing.xcodeproj/ diff --git a/OpenTracing/OpenTracing.xcodeproj/project.pbxproj b/OpenTracing/OpenTracing.xcodeproj/project.pbxproj new file mode 100644 index 0000000..df3aabf --- /dev/null +++ b/OpenTracing/OpenTracing.xcodeproj/project.pbxproj @@ -0,0 +1,371 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 61BA34DF2424F0D000587A96 /* OpenTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 61BA34DD2424F0D000587A96 /* OpenTracing.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 61BA34ED2424F16C00587A96 /* Format.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34E62424F16C00587A96 /* Format.swift */; }; + 61BA34EE2424F16C00587A96 /* Global.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34E72424F16C00587A96 /* Global.swift */; }; + 61BA34EF2424F16C00587A96 /* Reference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34E82424F16C00587A96 /* Reference.swift */; }; + 61BA34F02424F16C00587A96 /* NoopTracer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34E92424F16C00587A96 /* NoopTracer.swift */; }; + 61BA34F12424F16C00587A96 /* Span.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34EA2424F16C00587A96 /* Span.swift */; }; + 61BA34F22424F16C00587A96 /* SpanContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34EB2424F16C00587A96 /* SpanContext.swift */; }; + 61BA34F32424F16C00587A96 /* Tracer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BA34EC2424F16C00587A96 /* Tracer.swift */; }; + 61F1A61D2499108100075390 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61F1A61C2499108100075390 /* Constants.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 61BA34DA2424F0D000587A96 /* OpenTracing.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OpenTracing.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 61BA34DD2424F0D000587A96 /* OpenTracing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenTracing.h; sourceTree = ""; }; + 61BA34DE2424F0D000587A96 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 61BA34E62424F16C00587A96 /* Format.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Format.swift; sourceTree = ""; }; + 61BA34E72424F16C00587A96 /* Global.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Global.swift; sourceTree = ""; }; + 61BA34E82424F16C00587A96 /* Reference.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reference.swift; sourceTree = ""; }; + 61BA34E92424F16C00587A96 /* NoopTracer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoopTracer.swift; sourceTree = ""; }; + 61BA34EA2424F16C00587A96 /* Span.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Span.swift; sourceTree = ""; }; + 61BA34EB2424F16C00587A96 /* SpanContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpanContext.swift; sourceTree = ""; }; + 61BA34EC2424F16C00587A96 /* Tracer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tracer.swift; sourceTree = ""; }; + 61F1A61C2499108100075390 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 61BA34D72424F0D000587A96 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 61BA34D02424F0D000587A96 = { + isa = PBXGroup; + children = ( + 61BA34DC2424F0D000587A96 /* OpenTracing */, + 61BA34DB2424F0D000587A96 /* Products */, + ); + sourceTree = ""; + }; + 61BA34DB2424F0D000587A96 /* Products */ = { + isa = PBXGroup; + children = ( + 61BA34DA2424F0D000587A96 /* OpenTracing.framework */, + ); + name = Products; + sourceTree = ""; + }; + 61BA34DC2424F0D000587A96 /* OpenTracing */ = { + isa = PBXGroup; + children = ( + 61BA34E52424F16C00587A96 /* OpenTracing */, + 61BA34DD2424F0D000587A96 /* OpenTracing.h */, + 61BA34DE2424F0D000587A96 /* Info.plist */, + ); + path = OpenTracing; + sourceTree = ""; + }; + 61BA34E52424F16C00587A96 /* OpenTracing */ = { + isa = PBXGroup; + children = ( + 61BA34E62424F16C00587A96 /* Format.swift */, + 61BA34E72424F16C00587A96 /* Global.swift */, + 61BA34E82424F16C00587A96 /* Reference.swift */, + 61BA34E92424F16C00587A96 /* NoopTracer.swift */, + 61BA34EA2424F16C00587A96 /* Span.swift */, + 61BA34EB2424F16C00587A96 /* SpanContext.swift */, + 61BA34EC2424F16C00587A96 /* Tracer.swift */, + 61F1A61C2499108100075390 /* Constants.swift */, + ); + name = OpenTracing; + path = ../../Sources/OpenTracing; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 61BA34D52424F0D000587A96 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 61BA34DF2424F0D000587A96 /* OpenTracing.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 61BA34D92424F0D000587A96 /* OpenTracing */ = { + isa = PBXNativeTarget; + buildConfigurationList = 61BA34E22424F0D000587A96 /* Build configuration list for PBXNativeTarget "OpenTracing" */; + buildPhases = ( + 61BA34D52424F0D000587A96 /* Headers */, + 61BA34D62424F0D000587A96 /* Sources */, + 61BA34D72424F0D000587A96 /* Frameworks */, + 61BA34D82424F0D000587A96 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OpenTracing; + productName = OpenTracing; + productReference = 61BA34DA2424F0D000587A96 /* OpenTracing.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 61BA34D12424F0D000587A96 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = Datadog; + TargetAttributes = { + 61BA34D92424F0D000587A96 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 61BA34D42424F0D000587A96 /* Build configuration list for PBXProject "OpenTracing" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 61BA34D02424F0D000587A96; + productRefGroup = 61BA34DB2424F0D000587A96 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 61BA34D92424F0D000587A96 /* OpenTracing */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 61BA34D82424F0D000587A96 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 61BA34D62424F0D000587A96 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 61BA34F02424F16C00587A96 /* NoopTracer.swift in Sources */, + 61BA34EF2424F16C00587A96 /* Reference.swift in Sources */, + 61BA34F32424F16C00587A96 /* Tracer.swift in Sources */, + 61BA34EE2424F16C00587A96 /* Global.swift in Sources */, + 61BA34F12424F16C00587A96 /* Span.swift in Sources */, + 61BA34ED2424F16C00587A96 /* Format.swift in Sources */, + 61BA34F22424F16C00587A96 /* SpanContext.swift in Sources */, + 61F1A61D2499108100075390 /* Constants.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 61BA34E02424F0D000587A96 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 61BA34E12424F0D000587A96 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 61BA34E32424F0D000587A96 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = OpenTracing/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.datadogqh.OpenTracing; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 61BA34E42424F0D000587A96 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = OpenTracing/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.datadogqh.OpenTracing; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 61BA34D42424F0D000587A96 /* Build configuration list for PBXProject "OpenTracing" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 61BA34E02424F0D000587A96 /* Debug */, + 61BA34E12424F0D000587A96 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 61BA34E22424F0D000587A96 /* Build configuration list for PBXNativeTarget "OpenTracing" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 61BA34E32424F0D000587A96 /* Debug */, + 61BA34E42424F0D000587A96 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 61BA34D12424F0D000587A96 /* Project object */; +} diff --git a/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..b2a33f2 --- /dev/null +++ b/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/OpenTracing/OpenTracing.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/OpenTracing/OpenTracing.xcodeproj/xcshareddata/xcschemes/OpenTracing.xcscheme b/OpenTracing/OpenTracing.xcodeproj/xcshareddata/xcschemes/OpenTracing.xcscheme new file mode 100644 index 0000000..80efb41 --- /dev/null +++ b/OpenTracing/OpenTracing.xcodeproj/xcshareddata/xcschemes/OpenTracing.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenTracing/OpenTracing/Info.plist b/OpenTracing/OpenTracing/Info.plist new file mode 100644 index 0000000..9bcb244 --- /dev/null +++ b/OpenTracing/OpenTracing/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/OpenTracing/OpenTracing/OpenTracing.h b/OpenTracing/OpenTracing/OpenTracing.h new file mode 100644 index 0000000..9f73d6d --- /dev/null +++ b/OpenTracing/OpenTracing/OpenTracing.h @@ -0,0 +1,11 @@ +#import + +//! Project version number for OpenTracing. +FOUNDATION_EXPORT double OpenTracingVersionNumber; + +//! Project version string for OpenTracing. +FOUNDATION_EXPORT const unsigned char OpenTracingVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/Package.swift b/Package.swift index 4c9b7d1..e6c49b9 100644 --- a/Package.swift +++ b/Package.swift @@ -1,9 +1,12 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.1 import PackageDescription let package = Package( name: "OpenTracing", + platforms: [ + .iOS(.v11), + ], products: [ .library( name: "OpenTracing", diff --git a/Sources/OpenTracing/Constants.swift b/Sources/OpenTracing/Constants.swift new file mode 100644 index 0000000..01e37b4 --- /dev/null +++ b/Sources/OpenTracing/Constants.swift @@ -0,0 +1,83 @@ +import Foundation + +/// A collection of standard `Span` tag keys defined by Open Tracing. +/// Use them as the `key` in `span.setTag(key:value:)`. Use the expected type for the `value`. +/// +/// See more: [Span tags table](https://github.com/opentracing/specification/blob/master/semantic_conventions.md#span-tags-table) +/// +public struct OTTags { + + /// Expected value: `String`. + public static let component = "component" + + /// Expected value: `String` + public static let dbInstance = "db.instance" + + /// Expected value: `String` + public static let dbStatement = "db.statement" + + /// Expected value: `String` + public static let dbType = "db.type" + + /// Expected value: `String` + public static let dbUser = "db.user" + + /// Expected value: `Bool` + public static let error = "error" + + /// Expected value: `String` + public static let httpMethod = "http.method" + + /// Expected value: `Int` + public static let httpStatusCode = "http.status_code" + + /// Expected value: `String` + public static let httpUrl = "http.url" + + /// Expected value: `String` + public static let messageBusDestination = "message_bus.destination" + + /// Expected value: `String` + public static let peerAddress = "peer.address" + + /// Expected value: `String` + public static let peerHostname = "peer.hostname" + + /// Expected value: `String` + public static let peerIPv4 = "peer.ipv4" + + /// Expected value: `String` + public static let peerIPv6 = "peer.ipv6" + + /// Expected value: `Int` + public static let peerPort = "peer.port" + + /// Expected value: `String` + public static let peerService = "peer.service" + + /// Expected value: `Int` + public static let samplingPriority = "sampling.priority" + + /// Expected value: `String` + public static let spanKind = "span.kind" +} + +/// A collection of standard `Span` log fields defined by Open Tracing. +/// Use them as the `key` for `fields` dictionary in `span.log(fields:)`. Use the expected type for the value. +/// +/// See more: [Log fields table](https://github.com/opentracing/specification/blob/master/semantic_conventions.md#log-fields-table) +/// +public struct OTLogFields { + + /// Expected value: `String` + public static let errorKind = "error.kind" + + /// Expected value: `String` + public static let event = "event" + + /// Expected value: `String` + public static let message = "message" + + /// Expected value: `String` + public static let stack = "stack" +} diff --git a/Sources/OpenTracing/Tracer.swift b/Sources/OpenTracing/Tracer.swift index 3a5247b..2579bd8 100644 --- a/Sources/OpenTracing/Tracer.swift +++ b/Sources/OpenTracing/Tracer.swift @@ -65,7 +65,7 @@ public extension Tracer { /// - parameter startTime: an explicitly specified start timestamp for the OTSpan, or nil to use the /// current walltime /// - returns: a valid Span instance; it is the caller's responsibility to call finish() - func startSpan(operationName: String, childOf parent: SpanContext?, tags: [String: Codable]? = nil, + func startSpan(operationName: String, childOf parent: SpanContext? = nil, tags: [String: Codable]? = nil, startTime: Date? = nil) -> Span { let references = parent.map { [Reference.child(of: $0)] }