diff --git a/Examples/ConcurrencyContext/main.swift b/Examples/ConcurrencyContext/main.swift index 250a5588..e6332147 100644 --- a/Examples/ConcurrencyContext/main.swift +++ b/Examples/ConcurrencyContext/main.swift @@ -41,9 +41,9 @@ func childSpan() async throws { // SpanBuilder's `setActive` method is not available here, since it isn't compatible with structured concurrency based context management - try await tracer.spanBuilder(spanName: "parentSpan").setSpanKind(spanKind: .client).withActiveSpan { span in + try await tracer.spanBuilder(spanName: "parentSpan").setSpanKind(spanKind: .client).withActiveSpan { @Sendable span in span.setAttribute(key: sampleKey, value: sampleValue) - await Task.detached { + await Task.detached { @Sendable in // A detached task doesn't inherit the task local context, so this span won't have a parent. let notAChildSpan = tracer.spanBuilder(spanName: "notAChild").setSpanKind(spanKind: .client).startSpan() notAChildSpan.setAttribute(key: sampleKey, value: sampleValue) diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..a6e71f64 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "a179dbd657d649783fe42f91fef51d4c7e4017fd8c754612331b7ea30a4758cb", + "pins" : [ + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + } + ], + "version" : 3 +} diff --git a/Package.swift b/Package.swift index 3a7b6e59..07295627 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import Foundation @@ -51,7 +51,8 @@ let package = Package( .testTarget( name: "OpenTelemetryApiTests", dependencies: ["OpenTelemetryApi", "OpenTelemetryTestUtils"], - path: "Tests/OpenTelemetryApiTests" + path: "Tests/OpenTelemetryApiTests", + swiftSettings: [.unsafeFlags(["-Xfrontend", "-disable-availability-checking", "-strict-concurrency=minimal"])] ), .testTarget( name: "OpenTelemetrySdkTests", @@ -60,7 +61,8 @@ let package = Package( "OpenTelemetryConcurrency", "OpenTelemetryTestUtils", ], - path: "Tests/OpenTelemetrySdkTests" + path: "Tests/OpenTelemetrySdkTests", + swiftSettings: [.unsafeFlags(["-Xfrontend", "-disable-availability-checking"])] ), .executableTarget( name: "ConcurrencyContext", diff --git a/Scripts/semantic-convention/generate.sh b/Scripts/semantic-convention/generate.sh old mode 100644 new mode 100755 index c02e898d..1e0f1b2b --- a/Scripts/semantic-convention/generate.sh +++ b/Scripts/semantic-convention/generate.sh @@ -7,7 +7,7 @@ ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec & generator tools versions to make SemanticAttributes generation reproducible # repository: https://github.com/open-telemetry/semantic-conventions -SEMCONV_VERSION=1.37.0 +SEMCONV_VERSION=1.38.0 SPEC_VERSION=v$SEMCONV_VERSION # repository: https://github.com/open-telemetry/build-tools diff --git a/Scripts/semantic-convention/semantic-conventions b/Scripts/semantic-convention/semantic-conventions new file mode 160000 index 00000000..8e16df79 --- /dev/null +++ b/Scripts/semantic-convention/semantic-conventions @@ -0,0 +1 @@ +Subproject commit 8e16df7981f94b70ed1b9795c995094af995184f diff --git a/Scripts/semantic-convention/templates/registry/SemanticAttributes.swift.j2 b/Scripts/semantic-convention/templates/registry/SemanticAttributes.swift.j2 index 249105f2..7ea4fab5 100644 --- a/Scripts/semantic-convention/templates/registry/SemanticAttributes.swift.j2 +++ b/Scripts/semantic-convention/templates/registry/SemanticAttributes.swift.j2 @@ -115,7 +115,7 @@ extension SemanticConventions { {{attribute.brief | comment}} */ {% if attribute is enum %} - public struct {{class_name}}: CustomStringConvertible { + public struct {{class_name}}: CustomStringConvertible, Sendable { {% for member in attribute.type.members %} {% if member.brief is defined %} diff --git a/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManager.swift b/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManager.swift index fd208dc3..f5df2f0a 100644 --- a/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManager.swift +++ b/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManager.swift @@ -6,12 +6,12 @@ import Foundation /// No-op implementations of BaggageManager. -public class DefaultBaggageManager: BaggageManager { +public final class DefaultBaggageManager: BaggageManager, @unchecked Sendable { private init() {} /// Returns a BaggageManager singleton that is the default implementation for /// BaggageManager. - public static var instance = DefaultBaggageManager() + public static let instance = DefaultBaggageManager() public func baggageBuilder() -> BaggageBuilder { return DefaultBaggageBuilder() diff --git a/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManagerProvider.swift b/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManagerProvider.swift index 6f52ca7d..637add08 100644 --- a/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManagerProvider.swift +++ b/Sources/OpenTelemetryApi/Baggage/DefaultBaggageManagerProvider.swift @@ -6,8 +6,8 @@ import Foundation /// No-op implementations of BaggageManager. -public class DefaultBaggageManagerProvider: BaggageManagerProvider { - public static var instance = DefaultBaggageManagerProvider() +public final class DefaultBaggageManagerProvider: BaggageManagerProvider, @unchecked Sendable { + public static let instance = DefaultBaggageManagerProvider() public func create() -> BaggageManager { return DefaultBaggageManager.instance diff --git a/Sources/OpenTelemetryApi/Baggage/EmptyBaggage.swift b/Sources/OpenTelemetryApi/Baggage/EmptyBaggage.swift index 8b176954..bc8e971b 100644 --- a/Sources/OpenTelemetryApi/Baggage/EmptyBaggage.swift +++ b/Sources/OpenTelemetryApi/Baggage/EmptyBaggage.swift @@ -6,11 +6,11 @@ import Foundation /// An immutable implementation of the Baggage that does not contain any entries. -class EmptyBaggage: Baggage { +final class EmptyBaggage: Baggage, @unchecked Sendable { private init() {} /// Returns the single instance of the EmptyBaggage class. - static var instance = EmptyBaggage() + static let instance = EmptyBaggage() static func baggageBuilder() -> BaggageBuilder { return EmptyBaggageBuilder() diff --git a/Sources/OpenTelemetryApi/Baggage/EntryKey.swift b/Sources/OpenTelemetryApi/Baggage/EntryKey.swift index bef791c3..7087a905 100644 --- a/Sources/OpenTelemetryApi/Baggage/EntryKey.swift +++ b/Sources/OpenTelemetryApi/Baggage/EntryKey.swift @@ -10,7 +10,7 @@ import Foundation /// and contain only printable ASCII characters. /// EntryKeys are designed to be used as constants. Declaring each key as a constant /// prevents key names from being validated multiple times. -public struct EntryKey: Equatable, Comparable, Hashable { +public struct EntryKey: Equatable, Comparable, Hashable, Sendable { // RFC7230 token characters for valid keys private static let validKeyCharacters: CharacterSet = { var chars = CharacterSet() diff --git a/Sources/OpenTelemetryApi/Baggage/EntryValue.swift b/Sources/OpenTelemetryApi/Baggage/EntryValue.swift index f7573e7b..bda7d1ce 100644 --- a/Sources/OpenTelemetryApi/Baggage/EntryValue.swift +++ b/Sources/OpenTelemetryApi/Baggage/EntryValue.swift @@ -8,7 +8,7 @@ import Foundation /// A validated entry value. /// Validation ensures that the String has a maximum length of 255 and /// contains only printable ASCII characters. -public struct EntryValue: Equatable { +public struct EntryValue: Equatable, Sendable { /// The maximum length for a entry value. The value is 255. static let maxLength = 255 diff --git a/Sources/OpenTelemetryApi/Common/AttributeArray.swift b/Sources/OpenTelemetryApi/Common/AttributeArray.swift index b4e6b036..0cb329fc 100644 --- a/Sources/OpenTelemetryApi/Common/AttributeArray.swift +++ b/Sources/OpenTelemetryApi/Common/AttributeArray.swift @@ -5,9 +5,9 @@ import Foundation -open class AttributeArray: Hashable, Codable { +open class AttributeArray: Hashable, Codable, @unchecked Sendable { public private(set) var values: [AttributeValue] - public static var empty = AttributeArray() + public static let empty = AttributeArray() public var description: String { values.description } diff --git a/Sources/OpenTelemetryApi/Common/AttributeSet.swift b/Sources/OpenTelemetryApi/Common/AttributeSet.swift index d4536cc1..5c91160c 100644 --- a/Sources/OpenTelemetryApi/Common/AttributeSet.swift +++ b/Sources/OpenTelemetryApi/Common/AttributeSet.swift @@ -5,11 +5,11 @@ import Foundation -open class AttributeSet: Hashable, Codable { +open class AttributeSet: Hashable, Codable, @unchecked Sendable { public private(set) var labels: [String: AttributeValue] /// Empty LabelSet. - public static var empty = AttributeSet() + public static let empty = AttributeSet() private init() { labels = [String: AttributeValue]() diff --git a/Sources/OpenTelemetryApi/Common/AttributeValue.swift b/Sources/OpenTelemetryApi/Common/AttributeValue.swift index 032fb198..484b849e 100644 --- a/Sources/OpenTelemetryApi/Common/AttributeValue.swift +++ b/Sources/OpenTelemetryApi/Common/AttributeValue.swift @@ -6,7 +6,7 @@ import Foundation /// An enum that represents all the possible values for an attribute. -public enum AttributeValue: Equatable, CustomStringConvertible, Hashable { +public enum AttributeValue: Equatable, CustomStringConvertible, Hashable, Sendable { case string(String) case bool(Bool) case int(Int) diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Android_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Android_attributes.swift index 9086bafe..b557bdc3 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Android_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Android_attributes.swift @@ -40,7 +40,7 @@ extension SemanticConventions { /** This attribute represents the state of the application. */ - public struct AppStateValues: CustomStringConvertible { + public struct AppStateValues: CustomStringConvertible, Sendable { /// Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time. public static let created = AppStateValues("created") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/App_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/App_attributes.swift index 79981f6f..956838fd 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/App_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/App_attributes.swift @@ -123,6 +123,41 @@ extension SemanticConventions { */ case screenCoordinateY = "app.screen.coordinate.y" + /** + An identifier that uniquely differentiates this screen from other screens in the same application. + + - Examples: + ``` + attributes[SemanticConventions.App.screenId.rawValue] = "f9bc787d-ff05-48ad-90e1-fca1d46130b3" + attributes[SemanticConventions.App.screenId.rawValue] = "com.example.app.MainActivity" + attributes[SemanticConventions.App.screenId.rawValue] = "com.example.shop.ProductDetailFragment" + attributes[SemanticConventions.App.screenId.rawValue] = "MyApp.ProfileView" + attributes[SemanticConventions.App.screenId.rawValue] = "MyApp.ProfileViewController" + ``` + + - Note: A screen represents only the part of the device display drawn by the app. It typically contains multiple widgets or UI components and is larger in scope than individual widgets. Multiple screens can coexist on the same display simultaneously (e.g., split view on tablets). + + - Requires: Value type should be `String` + */ + case screenId = "app.screen.id" + + /** + The name of an application screen. + + - Examples: + ``` + attributes[SemanticConventions.App.screenName.rawValue] = "MainActivity" + attributes[SemanticConventions.App.screenName.rawValue] = "ProductDetailFragment" + attributes[SemanticConventions.App.screenName.rawValue] = "ProfileView" + attributes[SemanticConventions.App.screenName.rawValue] = "ProfileViewController" + ``` + + - Note: A screen represents only the part of the device display drawn by the app. It typically contains multiple widgets or UI components and is larger in scope than individual widgets. Multiple screens can coexist on the same display simultaneously (e.g., split view on tablets). + + - Requires: Value type should be `String` + */ + case screenName = "app.screen.name" + /** An identifier that uniquely differentiates this widget from other widgets in the same application. diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aspnetcore_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aspnetcore_attributes.swift index a5cbbb8b..88b1ee16 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aspnetcore_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aspnetcore_attributes.swift @@ -303,7 +303,7 @@ extension SemanticConventions { /** The result of the authentication operation. */ - public struct AuthenticationResultValues: CustomStringConvertible { + public struct AuthenticationResultValues: CustomStringConvertible, Sendable { /// Authentication was successful. public static let success = AuthenticationResultValues("success") @@ -328,7 +328,7 @@ extension SemanticConventions { /** The result of calling the authorization service. */ - public struct AuthorizationResultValues: CustomStringConvertible { + public struct AuthorizationResultValues: CustomStringConvertible, Sendable { /// Authorization was successful. public static let success = AuthorizationResultValues("success") @@ -350,7 +350,7 @@ extension SemanticConventions { /** ASP.NET Core exception middleware handling result. */ - public struct DiagnosticsExceptionResultValues: CustomStringConvertible { + public struct DiagnosticsExceptionResultValues: CustomStringConvertible, Sendable { /// Exception was handled by the exception handling middleware. public static let handled = DiagnosticsExceptionResultValues("handled") @@ -378,7 +378,7 @@ extension SemanticConventions { /** The result from checking the password. */ - public struct IdentityPasswordCheckResultValues: CustomStringConvertible { + public struct IdentityPasswordCheckResultValues: CustomStringConvertible, Sendable { /// Password check was successful. public static let success = IdentityPasswordCheckResultValues("success") @@ -409,7 +409,7 @@ extension SemanticConventions { /** The result of the identity operation. */ - public struct IdentityResultValues: CustomStringConvertible { + public struct IdentityResultValues: CustomStringConvertible, Sendable { /// Identity operation was successful. public static let success = IdentityResultValues("success") @@ -431,7 +431,7 @@ extension SemanticConventions { /** Whether the sign in result was success or failure. */ - public struct IdentitySignInResultValues: CustomStringConvertible { + public struct IdentitySignInResultValues: CustomStringConvertible, Sendable { /// Sign in was successful. public static let success = IdentitySignInResultValues("success") @@ -462,7 +462,7 @@ extension SemanticConventions { /** The authentication type. */ - public struct IdentitySignInTypeValues: CustomStringConvertible { + public struct IdentitySignInTypeValues: CustomStringConvertible, Sendable { /// Sign in with password. public static let password = IdentitySignInTypeValues("password") @@ -496,7 +496,7 @@ extension SemanticConventions { /** What the token will be used for. */ - public struct IdentityTokenPurposeValues: CustomStringConvertible { + public struct IdentityTokenPurposeValues: CustomStringConvertible, Sendable { /// The token is for resetting a user password. public static let resetPassword = IdentityTokenPurposeValues("reset_password") @@ -530,7 +530,7 @@ extension SemanticConventions { /** The result of token verification. */ - public struct IdentityTokenVerifiedValues: CustomStringConvertible { + public struct IdentityTokenVerifiedValues: CustomStringConvertible, Sendable { /// Token verification was successful. public static let success = IdentityTokenVerifiedValues("success") @@ -552,7 +552,7 @@ extension SemanticConventions { /** The user update type. */ - public struct IdentityUserUpdateTypeValues: CustomStringConvertible { + public struct IdentityUserUpdateTypeValues: CustomStringConvertible, Sendable { /// Identity user updated. public static let update = IdentityUserUpdateTypeValues("update") @@ -667,7 +667,7 @@ extension SemanticConventions { /** Rate-limiting result, shows whether the lease was acquired or contains a rejection reason */ - public struct RateLimitingResultValues: CustomStringConvertible { + public struct RateLimitingResultValues: CustomStringConvertible, Sendable { /// Lease was acquired public static let acquired = RateLimitingResultValues("acquired") @@ -695,7 +695,7 @@ extension SemanticConventions { /** Match result - success or failure */ - public struct RoutingMatchStatusValues: CustomStringConvertible { + public struct RoutingMatchStatusValues: CustomStringConvertible, Sendable { /// Match succeeded public static let success = RoutingMatchStatusValues("success") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aws_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aws_attributes.swift index 2d2df393..89766c18 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aws_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Aws_attributes.swift @@ -686,7 +686,7 @@ extension SemanticConventions { /** The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. */ - public struct EcsLaunchtypeValues: CustomStringConvertible { + public struct EcsLaunchtypeValues: CustomStringConvertible, Sendable { /// Amazon EC2 public static let ec2 = EcsLaunchtypeValues("ec2") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Azure_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Azure_attributes.swift index d1caf489..a42eddfe 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Azure_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Azure_attributes.swift @@ -54,7 +54,7 @@ extension SemanticConventions { attributes[SemanticConventions.Azure.cosmosdbOperationContactedRegions.rawValue] = ["North Central US", "Australia East", "Australia Southeast"] ``` - - Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location) + - Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/resources/subscriptions/list-locations) - Requires: Value type should be `[String]` */ @@ -122,7 +122,7 @@ extension SemanticConventions { /** Cosmos client connection mode. */ - public struct CosmosdbConnectionModeValues: CustomStringConvertible { + public struct CosmosdbConnectionModeValues: CustomStringConvertible, Sendable { /// Gateway (HTTP) connection. public static let gateway = CosmosdbConnectionModeValues("gateway") @@ -144,7 +144,7 @@ extension SemanticConventions { /** Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). */ - public struct CosmosdbConsistencyLevelValues: CustomStringConvertible { + public struct CosmosdbConsistencyLevelValues: CustomStringConvertible, Sendable { /// Strong public static let strong = CosmosdbConsistencyLevelValues("Strong") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cassandra_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cassandra_attributes.swift index 2e2a9b3b..e63a4a82 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cassandra_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cassandra_attributes.swift @@ -76,7 +76,7 @@ extension SemanticConventions { /** The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). */ - public struct ConsistencyLevelValues: CustomStringConvertible { + public struct ConsistencyLevelValues: CustomStringConvertible, Sendable { /// All public static let all = ConsistencyLevelValues("all") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cicd_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cicd_attributes.swift index 60e0f5a9..08c366d9 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cicd_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cicd_attributes.swift @@ -231,7 +231,7 @@ extension SemanticConventions { /** The kind of action a pipeline run is performing. */ - public struct PipelineActionNameValues: CustomStringConvertible { + public struct PipelineActionNameValues: CustomStringConvertible, Sendable { /// The pipeline run is executing a build. public static let build = PipelineActionNameValues("BUILD") @@ -256,7 +256,7 @@ extension SemanticConventions { /** The result of a pipeline run. */ - public struct PipelineResultValues: CustomStringConvertible { + public struct PipelineResultValues: CustomStringConvertible, Sendable { /// The pipeline run finished successfully. public static let success = PipelineResultValues("success") @@ -290,7 +290,7 @@ extension SemanticConventions { /** The pipeline run goes through these states during its lifecycle. */ - public struct PipelineRunStateValues: CustomStringConvertible { + public struct PipelineRunStateValues: CustomStringConvertible, Sendable { /// The run pending state spans from the event triggering the pipeline run until the execution of the run starts (eg. time spent in a queue, provisioning agents, creating run resources). public static let pending = PipelineRunStateValues("pending") @@ -315,7 +315,7 @@ extension SemanticConventions { /** The result of a task run. */ - public struct PipelineTaskRunResultValues: CustomStringConvertible { + public struct PipelineTaskRunResultValues: CustomStringConvertible, Sendable { /// The task run finished successfully. public static let success = PipelineTaskRunResultValues("success") @@ -349,7 +349,7 @@ extension SemanticConventions { /** The type of the task within a pipeline. */ - public struct PipelineTaskTypeValues: CustomStringConvertible { + public struct PipelineTaskTypeValues: CustomStringConvertible, Sendable { /// build public static let build = PipelineTaskTypeValues("build") @@ -374,7 +374,7 @@ extension SemanticConventions { /** The state of a CICD worker / agent. */ - public struct WorkerStateValues: CustomStringConvertible { + public struct WorkerStateValues: CustomStringConvertible, Sendable { /// The worker is not performing work for the CICD system. It is available to the CICD system to perform work on (online / idle). public static let available = WorkerStateValues("available") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cloud_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cloud_attributes.swift index 6fc529ce..6805fc46 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cloud_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cloud_attributes.swift @@ -103,7 +103,7 @@ extension SemanticConventions { /** The cloud platform in use. */ - public struct PlatformValues: CustomStringConvertible { + public struct PlatformValues: CustomStringConvertible, Sendable { /// Alibaba Cloud Elastic Compute Service public static let alibabaCloudEcs = PlatformValues("alibaba_cloud_ecs") @@ -209,7 +209,7 @@ extension SemanticConventions { /** Name of the cloud provider. */ - public struct ProviderValues: CustomStringConvertible { + public struct ProviderValues: CustomStringConvertible, Sendable { /// Alibaba Cloud public static let alibabaCloud = ProviderValues("alibaba_cloud") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Container_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Container_attributes.swift index cfd3e8b8..f4c774ec 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Container_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Container_attributes.swift @@ -96,7 +96,7 @@ extension SemanticConventions { attributes[SemanticConventions.Container.imageId.rawValue] = "sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f" ``` - - Note: Docker defines a sha256 of the image id; `container.image.id` corresponds to the `Image` field from the Docker container inspect [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) endpoint. + - Note: Docker defines a sha256 of the image id; `container.image.id` corresponds to the `Image` field from the Docker container inspect [API](https://docs.docker.com/reference/api/engine/version/v1.43/#tag/Container/operation/ContainerInspect) endpoint. K8s defines a link to the container registry repository with digest `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. The ID is assigned by the container runtime and can vary in different environments. Consider using `oci.manifest.digest` if it is important to identify the same image in different environments/runtimes. @@ -124,14 +124,14 @@ extension SemanticConventions { attributes[SemanticConventions.Container.imageRepoDigests.rawValue] = ["example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578"] ``` - - Note: [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) and [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) report those under the `RepoDigests` field. + - Note: [Docker](https://docs.docker.com/reference/api/engine/version/v1.43/#tag/Image/operation/ImageInspect) and [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) report those under the `RepoDigests` field. - Requires: Value type should be `[String]` */ case imageRepoDigests = "container.image.repo_digests" /** - Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `` section of the full name for example from `registry.example.com/my-org/my-image:`. + Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/reference/api/engine/version/v1.43/#tag/Image/operation/ImageInspect). Should be only the `` section of the full name for example from `registry.example.com/my-org/my-image:`. - Examples: ``` diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpu_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpu_attributes.swift index 56ee7fbc..d13fab38 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpu_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpu_attributes.swift @@ -38,7 +38,7 @@ extension SemanticConventions { /** The mode of the CPU */ - public struct ModeValues: CustomStringConvertible { + public struct ModeValues: CustomStringConvertible, Sendable { /// User public static let user = ModeValues("user") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpython_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpython_attributes.swift index 8ee627da..d97676ff 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpython_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Cpython_attributes.swift @@ -27,7 +27,7 @@ extension SemanticConventions { /** Value of the garbage collector collection generation. */ - public struct GcGenerationValues: CustomStringConvertible { + public struct GcGenerationValues: CustomStringConvertible, Sendable { /// Generation 0 public static let generation0 = GcGenerationValues(0) diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Db_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Db_attributes.swift index 6275898b..143ba9f0 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Db_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Db_attributes.swift @@ -153,14 +153,17 @@ extension SemanticConventions { `db.query.parameter.` SHOULD match up with the parameterized placeholders present in `db.query.text`. + It is RECOMMENDED to capture the value as provided by the application + without attempting to do any case normalization. + `db.query.parameter.` SHOULD NOT be captured on batch operations. Examples: - For a query `SELECT * FROM users where username = %s` with the parameter `"jdoe"`, the attribute `db.query.parameter.0` SHOULD be set to `"jdoe"`. - - For a query `"SELECT * FROM users WHERE username = %(username)s;` with parameter - `username = "jdoe"`, the attribute `db.query.parameter.username` SHOULD be set to `"jdoe"`. + - For a query `"SELECT * FROM users WHERE username = %(userName)s;` with parameter + `userName = "jdoe"`, the attribute `db.query.parameter.userName` SHOULD be set to `"jdoe"`. - Requires: Value type should be `template[string]` */ @@ -269,7 +272,7 @@ extension SemanticConventions { /** The state of a connection in the pool */ - public struct ClientConnectionStateValues: CustomStringConvertible { + public struct ClientConnectionStateValues: CustomStringConvertible, Sendable { public static let idle = ClientConnectionStateValues("idle") public static let used = ClientConnectionStateValues("used") @@ -287,7 +290,7 @@ extension SemanticConventions { /** The database management system (DBMS) product as identified by the client instrumentation. */ - public struct SystemNameValues: CustomStringConvertible { + public struct SystemNameValues: CustomStringConvertible, Sendable { /// Some other SQL database. Fallback only. public static let otherSql = SystemNameValues("other_sql") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Deployment_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Deployment_attributes.swift index 5246827b..df48624c 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Deployment_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Deployment_attributes.swift @@ -66,7 +66,7 @@ extension SemanticConventions { /** The status of the deployment. */ - public struct StatusValues: CustomStringConvertible { + public struct StatusValues: CustomStringConvertible, Sendable { /// failed public static let failed = StatusValues("failed") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Disk_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Disk_attributes.swift index e39874cb..86b2ea31 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Disk_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Disk_attributes.swift @@ -25,7 +25,7 @@ extension SemanticConventions { /** The disk IO operation direction. */ - public struct IoDirectionValues: CustomStringConvertible { + public struct IoDirectionValues: CustomStringConvertible, Sendable { public static let read = IoDirectionValues("read") public static let write = IoDirectionValues("write") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dns_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dns_attributes.swift index 712b7823..742daa42 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dns_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dns_attributes.swift @@ -31,7 +31,7 @@ extension SemanticConventions { attributes[SemanticConventions.Dns.questionName.rawValue] = "opentelemetry.io" ``` - - Note: If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n respectively. + - Note: The name represents the queried domain name as it appears in the DNS query without any additional normalization. - Requires: Value type should be `String` */ diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dotnet_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dotnet_attributes.swift index 87fa35d6..f23a9e40 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dotnet_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Dotnet_attributes.swift @@ -27,7 +27,7 @@ extension SemanticConventions { /** Name of the garbage collector managed heap generation. */ - public struct GcHeapGenerationValues: CustomStringConvertible { + public struct GcHeapGenerationValues: CustomStringConvertible, Sendable { /// Generation 0 public static let gen0 = GcHeapGenerationValues("gen0") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Error_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Error_attributes.swift index ebee1077..80a4dcd6 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Error_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Error_attributes.swift @@ -67,7 +67,7 @@ extension SemanticConventions { /** Describes a class of error the operation ended with. */ - public struct TypeValues: CustomStringConvertible { + public struct TypeValues: CustomStringConvertible, Sendable { /// A fallback error value to be used when the instrumentation doesn't define a custom value. public static let other = TypeValues("_OTHER") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Exception_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Exception_attributes.swift index 00bd254b..a951a81c 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Exception_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Exception_attributes.swift @@ -58,4 +58,4 @@ extension SemanticConventions { */ case type = "exception.type" } -} +} \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Faas_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Faas_attributes.swift index eb79093d..2dbc8047 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Faas_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Faas_attributes.swift @@ -216,7 +216,7 @@ extension SemanticConventions { - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions) (i.e., the function name plus the revision suffix). - **Google Cloud Functions:** The value of the - [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + [`K_REVISION` environment variable](https://cloud.google.com/run/docs/container-contract#services-env-vars). - **Azure Functions:** Not applicable. Do not set this attribute. - Requires: Value type should be `String` @@ -226,7 +226,7 @@ extension SemanticConventions { /** Describes the type of the operation that was performed on the data. */ - public struct DocumentOperationValues: CustomStringConvertible { + public struct DocumentOperationValues: CustomStringConvertible, Sendable { /// When a new object is created. public static let insert = DocumentOperationValues("insert") @@ -251,7 +251,7 @@ extension SemanticConventions { /** The cloud provider of the invoked function. */ - public struct InvokedProviderValues: CustomStringConvertible { + public struct InvokedProviderValues: CustomStringConvertible, Sendable { /// Alibaba Cloud public static let alibabaCloud = InvokedProviderValues("alibaba_cloud") @@ -282,7 +282,7 @@ extension SemanticConventions { /** Type of the trigger which caused this function invocation. */ - public struct TriggerValues: CustomStringConvertible { + public struct TriggerValues: CustomStringConvertible, Sendable { /// A response to some data source operation such as a database or filesystem read/write public static let datasource = TriggerValues("datasource") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/FeatureFlag_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/FeatureFlag_attributes.swift index ce95b489..828eaaeb 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/FeatureFlag_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/FeatureFlag_attributes.swift @@ -130,7 +130,7 @@ extension SemanticConventions { /** The reason code which shows how a feature flag value was determined. */ - public struct ResultReasonValues: CustomStringConvertible { + public struct ResultReasonValues: CustomStringConvertible, Sendable { /// The resolved value is static (no dynamic evaluation). public static let _static = ResultReasonValues("static") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Gcp_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Gcp_attributes.swift index 6bfa7b34..cbde08a3 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Gcp_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Gcp_attributes.swift @@ -106,6 +106,94 @@ extension SemanticConventions { */ case apphubWorkloadId = "gcp.apphub.workload.id" + /** + The container within GCP where the AppHub destination application is defined. + + - Examples: + ``` + attributes[SemanticConventions.Gcp.apphubDestinationApplicationContainer.rawValue] = "projects/my-container-project" + ``` + + - Requires: Value type should be `String` + */ + case apphubDestinationApplicationContainer = "gcp.apphub_destination.application.container" + + /** + The name of the destination application as configured in AppHub. + + - Examples: + ``` + attributes[SemanticConventions.Gcp.apphubDestinationApplicationId.rawValue] = "my-application" + ``` + + - Requires: Value type should be `String` + */ + case apphubDestinationApplicationId = "gcp.apphub_destination.application.id" + + /** + The GCP zone or region where the destination application is defined. + + - Examples: + ``` + attributes[SemanticConventions.Gcp.apphubDestinationApplicationLocation.rawValue] = "us-central1" + ``` + + - Requires: Value type should be `String` + */ + case apphubDestinationApplicationLocation = "gcp.apphub_destination.application.location" + + /** + Criticality of a destination workload indicates its importance to the business as specified in [AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type) + + - Requires: Value should be one of ``ApphubDestinationServiceCriticalityTypeValues`` (of type `String`) + */ + case apphubDestinationServiceCriticalityType = "gcp.apphub_destination.service.criticality_type" + + /** + Software lifecycle stage of a destination service as defined [AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1) + + - Requires: Value should be one of ``ApphubDestinationServiceEnvironmentTypeValues`` (of type `String`) + */ + case apphubDestinationServiceEnvironmentType = "gcp.apphub_destination.service.environment_type" + + /** + The name of the destination service as configured in AppHub. + + - Examples: + ``` + attributes[SemanticConventions.Gcp.apphubDestinationServiceId.rawValue] = "my-service" + ``` + + - Requires: Value type should be `String` + */ + case apphubDestinationServiceId = "gcp.apphub_destination.service.id" + + /** + Criticality of a destination workload indicates its importance to the business as specified in [AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type) + + - Requires: Value should be one of ``ApphubDestinationWorkloadCriticalityTypeValues`` (of type `String`) + */ + case apphubDestinationWorkloadCriticalityType = "gcp.apphub_destination.workload.criticality_type" + + /** + Environment of a destination workload is the stage of a software lifecycle as provided in the [AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1) + + - Requires: Value should be one of ``ApphubDestinationWorkloadEnvironmentTypeValues`` (of type `String`) + */ + case apphubDestinationWorkloadEnvironmentType = "gcp.apphub_destination.workload.environment_type" + + /** + The name of the destination workload as configured in AppHub. + + - Examples: + ``` + attributes[SemanticConventions.Gcp.apphubDestinationWorkloadId.rawValue] = "my-workload" + ``` + + - Requires: Value type should be `String` + */ + case apphubDestinationWorkloadId = "gcp.apphub_destination.workload.id" + /** Identifies the Google Cloud service for which the official client library is intended. @@ -179,7 +267,7 @@ extension SemanticConventions { /** Criticality of a service indicates its importance to the business. */ - public struct ApphubServiceCriticalityTypeValues: CustomStringConvertible { + public struct ApphubServiceCriticalityTypeValues: CustomStringConvertible, Sendable { /// Mission critical service. public static let missionCritical = ApphubServiceCriticalityTypeValues("MISSION_CRITICAL") @@ -207,7 +295,7 @@ extension SemanticConventions { /** Environment of a service is the stage of a software lifecycle. */ - public struct ApphubServiceEnvironmentTypeValues: CustomStringConvertible { + public struct ApphubServiceEnvironmentTypeValues: CustomStringConvertible, Sendable { /// Production environment. public static let production = ApphubServiceEnvironmentTypeValues("PRODUCTION") @@ -235,7 +323,7 @@ extension SemanticConventions { /** Criticality of a workload indicates its importance to the business. */ - public struct ApphubWorkloadCriticalityTypeValues: CustomStringConvertible { + public struct ApphubWorkloadCriticalityTypeValues: CustomStringConvertible, Sendable { /// Mission critical service. public static let missionCritical = ApphubWorkloadCriticalityTypeValues("MISSION_CRITICAL") @@ -263,7 +351,7 @@ extension SemanticConventions { /** Environment of a workload is the stage of a software lifecycle. */ - public struct ApphubWorkloadEnvironmentTypeValues: CustomStringConvertible { + public struct ApphubWorkloadEnvironmentTypeValues: CustomStringConvertible, Sendable { /// Production environment. public static let production = ApphubWorkloadEnvironmentTypeValues("PRODUCTION") @@ -287,5 +375,117 @@ extension SemanticConventions { return value } } + + /** + Criticality of a destination workload indicates its importance to the business as specified in [AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type) + */ + public struct ApphubDestinationServiceCriticalityTypeValues: CustomStringConvertible, Sendable { + + /// Mission critical service. + public static let missionCritical = ApphubDestinationServiceCriticalityTypeValues("MISSION_CRITICAL") + + /// High impact. + public static let high = ApphubDestinationServiceCriticalityTypeValues("HIGH") + + /// Medium impact. + public static let medium = ApphubDestinationServiceCriticalityTypeValues("MEDIUM") + + /// Low impact. + public static let low = ApphubDestinationServiceCriticalityTypeValues("LOW") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } + + /** + Software lifecycle stage of a destination service as defined [AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1) + */ + public struct ApphubDestinationServiceEnvironmentTypeValues: CustomStringConvertible, Sendable { + + /// Production environment. + public static let production = ApphubDestinationServiceEnvironmentTypeValues("PRODUCTION") + + /// Staging environment. + public static let staging = ApphubDestinationServiceEnvironmentTypeValues("STAGING") + + /// Test environment. + public static let test = ApphubDestinationServiceEnvironmentTypeValues("TEST") + + /// Development environment. + public static let development = ApphubDestinationServiceEnvironmentTypeValues("DEVELOPMENT") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } + + /** + Criticality of a destination workload indicates its importance to the business as specified in [AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type) + */ + public struct ApphubDestinationWorkloadCriticalityTypeValues: CustomStringConvertible, Sendable { + + /// Mission critical service. + public static let missionCritical = ApphubDestinationWorkloadCriticalityTypeValues("MISSION_CRITICAL") + + /// High impact. + public static let high = ApphubDestinationWorkloadCriticalityTypeValues("HIGH") + + /// Medium impact. + public static let medium = ApphubDestinationWorkloadCriticalityTypeValues("MEDIUM") + + /// Low impact. + public static let low = ApphubDestinationWorkloadCriticalityTypeValues("LOW") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } + + /** + Environment of a destination workload is the stage of a software lifecycle as provided in the [AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1) + */ + public struct ApphubDestinationWorkloadEnvironmentTypeValues: CustomStringConvertible, Sendable { + + /// Production environment. + public static let production = ApphubDestinationWorkloadEnvironmentTypeValues("PRODUCTION") + + /// Staging environment. + public static let staging = ApphubDestinationWorkloadEnvironmentTypeValues("STAGING") + + /// Test environment. + public static let test = ApphubDestinationWorkloadEnvironmentTypeValues("TEST") + + /// Development environment. + public static let development = ApphubDestinationWorkloadEnvironmentTypeValues("DEVELOPMENT") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } } } \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/GenAi_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/GenAi_attributes.swift index 4f278691..3105e75c 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/GenAi_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/GenAi_attributes.swift @@ -74,6 +74,75 @@ extension SemanticConventions { */ case dataSourceId = "gen_ai.data_source.id" + /** + The number of dimensions the resulting output embeddings should have. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.embeddingsDimensionCount.rawValue] = 512 + attributes[SemanticConventions.GenAi.embeddingsDimensionCount.rawValue] = 1024 + ``` + + - Requires: Value type should be `Int` + */ + case embeddingsDimensionCount = "gen_ai.embeddings.dimension.count" + + /** + A free-form explanation for the assigned score provided by the evaluator. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.evaluationExplanation.rawValue] = "The response is factually accurate but lacks sufficient detail to fully address the question." + ``` + + - Requires: Value type should be `String` + */ + case evaluationExplanation = "gen_ai.evaluation.explanation" + + /** + The name of the evaluation metric used for the GenAI response. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.evaluationName.rawValue] = "Relevance" + attributes[SemanticConventions.GenAi.evaluationName.rawValue] = "IntentResolution" + ``` + + - Requires: Value type should be `String` + */ + case evaluationName = "gen_ai.evaluation.name" + + /** + Human readable label for evaluation. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "relevant" + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "not_relevant" + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "correct" + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "incorrect" + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "pass" + attributes[SemanticConventions.GenAi.evaluationScoreLabel.rawValue] = "fail" + ``` + + - Note: This attribute provides a human-readable interpretation of the evaluation score produced by an evaluator. For example, a score value of 1 could mean "relevant" in one evaluation system and "not relevant" in another, depending on the scoring range and evaluator. The label SHOULD have low cardinality. Possible values depend on the evaluation metric and evaluator used; implementations SHOULD document the possible values. + + - Requires: Value type should be `String` + */ + case evaluationScoreLabel = "gen_ai.evaluation.score.label" + + /** + The evaluation score returned by the evaluator. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.evaluationScoreValue.rawValue] = 4.0 + ``` + + - Requires: Value type should be `Double` + */ + case evaluationScoreValue = "gen_ai.evaluation.score.value" + /** The chat history provided to the model as an input. @@ -456,6 +525,28 @@ extension SemanticConventions { */ case tokenType = "gen_ai.token.type" + /** + Parameters passed to the tool call. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.toolCallArguments.rawValue] = { + "location": "San Francisco?", + "date": "2025-10-01" + } + ``` + + - Note: > [!WARNING] + > This attribute may contain sensitive information. + + It's expected to be an object - in case a serialized string is available + to the instrumentation, the instrumentation SHOULD do the best effort to + deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise. + + - Requires: Value type should be `any` + */ + case toolCallArguments = "gen_ai.tool.call.arguments" + /** The tool call identifier. @@ -468,6 +559,79 @@ extension SemanticConventions { */ case toolCallId = "gen_ai.tool.call.id" + /** + The result returned by the tool call (if any and if execution was successful). + + - Examples: + ``` + attributes[SemanticConventions.GenAi.toolCallResult.rawValue] = { + "temperature_range": { + "high": 75, + "low": 60 + }, + "conditions": "sunny" + } + ``` + + - Note: > [!WARNING] + > This attribute may contain sensitive information. + + It's expected to be an object - in case a serialized string is available + to the instrumentation, the instrumentation SHOULD do the best effort to + deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise. + + - Requires: Value type should be `any` + */ + case toolCallResult = "gen_ai.tool.call.result" + + /** + The list of source system tool definitions available to the GenAI agent or model. + + - Examples: + ``` + attributes[SemanticConventions.GenAi.toolDefinitions.rawValue] = [ + { + "type": "function", + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": [ + "celsius", + "fahrenheit" + ] + } + }, + "required": [ + "location", + "unit" + ] + } + } + ] + ``` + + - Note: The value of this attribute matches source system tool definition format. + + It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available + to the instrumentation, the instrumentation SHOULD do the best effort to + deserialize it to an array. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise. + + Since this attribute could be large, it's NOT RECOMMENDED to populate + it by default. Instrumentations MAY provide a way to enable + populating this attribute. + + - Requires: Value type should be `any` + */ + case toolDefinitions = "gen_ai.tool.definitions" + /** The tool description. @@ -539,7 +703,7 @@ extension SemanticConventions { /** The name of the operation being performed. */ - public struct OperationNameValues: CustomStringConvertible { + public struct OperationNameValues: CustomStringConvertible, Sendable { /// Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat) public static let chat = OperationNameValues("chat") @@ -576,7 +740,7 @@ extension SemanticConventions { /** Represents the content type requested by the client. */ - public struct OutputTypeValues: CustomStringConvertible { + public struct OutputTypeValues: CustomStringConvertible, Sendable { /// Plain text public static let text = OutputTypeValues("text") @@ -604,7 +768,7 @@ extension SemanticConventions { /** The Generative AI provider as identified by the client or server instrumentation. */ - public struct ProviderNameValues: CustomStringConvertible { + public struct ProviderNameValues: CustomStringConvertible, Sendable { /// [OpenAI](https://openai.com/) public static let openai = ProviderNameValues("openai") @@ -665,7 +829,7 @@ extension SemanticConventions { /** The type of token being counted. */ - public struct TokenTypeValues: CustomStringConvertible { + public struct TokenTypeValues: CustomStringConvertible, Sendable { /// Input tokens (prompt, input, etc.) public static let input = TokenTypeValues("input") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Geo_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Geo_attributes.swift index 10315cc5..9fd9eef7 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Geo_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Geo_attributes.swift @@ -93,7 +93,7 @@ extension SemanticConventions { /** Two-letter code representing continent’s name. */ - public struct ContinentCodeValues: CustomStringConvertible { + public struct ContinentCodeValues: CustomStringConvertible, Sendable { /// Africa public static let af = ContinentCodeValues("AF") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Go_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Go_attributes.swift index e0063aac..af15f41f 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Go_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Go_attributes.swift @@ -26,7 +26,7 @@ extension SemanticConventions { /** The type of memory. */ - public struct MemoryTypeValues: CustomStringConvertible { + public struct MemoryTypeValues: CustomStringConvertible, Sendable { /// Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use. public static let stack = MemoryTypeValues("stack") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Graphql_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Graphql_attributes.swift index faff3370..7f452fc1 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Graphql_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Graphql_attributes.swift @@ -53,7 +53,7 @@ extension SemanticConventions { /** The type of the operation being executed. */ - public struct OperationTypeValues: CustomStringConvertible { + public struct OperationTypeValues: CustomStringConvertible, Sendable { /// GraphQL query public static let query = OperationTypeValues("query") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Host_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Host_attributes.swift index 54761c95..a324dee4 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Host_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Host_attributes.swift @@ -198,7 +198,7 @@ extension SemanticConventions { /** The CPU architecture the host system is running on. */ - public struct ArchValues: CustomStringConvertible { + public struct ArchValues: CustomStringConvertible, Sendable { /// AMD64 public static let amd64 = ArchValues("amd64") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Http_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Http_attributes.swift index 4c509c09..1342f8db 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Http_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Http_attributes.swift @@ -76,8 +76,9 @@ extension SemanticConventions { ``` - Note: HTTP request method value SHOULD be "known" to the instrumentation. - By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) - and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods), + the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html) + and the QUERY method defined in [httpbis-safe-method-w-body](https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1). If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`. @@ -200,17 +201,25 @@ extension SemanticConventions { case responseStatusCode = "http.response.status_code" /** - The matched route, that is, the path template in the format used by the respective server framework. + The matched route template for the request. This MUST be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders. - Examples: ``` attributes[SemanticConventions.Http.route.rawValue] = "/users/:userID?" - attributes[SemanticConventions.Http.route.rawValue] = "{controller}/{action}/{id?}" + attributes[SemanticConventions.Http.route.rawValue] = "my-controller/my-action/{id?}" ``` - Note: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. + A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like `/users/` and placeholders that + are constrained to a finite, predefined set of values, e.g. `{controller}` or `{action}`. + + A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments. + + Instrumentations SHOULD use routing information provided by the corresponding web framework. They SHOULD pick the most precise source of routing information and MAY + support custom route formatting. Instrumentations SHOULD document the format and the API used to obtain the route string. + - Requires: Value type should be `String` */ case route = "http.route" @@ -218,7 +227,7 @@ extension SemanticConventions { /** State of the HTTP connection in the HTTP connection pool. */ - public struct ConnectionStateValues: CustomStringConvertible { + public struct ConnectionStateValues: CustomStringConvertible, Sendable { /// active state. public static let active = ConnectionStateValues("active") @@ -240,7 +249,7 @@ extension SemanticConventions { /** HTTP request method. */ - public struct RequestMethodValues: CustomStringConvertible { + public struct RequestMethodValues: CustomStringConvertible, Sendable { /// CONNECT method. public static let connect = RequestMethodValues("CONNECT") @@ -269,6 +278,9 @@ extension SemanticConventions { /// TRACE method. public static let trace = RequestMethodValues("TRACE") + /// QUERY method. + public static let query = RequestMethodValues("QUERY") + /// Any HTTP method that the instrumentation has no prior knowledge of. public static let other = RequestMethodValues("_OTHER") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Hw_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Hw_attributes.swift index c4e4146d..09995b7f 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Hw_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Hw_attributes.swift @@ -326,7 +326,7 @@ extension SemanticConventions { /** The current state of the battery */ - public struct BatteryStateValues: CustomStringConvertible { + public struct BatteryStateValues: CustomStringConvertible, Sendable { /// Charging public static let charging = BatteryStateValues("charging") @@ -348,7 +348,7 @@ extension SemanticConventions { /** Type of task the GPU is performing */ - public struct GpuTaskValues: CustomStringConvertible { + public struct GpuTaskValues: CustomStringConvertible, Sendable { /// Decoder public static let decoder = GpuTaskValues("decoder") @@ -373,7 +373,7 @@ extension SemanticConventions { /** Type of limit for hardware components */ - public struct LimitTypeValues: CustomStringConvertible { + public struct LimitTypeValues: CustomStringConvertible, Sendable { /// Critical public static let critical = LimitTypeValues("critical") @@ -416,7 +416,7 @@ extension SemanticConventions { /** State of the logical disk space usage */ - public struct LogicalDiskStateValues: CustomStringConvertible { + public struct LogicalDiskStateValues: CustomStringConvertible, Sendable { /// Used public static let used = LogicalDiskStateValues("used") @@ -438,7 +438,7 @@ extension SemanticConventions { /** State of the physical disk endurance utilization */ - public struct PhysicalDiskStateValues: CustomStringConvertible { + public struct PhysicalDiskStateValues: CustomStringConvertible, Sendable { /// Remaining public static let remaining = PhysicalDiskStateValues("remaining") @@ -457,7 +457,7 @@ extension SemanticConventions { /** The current state of the component */ - public struct StateValues: CustomStringConvertible { + public struct StateValues: CustomStringConvertible, Sendable { /// Degraded public static let degraded = StateValues("degraded") @@ -488,7 +488,7 @@ extension SemanticConventions { /** Type of tape drive operation */ - public struct TapeDriveOperationTypeValues: CustomStringConvertible { + public struct TapeDriveOperationTypeValues: CustomStringConvertible, Sendable { /// Mount public static let mount = TapeDriveOperationTypeValues("mount") @@ -513,7 +513,7 @@ extension SemanticConventions { /** Type of the component */ - public struct TypeValues: CustomStringConvertible { + public struct TypeValues: CustomStringConvertible, Sendable { /// Battery public static let battery = TypeValues("battery") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Ios_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Ios_attributes.swift index aecdc494..0af930a1 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Ios_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Ios_attributes.swift @@ -22,7 +22,7 @@ extension SemanticConventions { /** This attribute represents the state of the application. */ - public struct AppStateValues: CustomStringConvertible { + public struct AppStateValues: CustomStringConvertible, Sendable { /// The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`. public static let active = AppStateValues("active") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Jvm_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Jvm_attributes.swift index 57b566a2..e354ac35 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Jvm_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Jvm_attributes.swift @@ -122,7 +122,7 @@ extension SemanticConventions { /** The type of memory. */ - public struct MemoryTypeValues: CustomStringConvertible { + public struct MemoryTypeValues: CustomStringConvertible, Sendable { /// Heap memory. public static let heap = MemoryTypeValues("heap") @@ -144,7 +144,7 @@ extension SemanticConventions { /** State of the thread. */ - public struct ThreadStateValues: CustomStringConvertible { + public struct ThreadStateValues: CustomStringConvertible, Sendable { /// A thread that has not yet started is in this state. public static let new = ThreadStateValues("new") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/K8s_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/K8s_attributes.swift index 099d9e23..0919ffb0 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/K8s_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/K8s_attributes.swift @@ -705,6 +705,32 @@ extension SemanticConventions { */ case podName = "k8s.pod.name" + /** + The phase for the pod. Corresponds to the `phase` field of the: [K8s PodStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core) + + - Examples: + ``` + attributes[SemanticConventions.K8s.podStatusPhase.rawValue] = .Pending + attributes[SemanticConventions.K8s.podStatusPhase.rawValue] = .Running + ``` + + - Requires: Value should be one of ``PodStatusPhaseValues`` (of type `String`) + */ + case podStatusPhase = "k8s.pod.status.phase" + + /** + The reason for the pod state. Corresponds to the `reason` field of the: [K8s PodStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core) + + - Examples: + ``` + attributes[SemanticConventions.K8s.podStatusReason.rawValue] = .Evicted + attributes[SemanticConventions.K8s.podStatusReason.rawValue] = .NodeAffinity + ``` + + - Requires: Value should be one of ``PodStatusReasonValues`` (of type `String`) + */ + case podStatusReason = "k8s.pod.status.reason" + /** The UID of the Pod. @@ -825,7 +851,7 @@ extension SemanticConventions { attributes[SemanticConventions.K8s.resourcequotaResourceName.rawValue] = "count/replicationcontrollers" ``` - - Note: The value for this attribute can be either the full `count/[.]` string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See [Kubernetes Resource Quotas documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota) for more details. + - Note: The value for this attribute can be either the full `count/[.]` string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See [Kubernetes Resource Quotas documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-on-object-count) for more details. - Requires: Value type should be `String` */ @@ -947,7 +973,7 @@ extension SemanticConventions { /** The reason for the container state. Corresponds to the `reason` field of the: [K8s ContainerStateWaiting](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core) or [K8s ContainerStateTerminated](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core) */ - public struct ContainerStatusReasonValues: CustomStringConvertible { + public struct ContainerStatusReasonValues: CustomStringConvertible, Sendable { /// The container is being created. public static let containerCreating = ContainerStatusReasonValues("ContainerCreating") @@ -990,7 +1016,7 @@ extension SemanticConventions { /** The state of the container. [K8s ContainerState](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core) */ - public struct ContainerStatusStateValues: CustomStringConvertible { + public struct ContainerStatusStateValues: CustomStringConvertible, Sendable { /// The container has terminated. public static let terminated = ContainerStatusStateValues("terminated") @@ -1015,7 +1041,7 @@ extension SemanticConventions { /** The phase of the K8s namespace. */ - public struct NamespacePhaseValues: CustomStringConvertible { + public struct NamespacePhaseValues: CustomStringConvertible, Sendable { /// Active namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase) public static let active = NamespacePhaseValues("active") @@ -1037,7 +1063,7 @@ extension SemanticConventions { /** The status of the condition, one of True, False, Unknown. */ - public struct NodeConditionStatusValues: CustomStringConvertible { + public struct NodeConditionStatusValues: CustomStringConvertible, Sendable { public static let conditionTrue = NodeConditionStatusValues("true") public static let conditionFalse = NodeConditionStatusValues("false") public static let conditionUnknown = NodeConditionStatusValues("unknown") @@ -1056,7 +1082,7 @@ extension SemanticConventions { /** The condition type of a K8s Node. */ - public struct NodeConditionTypeValues: CustomStringConvertible { + public struct NodeConditionTypeValues: CustomStringConvertible, Sendable { /// The node is healthy and ready to accept pods public static let ready = NodeConditionTypeValues("Ready") @@ -1084,10 +1110,72 @@ extension SemanticConventions { } } + /** + The phase for the pod. Corresponds to the `phase` field of the: [K8s PodStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core) + */ + public struct PodStatusPhaseValues: CustomStringConvertible, Sendable { + + /// The pod has been accepted by the system, but one or more of the containers has not been started. This includes time before being bound to a node, as well as time spent pulling images onto the host. + public static let pending = PodStatusPhaseValues("Pending") + + /// The pod has been bound to a node and all of the containers have been started. At least one container is still running or is in the process of being restarted. + public static let running = PodStatusPhaseValues("Running") + + /// All containers in the pod have voluntarily terminated with a container exit code of 0, and the system is not going to restart any of these containers. + public static let succeeded = PodStatusPhaseValues("Succeeded") + + /// All containers in the pod have terminated, and at least one container has terminated in a failure (exited with a non-zero exit code or was stopped by the system). + public static let failed = PodStatusPhaseValues("Failed") + + /// For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod. + public static let unknown = PodStatusPhaseValues("Unknown") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } + + /** + The reason for the pod state. Corresponds to the `reason` field of the: [K8s PodStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#podstatus-v1-core) + */ + public struct PodStatusReasonValues: CustomStringConvertible, Sendable { + + /// The pod is evicted. + public static let evicted = PodStatusReasonValues("Evicted") + + /// The pod is in a status because of its node affinity + public static let nodeAffinity = PodStatusReasonValues("NodeAffinity") + + /// The reason on a pod when its state cannot be confirmed as kubelet is unresponsive on the node it is (was) running. + public static let nodeLost = PodStatusReasonValues("NodeLost") + + /// The node is shutdown + public static let shutdown = PodStatusReasonValues("Shutdown") + + /// The pod was rejected admission to the node because of an error during admission that could not be categorized. + public static let unexpectedAdmissionError = PodStatusReasonValues("UnexpectedAdmissionError") + + internal let value: String + + public init(_ customValue: String) { + self.value = customValue + } + + public var description: String { + return value + } + } + /** The type of the K8s volume. */ - public struct VolumeTypeValues: CustomStringConvertible { + public struct VolumeTypeValues: CustomStringConvertible, Sendable { /// A [persistentVolumeClaim](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume public static let persistentVolumeClaim = VolumeTypeValues("persistentVolumeClaim") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Linux_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Linux_attributes.swift index 1165282f..0ca2451e 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Linux_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Linux_attributes.swift @@ -26,7 +26,7 @@ extension SemanticConventions { /** The Linux Slab memory state */ - public struct MemorySlabStateValues: CustomStringConvertible { + public struct MemorySlabStateValues: CustomStringConvertible, Sendable { public static let reclaimable = MemorySlabStateValues("reclaimable") public static let unreclaimable = MemorySlabStateValues("unreclaimable") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Log_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Log_attributes.swift index 68530770..c4ce921d 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Log_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Log_attributes.swift @@ -98,7 +98,7 @@ extension SemanticConventions { /** The stream associated with the log. See below for a list of well-known values. */ - public struct IostreamValues: CustomStringConvertible { + public struct IostreamValues: CustomStringConvertible, Sendable { /// Logs from stdout stream public static let stdout = IostreamValues("stdout") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Messaging_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Messaging_attributes.swift index 209ba2d3..3ab9dec3 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Messaging_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Messaging_attributes.swift @@ -447,7 +447,7 @@ extension SemanticConventions { /** A string identifying the type of the messaging operation. */ - public struct OperationTypeValues: CustomStringConvertible { + public struct OperationTypeValues: CustomStringConvertible, Sendable { /// A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch sending scenarios. public static let create = OperationTypeValues("create") @@ -478,7 +478,7 @@ extension SemanticConventions { /** Model of message consumption. This only applies to consumer spans. */ - public struct RocketmqConsumptionModelValues: CustomStringConvertible { + public struct RocketmqConsumptionModelValues: CustomStringConvertible, Sendable { /// Clustering consumption model public static let clustering = RocketmqConsumptionModelValues("clustering") @@ -500,7 +500,7 @@ extension SemanticConventions { /** Type of message. */ - public struct RocketmqMessageTypeValues: CustomStringConvertible { + public struct RocketmqMessageTypeValues: CustomStringConvertible, Sendable { /// Normal message public static let normal = RocketmqMessageTypeValues("normal") @@ -528,7 +528,7 @@ extension SemanticConventions { /** Describes the [settlement type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock). */ - public struct ServicebusDispositionStatusValues: CustomStringConvertible { + public struct ServicebusDispositionStatusValues: CustomStringConvertible, Sendable { /// Message is completed public static let complete = ServicebusDispositionStatusValues("complete") @@ -556,7 +556,7 @@ extension SemanticConventions { /** The messaging system as identified by the client instrumentation. */ - public struct SystemValues: CustomStringConvertible { + public struct SystemValues: CustomStringConvertible, Sendable { /// Apache ActiveMQ public static let activemq = SystemValues("activemq") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Network_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Network_attributes.swift index 19b497cf..80392117 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Network_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Network_attributes.swift @@ -239,7 +239,7 @@ extension SemanticConventions { /** The state of network connection */ - public struct ConnectionStateValues: CustomStringConvertible { + public struct ConnectionStateValues: CustomStringConvertible, Sendable { public static let closed = ConnectionStateValues("closed") public static let closeWait = ConnectionStateValues("close_wait") public static let closing = ConnectionStateValues("closing") @@ -266,7 +266,7 @@ extension SemanticConventions { /** This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. */ - public struct ConnectionSubtypeValues: CustomStringConvertible { + public struct ConnectionSubtypeValues: CustomStringConvertible, Sendable { /// GPRS public static let gprs = ConnectionSubtypeValues("gprs") @@ -345,7 +345,7 @@ extension SemanticConventions { /** The internet connection type. */ - public struct ConnectionTypeValues: CustomStringConvertible { + public struct ConnectionTypeValues: CustomStringConvertible, Sendable { public static let wifi = ConnectionTypeValues("wifi") public static let wired = ConnectionTypeValues("wired") public static let cell = ConnectionTypeValues("cell") @@ -366,7 +366,7 @@ extension SemanticConventions { /** The network IO operation direction. */ - public struct IoDirectionValues: CustomStringConvertible { + public struct IoDirectionValues: CustomStringConvertible, Sendable { public static let transmit = IoDirectionValues("transmit") public static let receive = IoDirectionValues("receive") @@ -384,7 +384,7 @@ extension SemanticConventions { /** [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). */ - public struct TransportValues: CustomStringConvertible { + public struct TransportValues: CustomStringConvertible, Sendable { /// TCP public static let tcp = TransportValues("tcp") @@ -415,7 +415,7 @@ extension SemanticConventions { /** [OSI network layer](https://wikipedia.org/wiki/Network_layer) or non-OSI equivalent. */ - public struct TypeValues: CustomStringConvertible { + public struct TypeValues: CustomStringConvertible, Sendable { /// IPv4 public static let ipv4 = TypeValues("ipv4") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nfs_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nfs_attributes.swift new file mode 100644 index 00000000..bbe19118 --- /dev/null +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nfs_attributes.swift @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +// DO **NOT** EDIT. This file is automatically generated. + +import Foundation + +extension SemanticConventions { + public enum Nfs: String { + + /** + NFSv4+ operation name. + + - Examples: + ``` + attributes[SemanticConventions.Nfs.operationName.rawValue] = "OPEN" + attributes[SemanticConventions.Nfs.operationName.rawValue] = "READ" + attributes[SemanticConventions.Nfs.operationName.rawValue] = "GETATTR" + ``` + + - Requires: Value type should be `String` + */ + case operationName = "nfs.operation.name" + + /** + Linux: one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or "nocache" (NFSD_STATS_RC_NOCACHE -- uncacheable) + + - Examples: + ``` + attributes[SemanticConventions.Nfs.serverRepcacheStatus.rawValue] = "hit" + ``` + + - Requires: Value type should be `String` + */ + case serverRepcacheStatus = "nfs.server.repcache.status" + } +} \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nodejs_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nodejs_attributes.swift index f1905e84..f66c6837 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nodejs_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Nodejs_attributes.swift @@ -20,7 +20,7 @@ extension SemanticConventions { /** The state of event loop time. */ - public struct EventloopStateValues: CustomStringConvertible { + public struct EventloopStateValues: CustomStringConvertible, Sendable { /// Active time. public static let active = EventloopStateValues("active") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/OncRpc_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/OncRpc_attributes.swift new file mode 100644 index 00000000..729def37 --- /dev/null +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/OncRpc_attributes.swift @@ -0,0 +1,54 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +// DO **NOT** EDIT. This file is automatically generated. + +import Foundation + +extension SemanticConventions { + public enum OncRpc: String { + + /** + ONC/Sun RPC procedure name. + + - Examples: + ``` + attributes[SemanticConventions.OncRpc.procedureName.rawValue] = "OPEN" + attributes[SemanticConventions.OncRpc.procedureName.rawValue] = "READ" + attributes[SemanticConventions.OncRpc.procedureName.rawValue] = "GETATTR" + ``` + + - Requires: Value type should be `String` + */ + case procedureName = "onc_rpc.procedure.name" + + /** + ONC/Sun RPC procedure number. + + - Requires: Value type should be `Int` + */ + case procedureNumber = "onc_rpc.procedure.number" + + /** + ONC/Sun RPC program name. + + - Examples: + ``` + attributes[SemanticConventions.OncRpc.programName.rawValue] = "portmapper" + attributes[SemanticConventions.OncRpc.programName.rawValue] = "nfs" + ``` + + - Requires: Value type should be `String` + */ + case programName = "onc_rpc.program.name" + + /** + ONC/Sun RPC program version. + + - Requires: Value type should be `Int` + */ + case version = "onc_rpc.version" + } +} \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openai_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openai_attributes.swift index 4323e629..d68fbddf 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openai_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openai_attributes.swift @@ -51,7 +51,7 @@ extension SemanticConventions { /** The service tier requested. May be a specific tier, default, or auto. */ - public struct RequestServiceTierValues: CustomStringConvertible { + public struct RequestServiceTierValues: CustomStringConvertible, Sendable { /// The system will utilize scale tier credits until they are exhausted. public static let auto = RequestServiceTierValues("auto") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openshift_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openshift_attributes.swift new file mode 100644 index 00000000..2dd3582b --- /dev/null +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Openshift_attributes.swift @@ -0,0 +1,37 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +// DO **NOT** EDIT. This file is automatically generated. + +import Foundation + +extension SemanticConventions { + public enum Openshift: String { + + /** + The name of the cluster quota. + + - Examples: + ``` + attributes[SemanticConventions.Openshift.clusterquotaName.rawValue] = "opentelemetry" + ``` + + - Requires: Value type should be `String` + */ + case clusterquotaName = "openshift.clusterquota.name" + + /** + The UID of the cluster quota. + + - Examples: + ``` + attributes[SemanticConventions.Openshift.clusterquotaUid.rawValue] = "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" + ``` + + - Requires: Value type should be `String` + */ + case clusterquotaUid = "openshift.clusterquota.uid" + } +} \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Opentracing_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Opentracing_attributes.swift index bb80b317..e9ac6209 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Opentracing_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Opentracing_attributes.swift @@ -22,7 +22,7 @@ extension SemanticConventions { /** Parent-child Reference type */ - public struct RefTypeValues: CustomStringConvertible { + public struct RefTypeValues: CustomStringConvertible, Sendable { /// The parent Span depends on the child Span in some capacity public static let childOf = RefTypeValues("child_of") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Os_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Os_attributes.swift index 14ac597d..e1828db6 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Os_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Os_attributes.swift @@ -74,7 +74,7 @@ extension SemanticConventions { /** The operating system type. */ - public struct TypeValues: CustomStringConvertible { + public struct TypeValues: CustomStringConvertible, Sendable { /// Microsoft Windows public static let windows = TypeValues("windows") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Otel_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Otel_attributes.swift index 39a6fbbc..7d7b96d7 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Otel_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Otel_attributes.swift @@ -125,7 +125,7 @@ extension SemanticConventions { /** A name identifying the type of the OpenTelemetry component. */ - public struct ComponentTypeValues: CustomStringConvertible { + public struct ComponentTypeValues: CustomStringConvertible, Sendable { /// The builtin SDK batching span processor public static let batchingSpanProcessor = ComponentTypeValues("batching_span_processor") @@ -189,7 +189,7 @@ extension SemanticConventions { /** Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) */ - public struct SpanParentOriginValues: CustomStringConvertible { + public struct SpanParentOriginValues: CustomStringConvertible, Sendable { /// The span does not have a parent, it is a root span public static let none = SpanParentOriginValues("none") @@ -214,7 +214,7 @@ extension SemanticConventions { /** The result value of the sampler for this span */ - public struct SpanSamplingResultValues: CustomStringConvertible { + public struct SpanSamplingResultValues: CustomStringConvertible, Sendable { /// The span is not sampled and not recording public static let drop = SpanSamplingResultValues("DROP") @@ -239,7 +239,7 @@ extension SemanticConventions { /** Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. */ - public struct StatusCodeValues: CustomStringConvertible { + public struct StatusCodeValues: CustomStringConvertible, Sendable { /// The operation has been validated by an Application developer or Operator to have completed successfully. public static let ok = StatusCodeValues("OK") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Peer_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Peer_attributes.swift index ae2968af..16b13b6d 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Peer_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Peer_attributes.swift @@ -18,6 +18,11 @@ extension SemanticConventions { attributes[SemanticConventions.Peer.service.rawValue] = "AuthTokenCache" ``` + - Note: Examples of `peer.service` that users may specify: + + - A Redis cache of auth tokens as `peer.service="AuthTokenCache"`. + - A gRPC service `rpc.service="io.opentelemetry.AuthService"` may be hosted in both a gateway, `peer.service="ExternalApiService"` and a backend, `peer.service="AuthService"`. + - Requires: Value type should be `String` */ case service = "peer.service" diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Pprof_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Pprof_attributes.swift new file mode 100644 index 00000000..7ec8b153 --- /dev/null +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Pprof_attributes.swift @@ -0,0 +1,60 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +// DO **NOT** EDIT. This file is automatically generated. + +import Foundation + +extension SemanticConventions { + public enum Pprof: String { + + /** + Provides an indication that multiple symbols map to this location's address, for example due to identical code folding by the linker. In that case the line information represents one of the multiple symbols. This field must be recomputed when the symbolization state of the profile changes. + + - Requires: Value type should be `Bool` + */ + case locationIsFolded = "pprof.location.is_folded" + + /** + Indicates that there are filenames related to this mapping. + + - Requires: Value type should be `Bool` + */ + case mappingHasFilenames = "pprof.mapping.has_filenames" + + /** + Indicates that there are functions related to this mapping. + + - Requires: Value type should be `Bool` + */ + case mappingHasFunctions = "pprof.mapping.has_functions" + + /** + Indicates that there are inline frames related to this mapping. + + - Requires: Value type should be `Bool` + */ + case mappingHasInlineFrames = "pprof.mapping.has_inline_frames" + + /** + Indicates that there are line numbers related to this mapping. + + - Requires: Value type should be `Bool` + */ + case mappingHasLineNumbers = "pprof.mapping.has_line_numbers" + + /** + Free-form text associated with the profile. This field should not be used to store any machine-readable information, it is only for human-friendly content. + + - Examples: + ``` + attributes[SemanticConventions.Pprof.profileComment.rawValue] = ["hello world", "bazinga"] + ``` + + - Requires: Value type should be `[String]` + */ + case profileComment = "pprof.profile.comment" + } +} \ No newline at end of file diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Process_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Process_attributes.swift index 8cb24773..2fca4efa 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Process_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Process_attributes.swift @@ -65,7 +65,7 @@ extension SemanticConventions { - Requires: Value should be one of ``ContextSwitchTypeValues`` (of type `String`) */ - case contextSwitchType = "process.context_switch_type" + case contextSwitchType = "process.context_switch.type" /** The date and time the process was created, in ISO 8601 format. @@ -230,13 +230,6 @@ extension SemanticConventions { */ case owner = "process.owner" - /** - The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults. - - - Requires: Value should be one of ``PagingFaultTypeValues`` (of type `String`) - */ - case pagingFaultType = "process.paging.fault_type" - /** Parent Process identifier (PPID). @@ -357,6 +350,18 @@ extension SemanticConventions { */ case sessionLeaderPid = "process.session_leader.pid" + /** + The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + + - Examples: + ``` + attributes[SemanticConventions.Process.state.rawValue] = .running + ``` + + - Requires: Value should be one of ``StateValues`` (of type `String`) + */ + case state = "process.state" + /** Process title (proctitle) @@ -426,7 +431,7 @@ extension SemanticConventions { /** Specifies whether the context switches for this data point were voluntary or involuntary. */ - public struct ContextSwitchTypeValues: CustomStringConvertible { + public struct ContextSwitchTypeValues: CustomStringConvertible, Sendable { public static let voluntary = ContextSwitchTypeValues("voluntary") public static let involuntary = ContextSwitchTypeValues("involuntary") @@ -442,11 +447,13 @@ extension SemanticConventions { } /** - The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults. + The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) */ - public struct PagingFaultTypeValues: CustomStringConvertible { - public static let major = PagingFaultTypeValues("major") - public static let minor = PagingFaultTypeValues("minor") + public struct StateValues: CustomStringConvertible, Sendable { + public static let running = StateValues("running") + public static let sleeping = StateValues("sleeping") + public static let stopped = StateValues("stopped") + public static let defunct = StateValues("defunct") internal let value: String diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Profile_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Profile_attributes.swift index 3eef8b49..26e17735 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Profile_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Profile_attributes.swift @@ -25,7 +25,7 @@ extension SemanticConventions { /** Describes the interpreter or compiler of a single frame. */ - public struct FrameTypeValues: CustomStringConvertible { + public struct FrameTypeValues: CustomStringConvertible, Sendable { /// [.NET](https://wikipedia.org/wiki/.NET) public static let dotnet = FrameTypeValues("dotnet") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Rpc_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Rpc_attributes.swift index b514a3d5..659548b7 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Rpc_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Rpc_attributes.swift @@ -180,15 +180,13 @@ extension SemanticConventions { case messageUncompressedSize = "rpc.message.uncompressed_size" /** - The name of the (logical) method being called, must be equal to the $method part in the span name. + This is the logical name of the method from the RPC interface perspective. - Examples: ``` attributes[SemanticConventions.Rpc.method.rawValue] = "exampleMethod" ``` - - Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). - - Requires: Value type should be `String` */ case method = "rpc.method" @@ -201,8 +199,6 @@ extension SemanticConventions { attributes[SemanticConventions.Rpc.service.rawValue] = "myservice.EchoService" ``` - - Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side). - - Requires: Value type should be `String` */ case service = "rpc.service" @@ -217,7 +213,7 @@ extension SemanticConventions { /** The [error codes](https://connectrpc.com//docs/protocol/#error-codes) of the Connect request. Error codes are always string values. */ - public struct ConnectErrorCodeValues: CustomStringConvertible { + public struct ConnectErrorCodeValues: CustomStringConvertible, Sendable { public static let cancelled = ConnectErrorCodeValues("cancelled") public static let unknown = ConnectErrorCodeValues("unknown") public static let invalidArgument = ConnectErrorCodeValues("invalid_argument") @@ -249,7 +245,7 @@ extension SemanticConventions { /** The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. */ - public struct GStatusCodeValues: CustomStringConvertible { + public struct GStatusCodeValues: CustomStringConvertible, Sendable { /// OK public static let ok = GStatusCodeValues(0) @@ -316,7 +312,7 @@ extension SemanticConventions { /** Whether this is a received or sent message. */ - public struct MessageTypeValues: CustomStringConvertible { + public struct MessageTypeValues: CustomStringConvertible, Sendable { public static let sent = MessageTypeValues("SENT") public static let received = MessageTypeValues("RECEIVED") @@ -334,7 +330,7 @@ extension SemanticConventions { /** A string identifying the remoting system. See below for a list of well-known identifiers. */ - public struct SystemValues: CustomStringConvertible { + public struct SystemValues: CustomStringConvertible, Sendable { /// gRPC public static let grpc = SystemValues("grpc") @@ -350,6 +346,12 @@ extension SemanticConventions { /// Connect RPC public static let connectRpc = SystemValues("connect_rpc") + + /// [ONC RPC (Sun RPC)](https://datatracker.ietf.org/doc/html/rfc5531) + public static let oncRpc = SystemValues("onc_rpc") + + /// JSON-RPC + public static let jsonrpc = SystemValues("jsonrpc") internal let value: String diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Signalr_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Signalr_attributes.swift index 90abb3e9..d8d344a2 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Signalr_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Signalr_attributes.swift @@ -39,7 +39,7 @@ extension SemanticConventions { /** SignalR HTTP connection closure status. */ - public struct ConnectionStatusValues: CustomStringConvertible { + public struct ConnectionStatusValues: CustomStringConvertible, Sendable { /// The connection was closed normally. public static let normalClosure = ConnectionStatusValues("normal_closure") @@ -64,7 +64,7 @@ extension SemanticConventions { /** [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) */ - public struct TransportValues: CustomStringConvertible { + public struct TransportValues: CustomStringConvertible, Sendable { /// ServerSentEvents protocol public static let serverSentEvents = TransportValues("server_sent_events") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/System_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/System_attributes.swift index 4c88849a..e163394a 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/System_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/System_attributes.swift @@ -10,18 +10,6 @@ import Foundation extension SemanticConventions { public enum System: String { - /** - Deprecated, use `cpu.logical_number` instead. - - - Examples: - ``` - attributes[SemanticConventions.System.cpuLogicalNumber.rawValue] = 1 - ``` - - - Requires: Value type should be `Int` - */ - case cpuLogicalNumber = "system.cpu.logical_number" - /** The device identifier @@ -108,45 +96,33 @@ extension SemanticConventions { case pagingDirection = "system.paging.direction" /** - The memory paging state - - - Examples: - ``` - attributes[SemanticConventions.System.pagingState.rawValue] = .free - ``` - - - Requires: Value should be one of ``PagingStateValues`` (of type `String`) - */ - case pagingState = "system.paging.state" - - /** - The memory paging type + The paging fault type - Examples: ``` - attributes[SemanticConventions.System.pagingType.rawValue] = .minor + attributes[SemanticConventions.System.pagingFaultType.rawValue] = .minor ``` - - Requires: Value should be one of ``PagingTypeValues`` (of type `String`) + - Requires: Value should be one of ``PagingFaultTypeValues`` (of type `String`) */ - case pagingType = "system.paging.type" + case pagingFaultType = "system.paging.fault.type" /** - The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + The memory paging state - Examples: ``` - attributes[SemanticConventions.System.processStatus.rawValue] = .running + attributes[SemanticConventions.System.pagingState.rawValue] = .free ``` - - Requires: Value should be one of ``ProcessStatusValues`` (of type `String`) + - Requires: Value should be one of ``PagingStateValues`` (of type `String`) */ - case processStatus = "system.process.status" + case pagingState = "system.paging.state" /** The filesystem state */ - public struct FileStateValues: CustomStringConvertible { + public struct FileStateValues: CustomStringConvertible, Sendable { public static let used = FileStateValues("used") public static let free = FileStateValues("free") public static let reserved = FileStateValues("reserved") @@ -165,7 +141,7 @@ extension SemanticConventions { /** The filesystem type */ - public struct FileTypeValues: CustomStringConvertible { + public struct FileTypeValues: CustomStringConvertible, Sendable { public static let fat32 = FileTypeValues("fat32") public static let exfat = FileTypeValues("exfat") public static let ntfs = FileTypeValues("ntfs") @@ -187,7 +163,7 @@ extension SemanticConventions { /** The memory state */ - public struct MemoryStateValues: CustomStringConvertible { + public struct MemoryStateValues: CustomStringConvertible, Sendable { /// Actual used virtual memory in bytes. public static let used = MemoryStateValues("used") @@ -209,7 +185,7 @@ extension SemanticConventions { /** The paging access direction */ - public struct PagingDirectionValues: CustomStringConvertible { + public struct PagingDirectionValues: CustomStringConvertible, Sendable { public static let _in = PagingDirectionValues("in") public static let out = PagingDirectionValues("out") @@ -225,29 +201,11 @@ extension SemanticConventions { } /** - The memory paging state - */ - public struct PagingStateValues: CustomStringConvertible { - public static let used = PagingStateValues("used") - public static let free = PagingStateValues("free") - - internal let value: String - - public init(_ customValue: String) { - self.value = customValue - } - - public var description: String { - return value - } - } - - /** - The memory paging type + The paging fault type */ - public struct PagingTypeValues: CustomStringConvertible { - public static let major = PagingTypeValues("major") - public static let minor = PagingTypeValues("minor") + public struct PagingFaultTypeValues: CustomStringConvertible, Sendable { + public static let major = PagingFaultTypeValues("major") + public static let minor = PagingFaultTypeValues("minor") internal let value: String @@ -261,13 +219,11 @@ extension SemanticConventions { } /** - The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + The memory paging state */ - public struct ProcessStatusValues: CustomStringConvertible { - public static let running = ProcessStatusValues("running") - public static let sleeping = ProcessStatusValues("sleeping") - public static let stopped = ProcessStatusValues("stopped") - public static let defunct = ProcessStatusValues("defunct") + public struct PagingStateValues: CustomStringConvertible, Sendable { + public static let used = PagingStateValues("used") + public static let free = PagingStateValues("free") internal let value: String diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Telemetry_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Telemetry_attributes.swift index ea839721..f847d850 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Telemetry_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Telemetry_attributes.swift @@ -78,7 +78,7 @@ extension SemanticConventions { /** The language of the telemetry SDK. */ - public struct SdkLanguageValues: CustomStringConvertible { + public struct SdkLanguageValues: CustomStringConvertible, Sendable { public static let cpp = SdkLanguageValues("cpp") public static let dotnet = SdkLanguageValues("dotnet") public static let erlang = SdkLanguageValues("erlang") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Test_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Test_attributes.swift index 5b68163a..1b070d5f 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Test_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Test_attributes.swift @@ -69,7 +69,7 @@ extension SemanticConventions { /** The status of the actual test case result from test execution. */ - public struct CaseResultStatusValues: CustomStringConvertible { + public struct CaseResultStatusValues: CustomStringConvertible, Sendable { /// pass public static let pass = CaseResultStatusValues("pass") @@ -91,7 +91,7 @@ extension SemanticConventions { /** The status of the test suite run. */ - public struct SuiteRunStatusValues: CustomStringConvertible { + public struct SuiteRunStatusValues: CustomStringConvertible, Sendable { /// success public static let success = SuiteRunStatusValues("success") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Thread_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Thread_attributes.swift index 98ae46d0..df983249 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Thread_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Thread_attributes.swift @@ -18,6 +18,17 @@ extension SemanticConventions { attributes[SemanticConventions.Thread.id.rawValue] = 42 ``` + - Note: Examples of where the value can be extracted from: + + | Language or platform | Source | + | --- | --- | + | JVM | `Thread.currentThread().threadId()` | + | .NET | `Thread.CurrentThread.ManagedThreadId` | + | Python | `threading.current_thread().ident` | + | Ruby | `Thread.current.object_id` | + | C++ | `std::this_thread::get_id()` | + | Erlang | `erlang:self()` | + - Requires: Value type should be `Int` */ case id = "thread.id" @@ -30,6 +41,16 @@ extension SemanticConventions { attributes[SemanticConventions.Thread.name.rawValue] = "main" ``` + - Note: Examples of where the value can be extracted from: + + | Language or platform | Source | + | --- | --- | + | JVM | `Thread.currentThread().getName()` | + | .NET | `Thread.CurrentThread.Name` | + | Python | `threading.current_thread().name` | + | Ruby | `Thread.current.name` | + | Erlang | `erlang:process_info(self(), registered_name)` | + - Requires: Value type should be `String` */ case name = "thread.name" diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Tls_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Tls_attributes.swift index fcb5201a..1eecc658 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Tls_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Tls_attributes.swift @@ -348,7 +348,7 @@ extension SemanticConventions { /** Normalized lowercase protocol name parsed from original string of the negotiated [SSL/TLS protocol version](https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values) */ - public struct ProtocolNameValues: CustomStringConvertible { + public struct ProtocolNameValues: CustomStringConvertible, Sendable { public static let ssl = ProtocolNameValues("ssl") public static let tls = ProtocolNameValues("tls") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/UserAgent_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/UserAgent_attributes.swift index 6a25e870..7fa6149b 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/UserAgent_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/UserAgent_attributes.swift @@ -97,7 +97,7 @@ extension SemanticConventions { /** Specifies the category of synthetic traffic, such as tests or bots. */ - public struct SyntheticTypeValues: CustomStringConvertible { + public struct SyntheticTypeValues: CustomStringConvertible, Sendable { /// Bot source. public static let bot = SyntheticTypeValues("bot") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/V8js_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/V8js_attributes.swift index d36110d9..a695396c 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/V8js_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/V8js_attributes.swift @@ -29,7 +29,7 @@ extension SemanticConventions { /** The type of garbage collection. */ - public struct GcTypeValues: CustomStringConvertible { + public struct GcTypeValues: CustomStringConvertible, Sendable { /// Major (Mark Sweep Compact). public static let major = GcTypeValues("major") @@ -57,7 +57,7 @@ extension SemanticConventions { /** The name of the space type of heap memory. */ - public struct HeapSpaceNameValues: CustomStringConvertible { + public struct HeapSpaceNameValues: CustomStringConvertible, Sendable { /// New memory space. public static let newSpace = HeapSpaceNameValues("new_space") diff --git a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Vcs_attributes.swift b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Vcs_attributes.swift index a31e683c..7727d8f8 100644 --- a/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Vcs_attributes.swift +++ b/Sources/OpenTelemetryApi/Common/SemanticAttributes/Attributes/Vcs_attributes.swift @@ -245,7 +245,7 @@ extension SemanticConventions { case repositoryName = "vcs.repository.name" /** - The [canonical URL](https://support.google.com/webmasters/answer/10347851?hl=en#:~:text=A%20canonical%20URL%20is%20the,Google%20chooses%20one%20as%20canonical.) of the repository providing the complete HTTP(S) address in order to locate and identify the repository through a browser. + The [canonical URL](https://support.google.com/webmasters/answer/10347851) of the repository providing the complete HTTP(S) address in order to locate and identify the repository through a browser. - Examples: ``` @@ -276,7 +276,7 @@ extension SemanticConventions { /** The state of the change (pull request/merge request/changelist). */ - public struct ChangeStateValues: CustomStringConvertible { + public struct ChangeStateValues: CustomStringConvertible, Sendable { /// Open means the change is currently active and under review. It hasn't been merged into the target branch yet, and it's still possible to make changes or add comments. public static let open = ChangeStateValues("open") @@ -304,7 +304,7 @@ extension SemanticConventions { /** The type of line change being measured on a branch or change. */ - public struct LineChangeTypeValues: CustomStringConvertible { + public struct LineChangeTypeValues: CustomStringConvertible, Sendable { /// How many lines were added. public static let added = LineChangeTypeValues("added") @@ -326,7 +326,7 @@ extension SemanticConventions { /** The name of the version control system provider. */ - public struct ProviderNameValues: CustomStringConvertible { + public struct ProviderNameValues: CustomStringConvertible, Sendable { /// [GitHub](https://github.com) public static let github = ProviderNameValues("github") @@ -354,7 +354,7 @@ extension SemanticConventions { /** The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository. */ - public struct RefBaseTypeValues: CustomStringConvertible { + public struct RefBaseTypeValues: CustomStringConvertible, Sendable { /// [branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch) public static let branch = RefBaseTypeValues("branch") @@ -376,7 +376,7 @@ extension SemanticConventions { /** The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository. */ - public struct RefHeadTypeValues: CustomStringConvertible { + public struct RefHeadTypeValues: CustomStringConvertible, Sendable { /// [branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch) public static let branch = RefHeadTypeValues("branch") @@ -398,7 +398,7 @@ extension SemanticConventions { /** The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository. */ - public struct RefTypeValues: CustomStringConvertible { + public struct RefTypeValues: CustomStringConvertible, Sendable { /// [branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch) public static let branch = RefTypeValues("branch") @@ -420,7 +420,7 @@ extension SemanticConventions { /** The type of revision comparison. */ - public struct RevisionDeltaDirectionValues: CustomStringConvertible { + public struct RevisionDeltaDirectionValues: CustomStringConvertible, Sendable { /// How many revisions the change is behind the target ref. public static let behind = RevisionDeltaDirectionValues("behind") diff --git a/Sources/OpenTelemetryApi/Context/ActivityContextManager.swift b/Sources/OpenTelemetryApi/Context/ActivityContextManager.swift index ef1f892b..619d5160 100644 --- a/Sources/OpenTelemetryApi/Context/ActivityContextManager.swift +++ b/Sources/OpenTelemetryApi/Context/ActivityContextManager.swift @@ -6,11 +6,11 @@ import Foundation #if canImport(os.activity) - import os.activity + @preconcurrency import os.activity // Bridging Obj-C variabled defined as c-macroses. See `activity.h` header. // swiftlint:disable identifier_name - private let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bitPattern: -2), "_os_activity_current"), + nonisolated(unsafe) private let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bitPattern: -2), "_os_activity_current"), to: os_activity_t.self) // swiftlint:enable identifier_name @_silgen_name("_os_activity_create") private func _os_activity_create( @@ -20,7 +20,7 @@ import Foundation _ flags: os_activity_flag_t ) -> AnyObject! - public class ActivityContextManager: ImperativeContextManager { + public final class ActivityContextManager: ImperativeContextManager, @unchecked Sendable { static let instance = ActivityContextManager() let rlock = NSRecursiveLock() diff --git a/Sources/OpenTelemetryApi/Context/TaskLocalContextManager.swift b/Sources/OpenTelemetryApi/Context/TaskLocalContextManager.swift index b27e1340..7b195f90 100644 --- a/Sources/OpenTelemetryApi/Context/TaskLocalContextManager.swift +++ b/Sources/OpenTelemetryApi/Context/TaskLocalContextManager.swift @@ -6,6 +6,13 @@ import Foundation #if canImport(_Concurrency) + @preconcurrency import _Concurrency + + @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) + struct SendableWrapper: @unchecked Sendable { + let value: AnyObject? + } + /// A context manager utilizing a task local for tracking active context. /// /// Unlike the `os.activity` context manager, this class does not handle setting and removing context manually. @@ -15,13 +22,13 @@ import Foundation /// - Note: This restriction means this class is not suitable for dynamic context injection. /// If you require dynamic context injection, you will need a custom context manager. @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) - public class TaskLocalContextManager: ContextManager { + public final class TaskLocalContextManager: ContextManager, @unchecked Sendable { package static let instance = TaskLocalContextManager() - @TaskLocal static var context = [String: AnyObject]() + @TaskLocal nonisolated(unsafe) static var context: [String: SendableWrapper] = [:] public func getCurrentContextValue(forKey key: OpenTelemetryContextKeys) -> AnyObject? { - Self.context[key.rawValue] + Self.context[key.rawValue]?.value } public func setCurrentContextValue(forKey: OpenTelemetryContextKeys, value: AnyObject) {} @@ -30,14 +37,14 @@ import Foundation public func withCurrentContextValue(forKey key: OpenTelemetryContextKeys, value: AnyObject?, _ operation: () async throws -> T) async rethrows -> T { var context = Self.context - context[key.rawValue] = value + context[key.rawValue] = SendableWrapper(value: value) return try await Self.$context.withValue(context, operation: operation) } public func withCurrentContextValue(forKey key: OpenTelemetryContextKeys, value: AnyObject?, _ operation: () throws -> T) rethrows -> T { var context = Self.context - context[key.rawValue] = value + context[key.rawValue] = SendableWrapper(value: value) return try Self.$context.withValue(context, operation: operation) } diff --git a/Sources/OpenTelemetryApi/Logs/DefaultLogger.swift b/Sources/OpenTelemetryApi/Logs/DefaultLogger.swift index e307bbd1..d73d71a7 100644 --- a/Sources/OpenTelemetryApi/Logs/DefaultLogger.swift +++ b/Sources/OpenTelemetryApi/Logs/DefaultLogger.swift @@ -5,7 +5,7 @@ import Foundation -public class DefaultLogger: Logger { +public final class DefaultLogger: Logger, @unchecked Sendable { private static let instanceWithDomain = DefaultLogger(true) private static let instanceNoDomain = DefaultLogger(false) private static let noopLogRecordBuilder = NoopLogRecordBuilder() @@ -35,5 +35,5 @@ public class DefaultLogger: Logger { return Self.noopLogRecordBuilder } - private class NoopLogRecordBuilder: EventBuilder {} + private final class NoopLogRecordBuilder: EventBuilder, @unchecked Sendable {} } diff --git a/Sources/OpenTelemetryApi/Logs/DefaultLoggerProvider.swift b/Sources/OpenTelemetryApi/Logs/DefaultLoggerProvider.swift index d1e0d003..d2708098 100644 --- a/Sources/OpenTelemetryApi/Logs/DefaultLoggerProvider.swift +++ b/Sources/OpenTelemetryApi/Logs/DefaultLoggerProvider.swift @@ -5,7 +5,7 @@ import Foundation -public class DefaultLoggerProvider: LoggerProvider { +public final class DefaultLoggerProvider: LoggerProvider, @unchecked Sendable { public static let instance: LoggerProvider = DefaultLoggerProvider() fileprivate static let noopBuilderWithDomain = NoopLoggerBuilder(true) fileprivate static let noopBuilderNoDomain = NoopLoggerBuilder(false) @@ -19,7 +19,7 @@ public class DefaultLoggerProvider: LoggerProvider { } } -private class NoopLoggerBuilder: LoggerBuilder { +private final class NoopLoggerBuilder: LoggerBuilder, @unchecked Sendable { private let hasDomain: Bool fileprivate init(_ hasDomain: Bool) { diff --git a/Sources/OpenTelemetryApi/Logs/LoggerProvider.swift b/Sources/OpenTelemetryApi/Logs/LoggerProvider.swift index e91d0d97..d4181f78 100644 --- a/Sources/OpenTelemetryApi/Logs/LoggerProvider.swift +++ b/Sources/OpenTelemetryApi/Logs/LoggerProvider.swift @@ -5,7 +5,7 @@ import Foundation -public protocol LoggerProvider: AnyObject { +public protocol LoggerProvider: AnyObject, Sendable { /// Returns a Logger for a given name and version /// - Parameters: /// - instrumentationName: Name of the instrumentation library. diff --git a/Sources/OpenTelemetryApi/Metrics/DefaultMeter.swift b/Sources/OpenTelemetryApi/Metrics/DefaultMeter.swift index 84566cf8..fc7e659c 100644 --- a/Sources/OpenTelemetryApi/Metrics/DefaultMeter.swift +++ b/Sources/OpenTelemetryApi/Metrics/DefaultMeter.swift @@ -15,7 +15,7 @@ public class NoopObservableDoubleMeasurement: ObservableDoubleMeasurement { public func record(value: Double, attributes: [String: AttributeValue]) {} } -public class DefaultMeter: Meter { +public class DefaultMeter: Meter, @unchecked Sendable { init() {} public func counterBuilder(name: String) -> NoopLongCounterBuilder { diff --git a/Sources/OpenTelemetryApi/Metrics/DefaultMeterProvider.swift b/Sources/OpenTelemetryApi/Metrics/DefaultMeterProvider.swift index bfe315f6..a8b0bceb 100644 --- a/Sources/OpenTelemetryApi/Metrics/DefaultMeterProvider.swift +++ b/Sources/OpenTelemetryApi/Metrics/DefaultMeterProvider.swift @@ -8,7 +8,7 @@ import Foundation @available(*, deprecated, renamed: "DefaultMeterProvider") public typealias DefaultStableMeterProvider = DefaultMeterProvider -public class DefaultMeterProvider: MeterProvider { +public class DefaultMeterProvider: MeterProvider, @unchecked Sendable { static let noopMeterBuilder = NoopMeterBuilder() public static func noop() -> NoopMeterBuilder { @@ -23,7 +23,7 @@ public class DefaultMeterProvider: MeterProvider { Self.noop() } - public class NoopMeterBuilder: MeterBuilder { + public class NoopMeterBuilder: MeterBuilder, @unchecked Sendable { static let noopMeter = DefaultMeter() public func setSchemaUrl(schemaUrl: String) -> Self { @@ -43,5 +43,5 @@ public class DefaultMeterProvider: MeterProvider { } } - public static var instance = DefaultMeterProvider() + public static let instance = DefaultMeterProvider() } diff --git a/Sources/OpenTelemetryApi/OpenTelemetry.swift b/Sources/OpenTelemetryApi/OpenTelemetry.swift index bd533e62..ea7a4543 100644 --- a/Sources/OpenTelemetryApi/OpenTelemetry.swift +++ b/Sources/OpenTelemetryApi/OpenTelemetry.swift @@ -12,10 +12,10 @@ import Foundation /// This class provides a static global accessor for telemetry objects Tracer, Meter /// and BaggageManager. /// The telemetry objects are lazy-loaded singletons resolved via ServiceLoader mechanism. -public struct OpenTelemetry { - public static var version = "v1.37.0" +public struct OpenTelemetry: @unchecked Sendable { + public static let version = "v1.38.0" - public static var instance = OpenTelemetry() + nonisolated(unsafe) public static var instance = OpenTelemetry() /// Registered tracerProvider or default via DefaultTracerProvider.instance. public private(set) var tracerProvider: TracerProvider diff --git a/Sources/OpenTelemetryApi/Trace/DefaultTracer.swift b/Sources/OpenTelemetryApi/Trace/DefaultTracer.swift index e2f0680f..dd2f1e7c 100644 --- a/Sources/OpenTelemetryApi/Trace/DefaultTracer.swift +++ b/Sources/OpenTelemetryApi/Trace/DefaultTracer.swift @@ -6,8 +6,8 @@ import Foundation /// No-op implementation of the Tracer -public class DefaultTracer: Tracer { - public static var instance = DefaultTracer() +public final class DefaultTracer: Tracer, @unchecked Sendable { + public static let instance = DefaultTracer() public func spanBuilder(spanName: String) -> SpanBuilder { return PropagatedSpanBuilder(tracer: self, spanName: spanName) diff --git a/Sources/OpenTelemetryApi/Trace/DefaultTracerProvider.swift b/Sources/OpenTelemetryApi/Trace/DefaultTracerProvider.swift index 29b6f533..995ac887 100644 --- a/Sources/OpenTelemetryApi/Trace/DefaultTracerProvider.swift +++ b/Sources/OpenTelemetryApi/Trace/DefaultTracerProvider.swift @@ -5,7 +5,7 @@ import Foundation -public class DefaultTracerProvider: TracerProvider { +public final class DefaultTracerProvider: TracerProvider, @unchecked Sendable { public static let instance = DefaultTracerProvider() public func get(instrumentationName: String, diff --git a/Sources/OpenTelemetryApi/Trace/SemanticAttributes.swift b/Sources/OpenTelemetryApi/Trace/SemanticAttributes.swift deleted file mode 100644 index d947f266..00000000 --- a/Sources/OpenTelemetryApi/Trace/SemanticAttributes.swift +++ /dev/null @@ -1,3290 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ -// DO **NOT** EDIT. This file is automatically generated. - -import Foundation - -@available(*, deprecated, renamed: "SemanticConventions") -public enum SemanticAttributes: String { - /** - Client address - unix domain socket name, IPv4 or IPv6 address. - - ~~~ - // Examples - attributes[.clientAddress] = "/tmp/my.sock" - attributes[.clientAddress] = "10.1.2.80" - ~~~ - - - Note: When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent client address behind any intermediaries (e.g. proxies) if it's available. - - Requires: Value type should be `String` - */ - case clientAddress = "client.address" - /** - Client port number. - - ~~~ - // Examplesattributes[.clientPort] = 65123 - ~~~ - - - Note: When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent client port behind any intermediaries (e.g. proxies) if it's available. - - Requires: Value type should be `Int` - */ - case clientPort = "client.port" - /** - Immediate client peer address - unix domain socket name, IPv4 or IPv6 address. - - ~~~ - // Examples - attributes[.clientSocketAddress] = "/tmp/my.sock" - attributes[.clientSocketAddress] = "127.0.0.1" - ~~~ - - Requires: Value type should be `String` - */ - case clientSocketAddress = "client.socket.address" - /** - Immediate client peer port number. - - ~~~ - // Examplesattributes[.clientSocketPort] = 35555 - ~~~ - - Requires: Value type should be `Int` - */ - case clientSocketPort = "client.socket.port" - /** - Deprecated, use `http.request.method` instead. - - ~~~ - // Examples - attributes[.httpMethod] = "GET" - attributes[.httpMethod] = "POST" - attributes[.httpMethod] = "HEAD" - ~~~ - - Requires: Value type should be `String` - */ - case httpMethod = "http.method" - /** - Deprecated, use `http.response.status_code` instead. - - ~~~ - // Examplesattributes[.httpStatusCode] = 200 - ~~~ - - Requires: Value type should be `Int` - */ - case httpStatusCode = "http.status_code" - /** - Deprecated, use `url.scheme` instead. - - ~~~ - // Examples - attributes[.httpScheme] = "http" - attributes[.httpScheme] = "https" - ~~~ - - Requires: Value type should be `String` - */ - case httpScheme = "http.scheme" - /** - Deprecated, use `url.full` instead. - - ~~~ - // Examples - attributes[.httpUrl] = "https://www.foo.bar/search?q=OpenTelemetry#SemConv" - ~~~ - - Requires: Value type should be `String` - */ - case httpUrl = "http.url" - /** - Deprecated, use `url.path` and `url.query` instead. - - ~~~ - // Examples - attributes[.httpTarget] = "/search?q=OpenTelemetry#SemConv" - ~~~ - - Requires: Value type should be `String` - */ - case httpTarget = "http.target" - /** - Deprecated, use `http.request.body.size` instead. - - ~~~ - // Examplesattributes[.httpRequestContentLength] = 3495 - ~~~ - - Requires: Value type should be `Int` - */ - case httpRequestContentLength = "http.request_content_length" - /** - Deprecated, use `http.response.body.size` instead. - - ~~~ - // Examplesattributes[.httpResponseContentLength] = 3495 - ~~~ - - Requires: Value type should be `Int` - */ - case httpResponseContentLength = "http.response_content_length" - /** - Deprecated, use `server.socket.domain` on client spans. - - ~~~ - // Examples - attributes[.netSockPeerName] = "/var/my.sock" - ~~~ - - Requires: Value type should be `String` - */ - case netSockPeerName = "net.sock.peer.name" - /** - Deprecated, use `server.socket.address` on client spans and `client.socket.address` on server spans. - - ~~~ - // Examples - attributes[.netSockPeerAddr] = "192.168.0.1" - ~~~ - - Requires: Value type should be `String` - */ - case netSockPeerAddr = "net.sock.peer.addr" - /** - Deprecated, use `server.socket.port` on client spans and `client.socket.port` on server spans. - - ~~~ - // Examplesattributes[.netSockPeerPort] = 65531 - ~~~ - - Requires: Value type should be `Int` - */ - case netSockPeerPort = "net.sock.peer.port" - /** - Deprecated, use `server.address` on client spans and `client.address` on server spans. - - ~~~ - // Examples - attributes[.netPeerName] = "example.com" - ~~~ - - Requires: Value type should be `String` - */ - case netPeerName = "net.peer.name" - /** - Deprecated, use `server.port` on client spans and `client.port` on server spans. - - ~~~ - // Examplesattributes[.netPeerPort] = 8080 - ~~~ - - Requires: Value type should be `Int` - */ - case netPeerPort = "net.peer.port" - /** - Deprecated, use `server.address`. - - ~~~ - // Examples - attributes[.netHostName] = "example.com" - ~~~ - - Requires: Value type should be `String` - */ - case netHostName = "net.host.name" - /** - Deprecated, use `server.port`. - - ~~~ - // Examplesattributes[.netHostPort] = 8080 - ~~~ - - Requires: Value type should be `Int` - */ - case netHostPort = "net.host.port" - /** - Deprecated, use `server.socket.address`. - - ~~~ - // Examples - attributes[.netSockHostAddr] = "/var/my.sock" - ~~~ - - Requires: Value type should be `String` - */ - case netSockHostAddr = "net.sock.host.addr" - /** - Deprecated, use `server.socket.port`. - - ~~~ - // Examplesattributes[.netSockHostPort] = 8080 - ~~~ - - Requires: Value type should be `Int` - */ - case netSockHostPort = "net.sock.host.port" - /** - Deprecated, use `network.transport`. - - Requires: Value should be one of [`SemanticAttributes.NetTransportValues`](x-source-tag://otelNetTransportValues) (of type `String`) - */ - case netTransport = "net.transport" - /** - Deprecated, use `network.protocol.name`. - - ~~~ - // Examples - attributes[.netProtocolName] = "amqp" - attributes[.netProtocolName] = "http" - attributes[.netProtocolName] = "mqtt" - ~~~ - - Requires: Value type should be `String` - */ - case netProtocolName = "net.protocol.name" - /** - Deprecated, use `network.protocol.version`. - - ~~~ - // Examples - attributes[.netProtocolVersion] = "3.1.1" - ~~~ - - Requires: Value type should be `String` - */ - case netProtocolVersion = "net.protocol.version" - /** - Deprecated, use `network.transport` and `network.type`. - - Requires: Value should be one of [`SemanticAttributes.NetSockFamilyValues`](x-source-tag://otelNetSockFamilyValues) (of type `String`) - */ - case netSockFamily = "net.sock.family" - /** - The domain name of the destination system. - - ~~~ - // Examples - attributes[.destinationDomain] = "foo.example.com" - ~~~ - - - Note: This value may be a host name, a fully qualified domain name, or another host naming format. - - Requires: Value type should be `String` - */ - case destinationDomain = "destination.domain" - /** - Peer address, for example IP address or UNIX socket name. - - ~~~ - // Examples - attributes[.destinationAddress] = "10.5.3.2" - ~~~ - - Requires: Value type should be `String` - */ - case destinationAddress = "destination.address" - /** - Peer port number. - - ~~~ - // Examplesattributes[.destinationPort] = 3389attributes[.destinationPort] = 2888 - ~~~ - - Requires: Value type should be `Int` - */ - case destinationPort = "destination.port" - /** - The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. - - ~~~ - // Examples - attributes[.exceptionType] = "java.net.ConnectException" - attributes[.exceptionType] = "OSError" - ~~~ - - Requires: Value type should be `String` - */ - case exceptionType = "exception.type" - /** - The exception message. - - ~~~ - // Examples - attributes[.exceptionMessage] = "Division by zero" - attributes[.exceptionMessage] = "Can't convert 'int' object to str implicitly" - ~~~ - - Requires: Value type should be `String` - */ - case exceptionMessage = "exception.message" - /** - A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. - - ~~~ - // Examples - attributes[.exceptionStacktrace] = "Exception in thread \"main\" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)" - ~~~ - - Requires: Value type should be `String` - */ - case exceptionStacktrace = "exception.stacktrace" - /** - HTTP request method. - - ~~~ - // Examples - attributes[.httpRequestMethod] = "GET" - attributes[.httpRequestMethod] = "POST" - attributes[.httpRequestMethod] = "HEAD" - ~~~ - - - Note: HTTP request method value SHOULD be "known" to the instrumentation. - By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) - and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). - - If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER` and, except if reporting a metric, MUST - set the exact method received in the request line as value of the `http.request.method_original` attribute. - - If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override - the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named - OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods - (this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults). - - HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly. - Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. - Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value. - - Requires: Value should be one of [`SemanticAttributes.HttpRequestMethodValues`](x-source-tag://otelHttpRequestMethodValues) (of type `String`) - */ - case httpRequestMethod = "http.request.method" - /** - [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - - ~~~ - // Examplesattributes[.httpResponseStatusCode] = 200 - ~~~ - - Requires: Value type should be `Int` - */ - case httpResponseStatusCode = "http.response.status_code" - /** - [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. - - ~~~ - // Examples - attributes[.networkProtocolName] = "http" - attributes[.networkProtocolName] = "spdy" - ~~~ - - Requires: Value type should be `String` - */ - case networkProtocolName = "network.protocol.name" - /** - Version of the application layer protocol used. See note below. - - ~~~ - // Examples - attributes[.networkProtocolVersion] = "1.0" - attributes[.networkProtocolVersion] = "1.1" - attributes[.networkProtocolVersion] = "2.0" - ~~~ - - - Note: `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`. - - Requires: Value type should be `String` - */ - case networkProtocolVersion = "network.protocol.version" - /** - Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. - - ~~~ - // Examples - attributes[.serverAddress] = "example.com" - ~~~ - - - Note: Determined by using the first of the following that applies - - - Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) - if it's sent in absolute-form - - Host identifier of the `Host` header - - SHOULD NOT be set if capturing it would require an extra DNS lookup. - - Requires: Value type should be `String` - */ - case serverAddress = "server.address" - /** - Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. - - ~~~ - // Examplesattributes[.serverPort] = 80attributes[.serverPort] = 8080attributes[.serverPort] = 443 - ~~~ - - - Note: When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier. - - Requires: Value type should be `Int` - */ - case serverPort = "server.port" - /** - The matched route (path template in the format used by the respective server framework). See note below. - - ~~~ - // Examples - attributes[.httpRoute] = "/users/:userID?" - attributes[.httpRoute] = "{controller}/{action}/{id?}" - ~~~ - - - Note: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. - SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. - - Requires: Value type should be `String` - */ - case httpRoute = "http.route" - /** - The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. - - ~~~ - // Examples - attributes[.urlScheme] = "http" - attributes[.urlScheme] = "https" - ~~~ - - Requires: Value type should be `String` - */ - case urlScheme = "url.scheme" - /** - The name identifies the event. - - ~~~ - // Examples - attributes[.eventName] = "click" - attributes[.eventName] = "exception" - ~~~ - - Requires: Value type should be `String` - */ - case eventName = "event.name" - /** - The domain identifies the business context for the events. - - - Note: Events across different domains may have same `event.name`, yet be - unrelated events. - - Requires: Value should be one of [`SemanticAttributes.EventDomainValues`](x-source-tag://otelEventDomainValues) (of type `String`) - */ - case eventDomain = "event.domain" - /** - A unique identifier for the Log Record. - - ~~~ - // Examples - attributes[.logRecordUid] = "01ARZ3NDEKTSV4RRFFQ69G5FAV" - ~~~ - - - Note: If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values. - The id MAY be an [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec), but other identifiers (e.g. UUID) may be used as needed. - - Requires: Value type should be `String` - */ - case logRecordUid = "log.record.uid" - /** - The unique identifier of the feature flag. - - ~~~ - // Examples - attributes[.featureFlagKey] = "logo-color" - ~~~ - - Requires: Value type should be `String` - */ - case featureFlagKey = "feature_flag.key" - /** - The name of the service provider that performs the flag evaluation. - - ~~~ - // Examples - attributes[.featureFlagProviderName] = "Flag Manager" - ~~~ - - Requires: Value type should be `String` - */ - case featureFlagProviderName = "feature_flag.provider_name" - /** - SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the value can be used. - - ~~~ - // Examples - attributes[.featureFlagVariant] = "red" - attributes[.featureFlagVariant] = "true" - attributes[.featureFlagVariant] = "on" - ~~~ - - - Note: A semantic identifier, commonly referred to as a variant, provides a means - for referring to a value without including the value itself. This can - provide additional context for understanding the meaning behind a value. - For example, the variant `red` maybe be used for the value `#c05543`. - - A stringified version of the value can be used in situations where a - semantic identifier is unavailable. String representation of the value - should be determined by the implementer. - - Requires: Value type should be `String` - */ - case featureFlagVariant = "feature_flag.variant" - /** - The stream associated with the log. See below for a list of well-known values. - - Requires: Value should be one of [`SemanticAttributes.LogIostreamValues`](x-source-tag://otelLogIostreamValues) (of type `String`) - */ - case logIostream = "log.iostream" - /** - The basename of the file. - - ~~~ - // Examples - attributes[.logFileName] = "audit.log" - ~~~ - - Requires: Value type should be `String` - */ - case logFileName = "log.file.name" - /** - The full path to the file. - - ~~~ - // Examples - attributes[.logFilePath] = "/var/log/mysql/audit.log" - ~~~ - - Requires: Value type should be `String` - */ - case logFilePath = "log.file.path" - /** - The basename of the file, with symlinks resolved. - - ~~~ - // Examples - attributes[.logFileNameResolved] = "uuid.log" - ~~~ - - Requires: Value type should be `String` - */ - case logFileNameResolved = "log.file.name_resolved" - /** - The full path to the file, with symlinks resolved. - - ~~~ - // Examples - attributes[.logFilePathResolved] = "/var/lib/docker/uuid.log" - ~~~ - - Requires: Value type should be `String` - */ - case logFilePathResolved = "log.file.path_resolved" - /** - Physical server IP address or Unix socket address. If set from the client, should simply use the socket's peer address, and not attempt to find any actual server IP (i.e., if set from client, this may represent some proxy server instead of the logical server). - - ~~~ - // Examples - attributes[.serverSocketAddress] = "10.5.3.2" - ~~~ - - Requires: Value type should be `String` - */ - case serverSocketAddress = "server.socket.address" - /** - Name of the buffer pool. - - ~~~ - // Examples - attributes[.pool] = "mapped" - attributes[.pool] = "direct" - ~~~ - - - Note: Pool names are generally obtained via [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). - - Requires: Value type should be `String` - */ - case pool - /** - The type of memory. - - ~~~ - // Examples - attributes[.type] = "heap" - attributes[.type] = "non_heap" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.TypeValues`](x-source-tag://otelTypeValues) (of type `String`) - */ - case type - /** - The domain name of an immediate peer. - - ~~~ - // Examples - attributes[.serverSocketDomain] = "proxy.example.com" - ~~~ - - - Note: Typically observed from the client side, and represents a proxy or other intermediary domain name. - - Requires: Value type should be `String` - */ - case serverSocketDomain = "server.socket.domain" - /** - Physical server port. - - ~~~ - // Examplesattributes[.serverSocketPort] = 16456 - ~~~ - - Requires: Value type should be `Int` - */ - case serverSocketPort = "server.socket.port" - /** - The domain name of the source system. - - ~~~ - // Examples - attributes[.sourceDomain] = "foo.example.com" - ~~~ - - - Note: This value may be a host name, a fully qualified domain name, or another host naming format. - - Requires: Value type should be `String` - */ - case sourceDomain = "source.domain" - /** - Source address, for example IP address or Unix socket name. - - ~~~ - // Examples - attributes[.sourceAddress] = "10.5.3.2" - ~~~ - - Requires: Value type should be `String` - */ - case sourceAddress = "source.address" - /** - Source port number. - - ~~~ - // Examplesattributes[.sourcePort] = 3389attributes[.sourcePort] = 2888 - ~~~ - - Requires: Value type should be `Int` - */ - case sourcePort = "source.port" - /** - The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). - - ~~~ - // Examples - attributes[.awsLambdaInvokedArn] = "arn:aws:lambda:us-east-1:123456:function:myfunction:myalias" - ~~~ - - - Note: This may be different from `cloud.resource_id` if an alias is involved. - - Requires: Value type should be `String` - */ - case awsLambdaInvokedArn = "aws.lambda.invoked_arn" - /** - The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. - - ~~~ - // Examples - attributes[.cloudeventsEventId] = "123e4567-e89b-12d3-a456-426614174000" - attributes[.cloudeventsEventId] = "0001" - ~~~ - - Requires: Value type should be `String` - */ - case cloudeventsEventId = "cloudevents.event_id" - /** - The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. - - ~~~ - // Examples - attributes[.cloudeventsEventSource] = "https://github.com/cloudevents" - attributes[.cloudeventsEventSource] = "/cloudevents/spec/pull/123" - attributes[.cloudeventsEventSource] = "my-service" - ~~~ - - Requires: Value type should be `String` - */ - case cloudeventsEventSource = "cloudevents.event_source" - /** - The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. - - ~~~ - // Examples - attributes[.cloudeventsEventSpecVersion] = "1.0" - ~~~ - - Requires: Value type should be `String` - */ - case cloudeventsEventSpecVersion = "cloudevents.event_spec_version" - /** - The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence. - - ~~~ - // Examples - attributes[.cloudeventsEventType] = "com.github.pull_request.opened" - attributes[.cloudeventsEventType] = "com.example.object.deleted.v2" - ~~~ - - Requires: Value type should be `String` - */ - case cloudeventsEventType = "cloudevents.event_type" - /** - The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source). - - ~~~ - // Examples - attributes[.cloudeventsEventSubject] = "mynewfile.jpg" - ~~~ - - Requires: Value type should be `String` - */ - case cloudeventsEventSubject = "cloudevents.event_subject" - /** - Parent-child Reference type. - - - Note: The causal relationship between a child Span and a parent Span. - - Requires: Value should be one of [`SemanticAttributes.OpentracingRefTypeValues`](x-source-tag://otelOpentracingRefTypeValues) (of type `String`) - */ - case opentracingRefType = "opentracing.ref_type" - /** - An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - - Requires: Value should be one of [`SemanticAttributes.DbSystemValues`](x-source-tag://otelDbSystemValues) (of type `String`) - */ - case dbSystem = "db.system" - /** - The connection string used to connect to the database. It is recommended to remove embedded credentials. - - ~~~ - // Examples - attributes[.dbConnectionString] = "Server=(localdb)\v11.0;Integrated Security=true;" - ~~~ - - Requires: Value type should be `String` - */ - case dbConnectionString = "db.connection_string" - /** - Username for accessing the database. - - ~~~ - // Examples - attributes[.dbUser] = "readonly_user" - attributes[.dbUser] = "reporting_user" - ~~~ - - Requires: Value type should be `String` - */ - case dbUser = "db.user" - /** - The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. - - ~~~ - // Examples - attributes[.dbJdbcDriverClassname] = "org.postgresql.Driver" - attributes[.dbJdbcDriverClassname] = "com.microsoft.sqlserver.jdbc.SQLServerDriver" - ~~~ - - Requires: Value type should be `String` - */ - case dbJdbcDriverClassname = "db.jdbc.driver_classname" - /** - This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). - - ~~~ - // Examples - attributes[.dbName] = "customers" - attributes[.dbName] = "main" - ~~~ - - - Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). - - Requires: Value type should be `String` - */ - case dbName = "db.name" - /** - The database statement being executed. - - ~~~ - // Examples - attributes[.dbStatement] = "SELECT * FROM wuser_table" - attributes[.dbStatement] = "SET mykey \"WuValue\"" - ~~~ - - Requires: Value type should be `String` - */ - case dbStatement = "db.statement" - /** - The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. - - ~~~ - // Examples - attributes[.dbOperation] = "findAndModify" - attributes[.dbOperation] = "HMSET" - attributes[.dbOperation] = "SELECT" - ~~~ - - - Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - - Requires: Value type should be `String` - */ - case dbOperation = "db.operation" - /** - [OSI Transport Layer](https://osi-model.com/transport-layer/) or [Inter-process Communication method](https://en.wikipedia.org/wiki/Inter-process_communication). The value SHOULD be normalized to lowercase. - - ~~~ - // Examples - attributes[.networkTransport] = "tcp" - attributes[.networkTransport] = "udp" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.NetworkTransportValues`](x-source-tag://otelNetworkTransportValues) (of type `String`) - */ - case networkTransport = "network.transport" - /** - [OSI Network Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. - - ~~~ - // Examples - attributes[.networkType] = "ipv4" - attributes[.networkType] = "ipv6" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.NetworkTypeValues`](x-source-tag://otelNetworkTypeValues) (of type `String`) - */ - case networkType = "network.type" - /** - The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. - - ~~~ - // Examples - attributes[.dbMssqlInstanceName] = "MSSQLSERVER" - ~~~ - - - Note: If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard). - - Requires: Value type should be `String` - */ - case dbMssqlInstanceName = "db.mssql.instance_name" - /** - The fetch size used for paging, i.e. how many rows will be returned at once. - - ~~~ - // Examplesattributes[.dbCassandraPageSize] = 5000 - ~~~ - - Requires: Value type should be `Int` - */ - case dbCassandraPageSize = "db.cassandra.page_size" - /** - The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - - Requires: Value should be one of [`SemanticAttributes.DbCassandraConsistencyLevelValues`](x-source-tag://otelDbCassandraConsistencyLevelValues) (of type `String`) - */ - case dbCassandraConsistencyLevel = "db.cassandra.consistency_level" - /** - The name of the primary table that the operation is acting upon, including the keyspace name (if applicable). - - ~~~ - // Examples - attributes[.dbCassandraTable] = "mytable" - ~~~ - - - Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - - Requires: Value type should be `String` - */ - case dbCassandraTable = "db.cassandra.table" - /** - Whether or not the query is idempotent. - - Requires: Value type should be `Bool` - */ - case dbCassandraIdempotence = "db.cassandra.idempotence" - /** - The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. - - ~~~ - // Examplesattributes[.dbCassandraSpeculativeExecutionCount] = 0attributes[.dbCassandraSpeculativeExecutionCount] = 2 - ~~~ - - Requires: Value type should be `Int` - */ - case dbCassandraSpeculativeExecutionCount = "db.cassandra.speculative_execution_count" - /** - The ID of the coordinating node for a query. - - ~~~ - // Examples - attributes[.dbCassandraCoordinatorId] = "be13faa2-8574-4d71-926d-27f16cf8a7af" - ~~~ - - Requires: Value type should be `String` - */ - case dbCassandraCoordinatorId = "db.cassandra.coordinator.id" - /** - The data center of the coordinating node for a query. - - ~~~ - // Examples - attributes[.dbCassandraCoordinatorDc] = "us-west-2" - ~~~ - - Requires: Value type should be `String` - */ - case dbCassandraCoordinatorDc = "db.cassandra.coordinator.dc" - /** - The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. - - ~~~ - // Examplesattributes[.dbRedisDatabaseIndex] = 0attributes[.dbRedisDatabaseIndex] = 1attributes[.dbRedisDatabaseIndex] = 15 - ~~~ - - Requires: Value type should be `Int` - */ - case dbRedisDatabaseIndex = "db.redis.database_index" - /** - The collection being accessed within the database stated in `db.name`. - - ~~~ - // Examples - attributes[.dbMongodbCollection] = "customers" - attributes[.dbMongodbCollection] = "products" - ~~~ - - Requires: Value type should be `String` - */ - case dbMongodbCollection = "db.mongodb.collection" - /** - Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986). - - ~~~ - // Examples - attributes[.urlFull] = "https://localhost:9200/index/_search?q=user.id:kimchy" - ~~~ - - - Note: For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. - `url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password should be redacted and attribute's value should be `https://REDACTED:REDACTED@www.example.com/`. - `url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes. - - Requires: Value type should be `String` - */ - case urlFull = "url.full" - /** - The name of the primary table that the operation is acting upon, including the database name (if applicable). - - ~~~ - // Examples - attributes[.dbSqlTable] = "public.users" - attributes[.dbSqlTable] = "customers" - ~~~ - - - Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - - Requires: Value type should be `String` - */ - case dbSqlTable = "db.sql.table" - /** - Unique Cosmos client instance id. - - ~~~ - // Examples - attributes[.dbCosmosdbClientId] = "3ba4827d-4422-483f-b59f-85b74211c11d" - ~~~ - - Requires: Value type should be `String` - */ - case dbCosmosdbClientId = "db.cosmosdb.client_id" - /** - CosmosDB Operation Type. - - Requires: Value should be one of [`SemanticAttributes.DbCosmosdbOperationTypeValues`](x-source-tag://otelDbCosmosdbOperationTypeValues) (of type `String`) - */ - case dbCosmosdbOperationType = "db.cosmosdb.operation_type" - /** - Full user-agent string is generated by Cosmos DB SDK. - - ~~~ - // Examples - attributes[.userAgentOriginal] = "cosmos-netstandard-sdk/3.23.0\|3.23.1\|1\|X64\|Linux 5.4.0-1098-azure 104 18\|.NET Core 3.1.32\|S\|" - ~~~ - - - Note: The user-agent value is generated by SDK which is a combination of
`sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'
`direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'
`number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'
`type_of_machine_architecture` : Machine architecture. e.g. 'X64'
`operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'
`runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'
`failover_information` : Generated key to determine if region failover enabled. - Format Reg-{D (Disabled discovery)}-S(application region)|L(List of preferred regions)|N(None, user did not configure it). - Default value is "NS". - - Requires: Value type should be `String` - */ - case userAgentOriginal = "user_agent.original" - /** - Cosmos client connection mode. - - Requires: Value should be one of [`SemanticAttributes.DbCosmosdbConnectionModeValues`](x-source-tag://otelDbCosmosdbConnectionModeValues) (of type `String`) - */ - case dbCosmosdbConnectionMode = "db.cosmosdb.connection_mode" - /** - Cosmos DB container name. - - ~~~ - // Examples - attributes[.dbCosmosdbContainer] = "anystring" - ~~~ - - Requires: Value type should be `String` - */ - case dbCosmosdbContainer = "db.cosmosdb.container" - /** - Request payload size in bytes. - - Requires: Value type should be `Int` - */ - case dbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length" - /** - Cosmos DB status code. - - ~~~ - // Examplesattributes[.dbCosmosdbStatusCode] = 200attributes[.dbCosmosdbStatusCode] = 201 - ~~~ - - Requires: Value type should be `Int` - */ - case dbCosmosdbStatusCode = "db.cosmosdb.status_code" - /** - Cosmos DB sub status code. - - ~~~ - // Examplesattributes[.dbCosmosdbSubStatusCode] = 1000attributes[.dbCosmosdbSubStatusCode] = 1002 - ~~~ - - Requires: Value type should be `Int` - */ - case dbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code" - /** - RU consumed for that operation. - - ~~~ - // Examplesattributes[.dbCosmosdbRequestCharge] = 46.18attributes[.dbCosmosdbRequestCharge] = 1.0 - ~~~ - - Requires: Value type should be `double` - */ - case dbCosmosdbRequestCharge = "db.cosmosdb.request_charge" - /** - Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. - - Requires: Value should be one of [`SemanticAttributes.OtelStatusCodeValues`](x-source-tag://otelOtelStatusCodeValues) (of type `String`) - */ - case otelStatusCode = "otel.status_code" - /** - Description of the Status if it has a value, otherwise not set. - - ~~~ - // Examples - attributes[.otelStatusDescription] = "resource not found" - ~~~ - - Requires: Value type should be `String` - */ - case otelStatusDescription = "otel.status_description" - /** - Type of the trigger which caused this function invocation. - - - Note: For the server/consumer span on the incoming side, - `faas.trigger` MUST be set. - - Clients invoking FaaS instances usually cannot set `faas.trigger`, - since they would typically need to look in the payload to determine - the event type. If clients set it, it should be the same as the - trigger that corresponding incoming would have (i.e., this has - nothing to do with the underlying transport used to make the API - call to invoke the lambda, which is often HTTP). - - Requires: Value should be one of [`SemanticAttributes.FaasTriggerValues`](x-source-tag://otelFaasTriggerValues) (of type `String`) - */ - case faasTrigger = "faas.trigger" - /** - The invocation ID of the current function invocation. - - ~~~ - // Examples - attributes[.faasInvocationId] = "af9d5aa4-a685-4c5f-a22b-444f80b3cc28" - ~~~ - - Requires: Value type should be `String` - */ - case faasInvocationId = "faas.invocation_id" - /** - Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP). - - ~~~ - // Examples - attributes[.cloudResourceId] = "arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function" - attributes[.cloudResourceId] = "//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID" - attributes[.cloudResourceId] = "/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/" - ~~~ - - - Note: On some cloud providers, it may not be possible to determine the full ID at startup, - so it may be necessary to set `cloud.resource_id` as a span attribute instead. - - The exact value to use for `cloud.resource_id` depends on the cloud provider. - The following well-known definitions MUST be used if you set this attribute and they apply: - - * **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). - Take care not to use the "invoked ARN" directly but replace any - [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) - with the resolved function version, as the same runtime instance may be invokable with - multiple different aliases. - * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) - * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function, - *not* the function app, having the form - `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. - This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share - a TracerProvider. - - Requires: Value type should be `String` - */ - case cloudResourceId = "cloud.resource_id" - /** - The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. - - ~~~ - // Examples - attributes[.faasDocumentCollection] = "myBucketName" - attributes[.faasDocumentCollection] = "myDbName" - ~~~ - - Requires: Value type should be `String` - */ - case faasDocumentCollection = "faas.document.collection" - /** - Describes the type of the operation that was performed on the data. - - Requires: Value should be one of [`SemanticAttributes.FaasDocumentOperationValues`](x-source-tag://otelFaasDocumentOperationValues) (of type `String`) - */ - case faasDocumentOperation = "faas.document.operation" - /** - A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - - ~~~ - // Examples - attributes[.faasDocumentTime] = "2020-01-23T13:47:06Z" - ~~~ - - Requires: Value type should be `String` - */ - case faasDocumentTime = "faas.document.time" - /** - The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. - - ~~~ - // Examples - attributes[.faasDocumentName] = "myFile.txt" - attributes[.faasDocumentName] = "myTableName" - ~~~ - - Requires: Value type should be `String` - */ - case faasDocumentName = "faas.document.name" - /** - The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component. - - ~~~ - // Examples - attributes[.urlPath] = "/search" - ~~~ - - - Note: When missing, the value is assumed to be `/`. - - Requires: Value type should be `String` - */ - case urlPath = "url.path" - /** - The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component. - - ~~~ - // Examples - attributes[.urlQuery] = "q=OpenTelemetry" - ~~~ - - - Note: Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it. - - Requires: Value type should be `String` - */ - case urlQuery = "url.query" - /** - A string identifying the messaging system. - - ~~~ - // Examples - attributes[.messagingSystem] = "kafka" - attributes[.messagingSystem] = "rabbitmq" - attributes[.messagingSystem] = "rocketmq" - attributes[.messagingSystem] = "activemq" - attributes[.messagingSystem] = "AmazonSQS" - ~~~ - - Requires: Value type should be `String` - */ - case messagingSystem = "messaging.system" - /** - A string identifying the kind of messaging operation as defined in the [Operation names](#operation-names) section above. - - - Note: If a custom value is used, it MUST be of low cardinality. - - Requires: Value should be one of [`SemanticAttributes.MessagingOperationValues`](x-source-tag://otelMessagingOperationValues) (of type `String`) - */ - case messagingOperation = "messaging.operation" - /** - The number of messages sent, received, or processed in the scope of the batching operation. - - ~~~ - // Examplesattributes[.messagingBatchMessageCount] = 0attributes[.messagingBatchMessageCount] = 1attributes[.messagingBatchMessageCount] = 2 - ~~~ - - - Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations SHOULD use `messaging.batch.message_count` for batching APIs and SHOULD NOT use it for single-message APIs. - - Requires: Value type should be `Int` - */ - case messagingBatchMessageCount = "messaging.batch.message_count" - /** - A unique identifier for the client that consumes or produces a message. - - ~~~ - // Examples - attributes[.messagingClientId] = "client-5" - attributes[.messagingClientId] = "myhost@8742@s8083jm" - ~~~ - - Requires: Value type should be `String` - */ - case messagingClientId = "messaging.client_id" - /** - The message destination name. - - ~~~ - // Examples - attributes[.messagingDestinationName] = "MyQueue" - attributes[.messagingDestinationName] = "MyTopic" - ~~~ - - - Note: Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If - the broker does not have such notion, the destination name SHOULD uniquely identify the broker. - - Requires: Value type should be `String` - */ - case messagingDestinationName = "messaging.destination.name" - /** - Low cardinality representation of the messaging destination name. - - ~~~ - // Examples - attributes[.messagingDestinationTemplate] = "/customers/{customerId}" - ~~~ - - - Note: Destination names could be constructed from templates. An example would be a destination name involving a user name or product id. Although the destination name in this case is of high cardinality, the underlying template is of low cardinality and can be effectively used for grouping and aggregation. - - Requires: Value type should be `String` - */ - case messagingDestinationTemplate = "messaging.destination.template" - /** - A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed. - - Requires: Value type should be `Bool` - */ - case messagingDestinationTemporary = "messaging.destination.temporary" - /** - A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name). - - Requires: Value type should be `Bool` - */ - case messagingDestinationAnonymous = "messaging.destination.anonymous" - /** - A value used by the messaging system as an identifier for the message, represented as a string. - - ~~~ - // Examples - attributes[.messagingMessageId] = "452a7c7c7c7048c2f887f61572b18fc2" - ~~~ - - Requires: Value type should be `String` - */ - case messagingMessageId = "messaging.message.id" - /** - The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". - - ~~~ - // Examples - attributes[.messagingMessageConversationId] = "MyConversationId" - ~~~ - - Requires: Value type should be `String` - */ - case messagingMessageConversationId = "messaging.message.conversation_id" - /** - The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. - - ~~~ - // Examplesattributes[.messagingMessagePayloadSizeBytes] = 2738 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingMessagePayloadSizeBytes = "messaging.message.payload_size_bytes" - /** - The compressed size of the message payload in bytes. - - ~~~ - // Examplesattributes[.messagingMessagePayloadCompressedSizeBytes] = 2048 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingMessagePayloadCompressedSizeBytes = "messaging.message.payload_compressed_size_bytes" - /** - A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - - ~~~ - // Examples - attributes[.faasTime] = "2020-01-23T13:47:06Z" - ~~~ - - Requires: Value type should be `String` - */ - case faasTime = "faas.time" - /** - A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - - ~~~ - // Examples - attributes[.faasCron] = "0/5 * * * ? *" - ~~~ - - Requires: Value type should be `String` - */ - case faasCron = "faas.cron" - /** - A boolean that is true if the serverless function is executed for the first time (aka cold-start). - - Requires: Value type should be `Bool` - */ - case faasColdstart = "faas.coldstart" - /** - The name of the invoked function. - - ~~~ - // Examples - attributes[.faasInvokedName] = "my-function" - ~~~ - - - Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. - - Requires: Value type should be `String` - */ - case faasInvokedName = "faas.invoked_name" - /** - The cloud provider of the invoked function. - - - Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. - - Requires: Value should be one of [`SemanticAttributes.FaasInvokedProviderValues`](x-source-tag://otelFaasInvokedProviderValues) (of type `String`) - */ - case faasInvokedProvider = "faas.invoked_provider" - /** - The cloud region of the invoked function. - - ~~~ - // Examples - attributes[.faasInvokedRegion] = "eu-central-1" - ~~~ - - - Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. - - Requires: Value type should be `String` - */ - case faasInvokedRegion = "faas.invoked_region" - /** - The internet connection type. - - ~~~ - // Examples - attributes[.networkConnectionType] = "wifi" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.NetworkConnectionTypeValues`](x-source-tag://otelNetworkConnectionTypeValues) (of type `String`) - */ - case networkConnectionType = "network.connection.type" - /** - This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. - - ~~~ - // Examples - attributes[.networkConnectionSubtype] = "LTE" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.NetworkConnectionSubtypeValues`](x-source-tag://otelNetworkConnectionSubtypeValues) (of type `String`) - */ - case networkConnectionSubtype = "network.connection.subtype" - /** - The name of the mobile carrier. - - ~~~ - // Examples - attributes[.networkCarrierName] = "sprint" - ~~~ - - Requires: Value type should be `String` - */ - case networkCarrierName = "network.carrier.name" - /** - The mobile carrier country code. - - ~~~ - // Examples - attributes[.networkCarrierMcc] = "310" - ~~~ - - Requires: Value type should be `String` - */ - case networkCarrierMcc = "network.carrier.mcc" - /** - The mobile carrier network code. - - ~~~ - // Examples - attributes[.networkCarrierMnc] = "001" - ~~~ - - Requires: Value type should be `String` - */ - case networkCarrierMnc = "network.carrier.mnc" - /** - The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. - - ~~~ - // Examples - attributes[.networkCarrierIcc] = "DE" - ~~~ - - Requires: Value type should be `String` - */ - case networkCarrierIcc = "network.carrier.icc" - /** - The [`service.name`](/docs/resource/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. - - ~~~ - // Examples - attributes[.peerService] = "AuthTokenCache" - ~~~ - - Requires: Value type should be `String` - */ - case peerService = "peer.service" - /** - Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. - - ~~~ - // Examples - attributes[.enduserId] = "username" - ~~~ - - Requires: Value type should be `String` - */ - case enduserId = "enduser.id" - /** - Actual/assumed role the client is making the request under extracted from token or application security context. - - ~~~ - // Examples - attributes[.enduserRole] = "admin" - ~~~ - - Requires: Value type should be `String` - */ - case enduserRole = "enduser.role" - /** - Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - - ~~~ - // Examples - attributes[.enduserScope] = "read:message, write:files" - ~~~ - - Requires: Value type should be `String` - */ - case enduserScope = "enduser.scope" - /** - Current "managed" thread ID (as opposed to OS thread ID). - - ~~~ - // Examplesattributes[.threadId] = 42 - ~~~ - - Requires: Value type should be `Int` - */ - case threadId = "thread.id" - /** - Current thread name. - - ~~~ - // Examples - attributes[.threadName] = "main" - ~~~ - - Requires: Value type should be `String` - */ - case threadName = "thread.name" - /** - The method or function name, or equivalent (usually rightmost part of the code unit's name). - - ~~~ - // Examples - attributes[.codeFunction] = "serveRequest" - ~~~ - - Requires: Value type should be `String` - */ - case codeFunction = "code.function" - /** - The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. - - ~~~ - // Examples - attributes[.codeNamespace] = "com.example.MyHttpService" - ~~~ - - Requires: Value type should be `String` - */ - case codeNamespace = "code.namespace" - /** - The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). - - ~~~ - // Examples - attributes[.codeFilepath] = "/usr/local/MyApplication/content_root/app/index.php" - ~~~ - - Requires: Value type should be `String` - */ - case codeFilepath = "code.filepath" - /** - The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. - - ~~~ - // Examplesattributes[.codeLineno] = 42 - ~~~ - - Requires: Value type should be `Int` - */ - case codeLineno = "code.lineno" - /** - The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. - - ~~~ - // Examplesattributes[.codeColumn] = 16 - ~~~ - - Requires: Value type should be `Int` - */ - case codeColumn = "code.column" - /** - Original HTTP method sent by the client in the request line. - - ~~~ - // Examples - attributes[.httpRequestMethodOriginal] = "GeT" - attributes[.httpRequestMethodOriginal] = "ACL" - attributes[.httpRequestMethodOriginal] = "foo" - ~~~ - - Requires: Value type should be `String` - */ - case httpRequestMethodOriginal = "http.request.method_original" - /** - The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. - - ~~~ - // Examplesattributes[.httpRequestBodySize] = 3495 - ~~~ - - Requires: Value type should be `Int` - */ - case httpRequestBodySize = "http.request.body.size" - /** - The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. - - ~~~ - // Examplesattributes[.httpResponseBodySize] = 3495 - ~~~ - - Requires: Value type should be `Int` - */ - case httpResponseBodySize = "http.response.body.size" - /** - The ordinal number of request resending attempt (for any reason, including redirects). - - ~~~ - // Examplesattributes[.httpResendCount] = 3 - ~~~ - - - Note: The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other). - - Requires: Value type should be `Int` - */ - case httpResendCount = "http.resend_count" - /** - The value `aws-api`. - - ~~~ - // Examples - attributes[.rpcSystem] = "aws-api" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.RpcSystemValues`](x-source-tag://otelRpcSystemValues) (of type `String`) - */ - case rpcSystem = "rpc.system" - /** - The name of the service to which a request is made, as returned by the AWS SDK. - - ~~~ - // Examples - attributes[.rpcService] = "DynamoDB" - attributes[.rpcService] = "S3" - ~~~ - - - Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side). - - Requires: Value type should be `String` - */ - case rpcService = "rpc.service" - /** - The name of the operation corresponding to the request, as returned by the AWS SDK. - - ~~~ - // Examples - attributes[.rpcMethod] = "GetItem" - attributes[.rpcMethod] = "PutItem" - ~~~ - - - Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). - - Requires: Value type should be `String` - */ - case rpcMethod = "rpc.method" - /** - The AWS request ID as returned in the response headers `x-amz-request-id` or `x-amz-requestid`. - - ~~~ - // Examples - attributes[.awsRequestId] = "79b9da39-b7ae-508a-a6bc-864b2829c622" - attributes[.awsRequestId] = "C9ER4AJX75574TDJ" - ~~~ - - Requires: Value type should be `String` - */ - case awsRequestId = "aws.request_id" - /** - The keys in the `RequestItems` object field. - - ~~~ - // Examplesattributes[.awsDynamodbTableNames] = Usersattributes[.awsDynamodbTableNames] = Cats - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbTableNames = "aws.dynamodb.table_names" - /** - The JSON-serialized value of each item in the `ConsumedCapacity` response field. - - ~~~ - // Examplesattributes[.awsDynamodbConsumedCapacity] = { "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": "string", "WriteCapacityUnits": number } - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbConsumedCapacity = "aws.dynamodb.consumed_capacity" - /** - The JSON-serialized value of the `ItemCollectionMetrics` response field. - - ~~~ - // Examples - attributes[.awsDynamodbItemCollectionMetrics] = "{ \"string\" : [ { \"ItemCollectionKey\": { \"string\" : { \"B\": blob, \"BOOL\": boolean, \"BS\": [ blob ], \"L\": [ \"AttributeValue\" ], \"M\": { \"string\" : \"AttributeValue\" }, \"N\": \"string\", \"NS\": [ \"string\" ], \"NULL\": boolean, \"S\": \"string\", \"SS\": [ \"string\" ] } }, \"SizeEstimateRangeGB\": [ number ] } ] }" - ~~~ - - Requires: Value type should be `String` - */ - case awsDynamodbItemCollectionMetrics = "aws.dynamodb.item_collection_metrics" - /** - The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbProvisionedReadCapacity] = 1.0attributes[.awsDynamodbProvisionedReadCapacity] = 2.0 - ~~~ - - Requires: Value type should be `double` - */ - case awsDynamodbProvisionedReadCapacity = "aws.dynamodb.provisioned_read_capacity" - /** - The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbProvisionedWriteCapacity] = 1.0attributes[.awsDynamodbProvisionedWriteCapacity] = 2.0 - ~~~ - - Requires: Value type should be `double` - */ - case awsDynamodbProvisionedWriteCapacity = "aws.dynamodb.provisioned_write_capacity" - /** - The value of the `ConsistentRead` request parameter. - - Requires: Value type should be `Bool` - */ - case awsDynamodbConsistentRead = "aws.dynamodb.consistent_read" - /** - The value of the `ProjectionExpression` request parameter. - - ~~~ - // Examples - attributes[.awsDynamodbProjection] = "Title" - attributes[.awsDynamodbProjection] = "Title, Price, Color" - attributes[.awsDynamodbProjection] = "Title, Description, RelatedItems, ProductReviews" - ~~~ - - Requires: Value type should be `String` - */ - case awsDynamodbProjection = "aws.dynamodb.projection" - /** - The value of the `Limit` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbLimit] = 10 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbLimit = "aws.dynamodb.limit" - /** - The value of the `AttributesToGet` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbAttributesToGet] = livesattributes[.awsDynamodbAttributesToGet] = id - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbAttributesToGet = "aws.dynamodb.attributes_to_get" - /** - The value of the `IndexName` request parameter. - - ~~~ - // Examples - attributes[.awsDynamodbIndexName] = "name_to_group" - ~~~ - - Requires: Value type should be `String` - */ - case awsDynamodbIndexName = "aws.dynamodb.index_name" - /** - The value of the `Select` request parameter. - - ~~~ - // Examples - attributes[.awsDynamodbSelect] = "ALL_ATTRIBUTES" - attributes[.awsDynamodbSelect] = "COUNT" - ~~~ - - Requires: Value type should be `String` - */ - case awsDynamodbSelect = "aws.dynamodb.select" - /** - The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. - - ~~~ - // Examplesattributes[.awsDynamodbGlobalSecondaryIndexes] = { "IndexName": "string", "KeySchema": [ { "AttributeName": "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": number } } - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbGlobalSecondaryIndexes = "aws.dynamodb.global_secondary_indexes" - /** - The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. - - ~~~ - // Examplesattributes[.awsDynamodbLocalSecondaryIndexes] = { "IndexArn": "string", "IndexName": "string", "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } } - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbLocalSecondaryIndexes = "aws.dynamodb.local_secondary_indexes" - /** - The value of the `ExclusiveStartTableName` request parameter. - - ~~~ - // Examples - attributes[.awsDynamodbExclusiveStartTable] = "Users" - attributes[.awsDynamodbExclusiveStartTable] = "CatsTable" - ~~~ - - Requires: Value type should be `String` - */ - case awsDynamodbExclusiveStartTable = "aws.dynamodb.exclusive_start_table" - /** - The the number of items in the `TableNames` response parameter. - - ~~~ - // Examplesattributes[.awsDynamodbTableCount] = 20 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbTableCount = "aws.dynamodb.table_count" - /** - The value of the `ScanIndexForward` request parameter. - - Requires: Value type should be `Bool` - */ - case awsDynamodbScanForward = "aws.dynamodb.scan_forward" - /** - The value of the `Segment` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbSegment] = 10 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbSegment = "aws.dynamodb.segment" - /** - The value of the `TotalSegments` request parameter. - - ~~~ - // Examplesattributes[.awsDynamodbTotalSegments] = 100 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbTotalSegments = "aws.dynamodb.total_segments" - /** - The value of the `Count` response parameter. - - ~~~ - // Examplesattributes[.awsDynamodbCount] = 10 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbCount = "aws.dynamodb.count" - /** - The value of the `ScannedCount` response parameter. - - ~~~ - // Examplesattributes[.awsDynamodbScannedCount] = 50 - ~~~ - - Requires: Value type should be `Int` - */ - case awsDynamodbScannedCount = "aws.dynamodb.scanned_count" - /** - The JSON-serialized value of each item in the `AttributeDefinitions` request field. - - ~~~ - // Examplesattributes[.awsDynamodbAttributeDefinitions] = { "AttributeName": "string", "AttributeType": "string" } - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbAttributeDefinitions = "aws.dynamodb.attribute_definitions" - /** - The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. - - ~~~ - // Examplesattributes[.awsDynamodbGlobalSecondaryIndexUpdates] = { "Create": { "IndexName": "string", "KeySchema": [ { "AttributeName": "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": number } } - ~~~ - - Requires: Value type should be `[String]` - */ - case awsDynamodbGlobalSecondaryIndexUpdates = "aws.dynamodb.global_secondary_index_updates" - /** - The S3 bucket name the request refers to. Corresponds to the `--bucket` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations. - - ~~~ - // Examples - attributes[.awsS3Bucket] = "some-bucket-name" - ~~~ - - - Note: The `bucket` attribute is applicable to all S3 operations that reference a bucket, i.e. that require the bucket name as a mandatory parameter. - This applies to almost all S3 operations except `list-buckets`. - - Requires: Value type should be `String` - */ - case awsS3Bucket = "aws.s3.bucket" - /** - The S3 object key the request refers to. Corresponds to the `--key` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations. - - ~~~ - // Examples - attributes[.awsS3Key] = "someFile.yml" - ~~~ - - - Note: The `key` attribute is applicable to all object-related S3 operations, i.e. that require the object key as a mandatory parameter. - This applies in particular to the following operations: - - - [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - - [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) - - [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) - - [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) - - [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) - - [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) - - [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) - - [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - - [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - - [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) - - [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - - [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). - - Requires: Value type should be `String` - */ - case awsS3Key = "aws.s3.key" - /** - The source object (in the form `bucket`/`key`) for the copy operation. - - ~~~ - // Examples - attributes[.awsS3CopySource] = "someFile.yml" - ~~~ - - - Note: The `copy_source` attribute applies to S3 copy operations and corresponds to the `--copy-source` parameter - of the [copy-object operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). - This applies in particular to the following operations: - - - [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). - - Requires: Value type should be `String` - */ - case awsS3CopySource = "aws.s3.copy_source" - /** - Upload ID that identifies the multipart upload. - - ~~~ - // Examples - attributes[.awsS3UploadId] = "dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ" - ~~~ - - - Note: The `upload_id` attribute applies to S3 multipart-upload operations and corresponds to the `--upload-id` parameter - of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) multipart operations. - This applies in particular to the following operations: - - - [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - - [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - - [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - - [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). - - Requires: Value type should be `String` - */ - case awsS3UploadId = "aws.s3.upload_id" - /** - The delete request container that specifies the objects to be deleted. - - ~~~ - // Examples - attributes[.awsS3Delete] = "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean" - ~~~ - - - Note: The `delete` attribute is only applicable to the [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) operation. - The `delete` attribute corresponds to the `--delete` parameter of the - [delete-objects operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). - - Requires: Value type should be `String` - */ - case awsS3Delete = "aws.s3.delete" - /** - The part number of the part being uploaded in a multipart-upload operation. This is a positive integer between 1 and 10,000. - - ~~~ - // Examplesattributes[.awsS3PartNumber] = 3456 - ~~~ - - - Note: The `part_number` attribute is only applicable to the [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - and [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) operations. - The `part_number` attribute corresponds to the `--part-number` parameter of the - [upload-part operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). - - Requires: Value type should be `Int` - */ - case awsS3PartNumber = "aws.s3.part_number" - /** - The name of the operation being executed. - - ~~~ - // Examples - attributes[.graphqlOperationName] = "findBookById" - ~~~ - - Requires: Value type should be `String` - */ - case graphqlOperationName = "graphql.operation.name" - /** - The type of the operation being executed. - - ~~~ - // Examples - attributes[.graphqlOperationType] = "query" - attributes[.graphqlOperationType] = "mutation" - attributes[.graphqlOperationType] = "subscription" - ~~~ - - Requires: Value should be one of [`SemanticAttributes.GraphqlOperationTypeValues`](x-source-tag://otelGraphqlOperationTypeValues) (of type `String`) - */ - case graphqlOperationType = "graphql.operation.type" - /** - The GraphQL document being executed. - - ~~~ - // Examples - attributes[.graphqlDocument] = "query findBookById { bookById(id: ?) { name } }" - ~~~ - - - Note: The value may be sanitized to exclude sensitive information. - - Requires: Value type should be `String` - */ - case graphqlDocument = "graphql.document" - /** - RabbitMQ message routing key. - - ~~~ - // Examples - attributes[.messagingRabbitmqDestinationRoutingKey] = "myKey" - ~~~ - - Requires: Value type should be `String` - */ - case messagingRabbitmqDestinationRoutingKey = "messaging.rabbitmq.destination.routing_key" - /** - Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. - - ~~~ - // Examples - attributes[.messagingKafkaMessageKey] = "myKey" - ~~~ - - - Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. - - Requires: Value type should be `String` - */ - case messagingKafkaMessageKey = "messaging.kafka.message.key" - /** - Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. - - ~~~ - // Examples - attributes[.messagingKafkaConsumerGroup] = "my-group" - ~~~ - - Requires: Value type should be `String` - */ - case messagingKafkaConsumerGroup = "messaging.kafka.consumer.group" - /** - Partition the message is sent to. - - ~~~ - // Examplesattributes[.messagingKafkaDestinationPartition] = 2 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingKafkaDestinationPartition = "messaging.kafka.destination.partition" - /** - The offset of a record in the corresponding Kafka partition. - - ~~~ - // Examplesattributes[.messagingKafkaMessageOffset] = 42 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingKafkaMessageOffset = "messaging.kafka.message.offset" - /** - A boolean that is true if the message is a tombstone. - - Requires: Value type should be `Bool` - */ - case messagingKafkaMessageTombstone = "messaging.kafka.message.tombstone" - /** - Namespace of RocketMQ resources, resources in different namespaces are individual. - - ~~~ - // Examples - attributes[.messagingRocketmqNamespace] = "myNamespace" - ~~~ - - Requires: Value type should be `String` - */ - case messagingRocketmqNamespace = "messaging.rocketmq.namespace" - /** - Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. - - ~~~ - // Examples - attributes[.messagingRocketmqClientGroup] = "myConsumerGroup" - ~~~ - - Requires: Value type should be `String` - */ - case messagingRocketmqClientGroup = "messaging.rocketmq.client_group" - /** - The timestamp in milliseconds that the delay message is expected to be delivered to consumer. - - ~~~ - // Examplesattributes[.messagingRocketmqMessageDeliveryTimestamp] = 1665987217045 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingRocketmqMessageDeliveryTimestamp = "messaging.rocketmq.message.delivery_timestamp" - /** - The delay time level for delay message, which determines the message delay time. - - ~~~ - // Examplesattributes[.messagingRocketmqMessageDelayTimeLevel] = 3 - ~~~ - - Requires: Value type should be `Int` - */ - case messagingRocketmqMessageDelayTimeLevel = "messaging.rocketmq.message.delay_time_level" - /** - It is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group. - - ~~~ - // Examples - attributes[.messagingRocketmqMessageGroup] = "myMessageGroup" - ~~~ - - Requires: Value type should be `String` - */ - case messagingRocketmqMessageGroup = "messaging.rocketmq.message.group" - /** - Type of message. - - Requires: Value should be one of [`SemanticAttributes.MessagingRocketmqMessageTypeValues`](x-source-tag://otelMessagingRocketmqMessageTypeValues) (of type `String`) - */ - case messagingRocketmqMessageType = "messaging.rocketmq.message.type" - /** - The secondary classifier of message besides topic. - - ~~~ - // Examples - attributes[.messagingRocketmqMessageTag] = "tagA" - ~~~ - - Requires: Value type should be `String` - */ - case messagingRocketmqMessageTag = "messaging.rocketmq.message.tag" - /** - Key(s) of message, another way to mark message besides message id. - - ~~~ - // Examplesattributes[.messagingRocketmqMessageKeys] = keyAattributes[.messagingRocketmqMessageKeys] = keyB - ~~~ - - Requires: Value type should be `[String]` - */ - case messagingRocketmqMessageKeys = "messaging.rocketmq.message.keys" - /** - Model of message consumption. This only applies to consumer spans. - - Requires: Value should be one of [`SemanticAttributes.MessagingRocketmqConsumptionModelValues`](x-source-tag://otelMessagingRocketmqConsumptionModelValues) (of type `String`) - */ - case messagingRocketmqConsumptionModel = "messaging.rocketmq.consumption_model" - /** - The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. - - Requires: Value should be one of [`SemanticAttributes.RpcGrpcStatusCodeValues`](x-source-tag://otelRpcGrpcStatusCodeValues) (of type `Int`) - */ - case rpcGrpcStatusCode = "rpc.grpc.status_code" - /** - Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. - - ~~~ - // Examples - attributes[.rpcJsonrpcVersion] = "2.0" - attributes[.rpcJsonrpcVersion] = "1.0" - ~~~ - - Requires: Value type should be `String` - */ - case rpcJsonrpcVersion = "rpc.jsonrpc.version" - /** - `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. - - ~~~ - // Examples - attributes[.rpcJsonrpcRequestId] = "10" - attributes[.rpcJsonrpcRequestId] = "request-7" - attributes[.rpcJsonrpcRequestId] = "" - ~~~ - - Requires: Value type should be `String` - */ - case rpcJsonrpcRequestId = "rpc.jsonrpc.request_id" - /** - `error.code` property of response if it is an error response. - - ~~~ - // Examplesattributes[.rpcJsonrpcErrorCode] = -32700attributes[.rpcJsonrpcErrorCode] = 100 - ~~~ - - Requires: Value type should be `Int` - */ - case rpcJsonrpcErrorCode = "rpc.jsonrpc.error_code" - /** - `error.message` property of response if it is an error response. - - ~~~ - // Examples - attributes[.rpcJsonrpcErrorMessage] = "Parse error" - attributes[.rpcJsonrpcErrorMessage] = "User already exists" - ~~~ - - Requires: Value type should be `String` - */ - case rpcJsonrpcErrorMessage = "rpc.jsonrpc.error_message" - /** - Whether this is a received or sent message. - - Requires: Value should be one of [`SemanticAttributes.MessageTypeValues`](x-source-tag://otelMessageTypeValues) (of type `String`) - */ - case messageType = "message.type" - /** - MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. - - - Note: This way we guarantee that the values will be consistent between different implementations. - - Requires: Value type should be `Int` - */ - case messageId = "message.id" - /** - Compressed size of the message in bytes. - - Requires: Value type should be `Int` - */ - case messageCompressedSize = "message.compressed_size" - /** - Uncompressed size of the message in bytes. - - Requires: Value type should be `Int` - */ - case messageUncompressedSize = "message.uncompressed_size" - /** - The [error codes](https://connect.build/docs/protocol/#error-codes) of the Connect request. Error codes are always string values. - - Requires: Value should be one of [`SemanticAttributes.RpcConnectRpcErrorCodeValues`](x-source-tag://otelRpcConnectRpcErrorCodeValues) (of type `String`) - */ - case rpcConnectRpcErrorCode = "rpc.connect_rpc.error_code" - /** - SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. - - - Note: An exception is considered to have escaped (or left) the scope of a span, - if that span is ended while the exception is still logically "in flight". - This may be actually "in flight" in some languages (e.g. if the exception - is passed to a Context manager's `__exit__` method in Python) but will - usually be caught at the point of recording the exception in most languages. - - It is usually not possible to determine at the point where an exception is thrown - whether it will escape the scope of a span. - However, it is trivial to know that an exception - will escape, if one checks for an active exception just before ending the span, - as done in the [example above](#recording-an-exception). - - It follows that an exception may still escape the scope of the span - even if the `exception.escaped` attribute was not set or set to false, - since the event might have been recorded at a time where it was not - clear whether the exception will escape. - - Requires: Value type should be `Bool` - */ - case exceptionEscaped = "exception.escaped" - /** - The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component. - - ~~~ - // Examples - attributes[.urlFragment] = "SemConv" - ~~~ - - Requires: Value type should be `String` - */ - case urlFragment = "url.fragment" - - // MARK: - Manual Definitions - - // Some definitions have not yet been added to the YAML which generates this script. - // As such as we have some manually defined cases. - - /** - An exception event **MUST** be called "exception" as per the [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md). - */ - case exception - - /** - Deprecated, use `network.transport`. - */ - /// - Tag: otelNetTransportValues - public struct NetTransportValues: CustomStringConvertible { - /** - ip_tcp. - */ - public static let ipTcp = NetTransportValues("ip_tcp") - /** - ip_udp. - */ - public static let ipUdp = NetTransportValues("ip_udp") - /** - Named or anonymous pipe. - */ - public static let pipe = NetTransportValues("pipe") - /** - In-process communication. - */ - public static let inproc = NetTransportValues("inproc") - /** - Something else (non IP-based). - */ - public static let other = NetTransportValues("other") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - Deprecated, use `network.transport` and `network.type`. - */ - /// - Tag: otelNetSockFamilyValues - public struct NetSockFamilyValues: CustomStringConvertible { - /** - IPv4 address. - */ - public static let inet = NetSockFamilyValues("inet") - /** - IPv6 address. - */ - public static let inet6 = NetSockFamilyValues("inet6") - /** - Unix domain socket path. - */ - public static let unix = NetSockFamilyValues("unix") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - HTTP request method. - */ - /// - Tag: otelHttpRequestMethodValues - public struct HttpRequestMethodValues: CustomStringConvertible { - /** - CONNECT method. - */ - public static let connect = HttpRequestMethodValues("CONNECT") - /** - DELETE method. - */ - public static let delete = HttpRequestMethodValues("DELETE") - /** - GET method. - */ - public static let get = HttpRequestMethodValues("GET") - /** - HEAD method. - */ - public static let head = HttpRequestMethodValues("HEAD") - /** - OPTIONS method. - */ - public static let options = HttpRequestMethodValues("OPTIONS") - /** - PATCH method. - */ - public static let patch = HttpRequestMethodValues("PATCH") - /** - POST method. - */ - public static let post = HttpRequestMethodValues("POST") - /** - PUT method. - */ - public static let put = HttpRequestMethodValues("PUT") - /** - TRACE method. - */ - public static let trace = HttpRequestMethodValues("TRACE") - /** - Any HTTP method that the instrumentation has no prior knowledge of. - */ - public static let other = HttpRequestMethodValues("_OTHER") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The domain identifies the business context for the events. - */ - /// - Tag: otelEventDomainValues - public struct EventDomainValues: CustomStringConvertible { - /** - Events from browser apps. - */ - public static let browser = EventDomainValues("browser") - /** - Events from mobile apps. - */ - public static let device = EventDomainValues("device") - /** - Events from Kubernetes. - */ - public static let k8s = EventDomainValues("k8s") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The stream associated with the log. See below for a list of well-known values. - */ - /// - Tag: otelLogIostreamValues - public enum LogIostreamValues: String { - /** - Logs from stdout stream. - */ - case stdout - /** - Events from stderr stream. - */ - case stderr - } - - /** - The type of memory. - */ - /// - Tag: otelTypeValues - public enum TypeValues: String { - /** - Heap memory. - */ - case heap - /** - Non-heap memory. - */ - case non_heap - } - - /** - Parent-child Reference type. - */ - /// - Tag: otelOpentracingRefTypeValues - public enum OpentracingRefTypeValues: String { - /** - The parent Span depends on the child Span in some capacity. - */ - case child_of - /** - The parent Span does not depend in any way on the result of the child Span. - */ - case follows_from - } - - /** - An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - */ - /// - Tag: otelDbSystemValues - public struct DbSystemValues: CustomStringConvertible { - /** - Some other SQL database. Fallback only. See notes. - */ - public static let otherSql = DbSystemValues("other_sql") - /** - Microsoft SQL Server. - */ - public static let mssql = DbSystemValues("mssql") - /** - Microsoft SQL Server Compact. - */ - public static let mssqlcompact = DbSystemValues("mssqlcompact") - /** - MySQL. - */ - public static let mysql = DbSystemValues("mysql") - /** - Oracle Database. - */ - public static let oracle = DbSystemValues("oracle") - /** - IBM Db2. - */ - public static let db2 = DbSystemValues("db2") - /** - PostgreSQL. - */ - public static let postgresql = DbSystemValues("postgresql") - /** - Amazon Redshift. - */ - public static let redshift = DbSystemValues("redshift") - /** - Apache Hive. - */ - public static let hive = DbSystemValues("hive") - /** - Cloudscape. - */ - public static let cloudscape = DbSystemValues("cloudscape") - /** - HyperSQL DataBase. - */ - public static let hsqldb = DbSystemValues("hsqldb") - /** - Progress Database. - */ - public static let progress = DbSystemValues("progress") - /** - SAP MaxDB. - */ - public static let maxdb = DbSystemValues("maxdb") - /** - SAP HANA. - */ - public static let hanadb = DbSystemValues("hanadb") - /** - Ingres. - */ - public static let ingres = DbSystemValues("ingres") - /** - FirstSQL. - */ - public static let firstsql = DbSystemValues("firstsql") - /** - EnterpriseDB. - */ - public static let edb = DbSystemValues("edb") - /** - InterSystems Caché. - */ - public static let cache = DbSystemValues("cache") - /** - Adabas (Adaptable Database System). - */ - public static let adabas = DbSystemValues("adabas") - /** - Firebird. - */ - public static let firebird = DbSystemValues("firebird") - /** - Apache Derby. - */ - public static let derby = DbSystemValues("derby") - /** - FileMaker. - */ - public static let filemaker = DbSystemValues("filemaker") - /** - Informix. - */ - public static let informix = DbSystemValues("informix") - /** - InstantDB. - */ - public static let instantdb = DbSystemValues("instantdb") - /** - InterBase. - */ - public static let interbase = DbSystemValues("interbase") - /** - MariaDB. - */ - public static let mariadb = DbSystemValues("mariadb") - /** - Netezza. - */ - public static let netezza = DbSystemValues("netezza") - /** - Pervasive PSQL. - */ - public static let pervasive = DbSystemValues("pervasive") - /** - PointBase. - */ - public static let pointbase = DbSystemValues("pointbase") - /** - SQLite. - */ - public static let sqlite = DbSystemValues("sqlite") - /** - Sybase. - */ - public static let sybase = DbSystemValues("sybase") - /** - Teradata. - */ - public static let teradata = DbSystemValues("teradata") - /** - Vertica. - */ - public static let vertica = DbSystemValues("vertica") - /** - H2. - */ - public static let h2 = DbSystemValues("h2") - /** - ColdFusion IMQ. - */ - public static let coldfusion = DbSystemValues("coldfusion") - /** - Apache Cassandra. - */ - public static let cassandra = DbSystemValues("cassandra") - /** - Apache HBase. - */ - public static let hbase = DbSystemValues("hbase") - /** - MongoDB. - */ - public static let mongodb = DbSystemValues("mongodb") - /** - Redis. - */ - public static let redis = DbSystemValues("redis") - /** - Couchbase. - */ - public static let couchbase = DbSystemValues("couchbase") - /** - CouchDB. - */ - public static let couchdb = DbSystemValues("couchdb") - /** - Microsoft Azure Cosmos DB. - */ - public static let cosmosdb = DbSystemValues("cosmosdb") - /** - Amazon DynamoDB. - */ - public static let dynamodb = DbSystemValues("dynamodb") - /** - Neo4j. - */ - public static let neo4j = DbSystemValues("neo4j") - /** - Apache Geode. - */ - public static let geode = DbSystemValues("geode") - /** - Elasticsearch. - */ - public static let elasticsearch = DbSystemValues("elasticsearch") - /** - Memcached. - */ - public static let memcached = DbSystemValues("memcached") - /** - CockroachDB. - */ - public static let cockroachdb = DbSystemValues("cockroachdb") - /** - OpenSearch. - */ - public static let opensearch = DbSystemValues("opensearch") - /** - ClickHouse. - */ - public static let clickhouse = DbSystemValues("clickhouse") - /** - Cloud Spanner. - */ - public static let spanner = DbSystemValues("spanner") - /** - Trino. - */ - public static let trino = DbSystemValues("trino") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - [OSI Transport Layer](https://osi-model.com/transport-layer/) or [Inter-process Communication method](https://en.wikipedia.org/wiki/Inter-process_communication). The value SHOULD be normalized to lowercase. - */ - /// - Tag: otelNetworkTransportValues - public struct NetworkTransportValues: CustomStringConvertible { - /** - TCP. - */ - public static let tcp = NetworkTransportValues("tcp") - /** - UDP. - */ - public static let udp = NetworkTransportValues("udp") - /** - Named or anonymous pipe. See note below. - */ - public static let pipe = NetworkTransportValues("pipe") - /** - Unix domain socket. - */ - public static let unix = NetworkTransportValues("unix") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - [OSI Network Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. - */ - /// - Tag: otelNetworkTypeValues - public struct NetworkTypeValues: CustomStringConvertible { - /** - IPv4. - */ - public static let ipv4 = NetworkTypeValues("ipv4") - /** - IPv6. - */ - public static let ipv6 = NetworkTypeValues("ipv6") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - */ - /// - Tag: otelDbCassandraConsistencyLevelValues - public enum DbCassandraConsistencyLevelValues: String { - /** - all. - */ - case all - /** - each_quorum. - */ - case each_quorum - /** - quorum. - */ - case quorum - /** - local_quorum. - */ - case local_quorum - /** - one. - */ - case one - /** - two. - */ - case two - /** - three. - */ - case three - /** - local_one. - */ - case local_one - /** - any. - */ - case any - /** - serial. - */ - case serial - /** - local_serial. - */ - case local_serial - } - - /** - CosmosDB Operation Type. - */ - /// - Tag: otelDbCosmosdbOperationTypeValues - public struct DbCosmosdbOperationTypeValues: CustomStringConvertible { - /** - invalid. - */ - public static let invalid = DbCosmosdbOperationTypeValues("Invalid") - /** - create. - */ - public static let create = DbCosmosdbOperationTypeValues("Create") - /** - patch. - */ - public static let patch = DbCosmosdbOperationTypeValues("Patch") - /** - read. - */ - public static let read = DbCosmosdbOperationTypeValues("Read") - /** - read_feed. - */ - public static let readFeed = DbCosmosdbOperationTypeValues("ReadFeed") - /** - delete. - */ - public static let delete = DbCosmosdbOperationTypeValues("Delete") - /** - replace. - */ - public static let replace = DbCosmosdbOperationTypeValues("Replace") - /** - execute. - */ - public static let execute = DbCosmosdbOperationTypeValues("Execute") - /** - query. - */ - public static let query = DbCosmosdbOperationTypeValues("Query") - /** - head. - */ - public static let head = DbCosmosdbOperationTypeValues("Head") - /** - head_feed. - */ - public static let headFeed = DbCosmosdbOperationTypeValues("HeadFeed") - /** - upsert. - */ - public static let upsert = DbCosmosdbOperationTypeValues("Upsert") - /** - batch. - */ - public static let batch = DbCosmosdbOperationTypeValues("Batch") - /** - query_plan. - */ - public static let queryPlan = DbCosmosdbOperationTypeValues("QueryPlan") - /** - execute_javascript. - */ - public static let executeJavascript = DbCosmosdbOperationTypeValues("ExecuteJavaScript") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - Cosmos client connection mode. - */ - /// - Tag: otelDbCosmosdbConnectionModeValues - public enum DbCosmosdbConnectionModeValues: String { - /** - Gateway (HTTP) connections mode. - */ - case gateway - /** - Direct connection. - */ - case direct - } - - /** - Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. - */ - /// - Tag: otelOtelStatusCodeValues - public enum OtelStatusCodeValues: String { - /** - The operation has been validated by an Application developer or Operator to have completed successfully. - */ - case ok = "OK" - /** - The operation contains an error. - */ - case error = "ERROR" - } - - /** - Type of the trigger which caused this function invocation. - */ - /// - Tag: otelFaasTriggerValues - public enum FaasTriggerValues: String { - /** - A response to some data source operation such as a database or filesystem read/write. - */ - case datasource - /** - To provide an answer to an inbound HTTP request. - */ - case http - /** - A function is set to be executed when messages are sent to a messaging system. - */ - case pubsub - /** - A function is scheduled to be executed regularly. - */ - case timer - /** - If none of the others apply. - */ - case other - } - - /** - Describes the type of the operation that was performed on the data. - */ - /// - Tag: otelFaasDocumentOperationValues - public struct FaasDocumentOperationValues: CustomStringConvertible { - /** - When a new object is created. - */ - public static let insert = FaasDocumentOperationValues("insert") - /** - When an object is modified. - */ - public static let edit = FaasDocumentOperationValues("edit") - /** - When an object is deleted. - */ - public static let delete = FaasDocumentOperationValues("delete") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - A string identifying the kind of messaging operation as defined in the [Operation names](#operation-names) section above. - */ - /// - Tag: otelMessagingOperationValues - public struct MessagingOperationValues: CustomStringConvertible { - /** - publish. - */ - public static let publish = MessagingOperationValues("publish") - /** - receive. - */ - public static let receive = MessagingOperationValues("receive") - /** - process. - */ - public static let process = MessagingOperationValues("process") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The cloud provider of the invoked function. - */ - /// - Tag: otelFaasInvokedProviderValues - public struct FaasInvokedProviderValues: CustomStringConvertible { - /** - Alibaba Cloud. - */ - public static let alibabaCloud = FaasInvokedProviderValues("alibaba_cloud") - /** - Amazon Web Services. - */ - public static let aws = FaasInvokedProviderValues("aws") - /** - Microsoft Azure. - */ - public static let azure = FaasInvokedProviderValues("azure") - /** - Google Cloud Platform. - */ - public static let gcp = FaasInvokedProviderValues("gcp") - /** - Tencent Cloud. - */ - public static let tencentCloud = FaasInvokedProviderValues("tencent_cloud") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The internet connection type. - */ - /// - Tag: otelNetworkConnectionTypeValues - public struct NetworkConnectionTypeValues: CustomStringConvertible { - /** - wifi. - */ - public static let wifi = NetworkConnectionTypeValues("wifi") - /** - wired. - */ - public static let wired = NetworkConnectionTypeValues("wired") - /** - cell. - */ - public static let cell = NetworkConnectionTypeValues("cell") - /** - unavailable. - */ - public static let unavailable = NetworkConnectionTypeValues("unavailable") - /** - unknown. - */ - public static let unknown = NetworkConnectionTypeValues("unknown") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. - */ - /// - Tag: otelNetworkConnectionSubtypeValues - public struct NetworkConnectionSubtypeValues: CustomStringConvertible { - /** - GPRS. - */ - public static let gprs = NetworkConnectionSubtypeValues("gprs") - /** - EDGE. - */ - public static let edge = NetworkConnectionSubtypeValues("edge") - /** - UMTS. - */ - public static let umts = NetworkConnectionSubtypeValues("umts") - /** - CDMA. - */ - public static let cdma = NetworkConnectionSubtypeValues("cdma") - /** - EVDO Rel. 0. - */ - public static let evdo0 = NetworkConnectionSubtypeValues("evdo_0") - /** - EVDO Rev. A. - */ - public static let evdoA = NetworkConnectionSubtypeValues("evdo_a") - /** - CDMA2000 1XRTT. - */ - public static let cdma20001xrtt = NetworkConnectionSubtypeValues("cdma2000_1xrtt") - /** - HSDPA. - */ - public static let hsdpa = NetworkConnectionSubtypeValues("hsdpa") - /** - HSUPA. - */ - public static let hsupa = NetworkConnectionSubtypeValues("hsupa") - /** - HSPA. - */ - public static let hspa = NetworkConnectionSubtypeValues("hspa") - /** - IDEN. - */ - public static let iden = NetworkConnectionSubtypeValues("iden") - /** - EVDO Rev. B. - */ - public static let evdoB = NetworkConnectionSubtypeValues("evdo_b") - /** - LTE. - */ - public static let lte = NetworkConnectionSubtypeValues("lte") - /** - EHRPD. - */ - public static let ehrpd = NetworkConnectionSubtypeValues("ehrpd") - /** - HSPAP. - */ - public static let hspap = NetworkConnectionSubtypeValues("hspap") - /** - GSM. - */ - public static let gsm = NetworkConnectionSubtypeValues("gsm") - /** - TD-SCDMA. - */ - public static let tdScdma = NetworkConnectionSubtypeValues("td_scdma") - /** - IWLAN. - */ - public static let iwlan = NetworkConnectionSubtypeValues("iwlan") - /** - 5G NR (New Radio). - */ - public static let nr = NetworkConnectionSubtypeValues("nr") - /** - 5G NRNSA (New Radio Non-Standalone). - */ - public static let nrnsa = NetworkConnectionSubtypeValues("nrnsa") - /** - LTE CA. - */ - public static let lteCa = NetworkConnectionSubtypeValues("lte_ca") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The value `aws-api`. - */ - /// - Tag: otelRpcSystemValues - public struct RpcSystemValues: CustomStringConvertible { - /** - gRPC. - */ - public static let grpc = RpcSystemValues("grpc") - /** - Java RMI. - */ - public static let javaRmi = RpcSystemValues("java_rmi") - /** - .NET WCF. - */ - public static let dotnetWcf = RpcSystemValues("dotnet_wcf") - /** - Apache Dubbo. - */ - public static let apacheDubbo = RpcSystemValues("apache_dubbo") - /** - Connect RPC. - */ - public static let connectRpc = RpcSystemValues("connect_rpc") - - let value: String - - public init(_ customValue: String) { - value = customValue - } - - public var description: String { - return value - } - } - - /** - The type of the operation being executed. - */ - /// - Tag: otelGraphqlOperationTypeValues - public enum GraphqlOperationTypeValues: String { - /** - GraphQL query. - */ - case query - /** - GraphQL mutation. - */ - case mutation - /** - GraphQL subscription. - */ - case subscription - } - - /** - Type of message. - */ - /// - Tag: otelMessagingRocketmqMessageTypeValues - public enum MessagingRocketmqMessageTypeValues: String { - /** - Normal message. - */ - case normal - /** - FIFO message. - */ - case fifo - /** - Delay message. - */ - case delay - /** - Transaction message. - */ - case transaction - } - - /** - Model of message consumption. This only applies to consumer spans. - */ - /// - Tag: otelMessagingRocketmqConsumptionModelValues - public enum MessagingRocketmqConsumptionModelValues: String { - /** - Clustering consumption model. - */ - case clustering - /** - Broadcasting consumption model. - */ - case broadcasting - } - - /** - The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. - */ - /// - Tag: otelRpcGrpcStatusCodeValues - public enum RpcGrpcStatusCodeValues: Int { - /** - OK. - */ - case ok = 0 - /** - CANCELLED. - */ - case cancelled = 1 - /** - UNKNOWN. - */ - case unknown = 2 - /** - INVALID_ARGUMENT. - */ - case invalid_argument = 3 - /** - DEADLINE_EXCEEDED. - */ - case deadline_exceeded = 4 - /** - NOT_FOUND. - */ - case not_found = 5 - /** - ALREADY_EXISTS. - */ - case already_exists = 6 - /** - PERMISSION_DENIED. - */ - case permission_denied = 7 - /** - RESOURCE_EXHAUSTED. - */ - case resource_exhausted = 8 - /** - FAILED_PRECONDITION. - */ - case failed_precondition = 9 - /** - ABORTED. - */ - case aborted = 10 - /** - OUT_OF_RANGE. - */ - case out_of_range = 11 - /** - UNIMPLEMENTED. - */ - case unimplemented = 12 - /** - INTERNAL. - */ - case `internal` = 13 - /** - UNAVAILABLE. - */ - case unavailable = 14 - /** - DATA_LOSS. - */ - case data_loss = 15 - /** - UNAUTHENTICATED. - */ - case unauthenticated = 16 - } - - /** - Whether this is a received or sent message. - */ - /// - Tag: otelMessageTypeValues - public enum MessageTypeValues: String { - /** - sent. - */ - case sent = "SENT" - /** - received. - */ - case received = "RECEIVED" - } - - /** - The [error codes](https://connect.build/docs/protocol/#error-codes) of the Connect request. Error codes are always string values. - */ - /// - Tag: otelRpcConnectRpcErrorCodeValues - public enum RpcConnectRpcErrorCodeValues: String { - /** - cancelled. - */ - case cancelled - /** - unknown. - */ - case unknown - /** - invalid_argument. - */ - case invalid_argument - /** - deadline_exceeded. - */ - case deadline_exceeded - /** - not_found. - */ - case not_found - /** - already_exists. - */ - case already_exists - /** - permission_denied. - */ - case permission_denied - /** - resource_exhausted. - */ - case resource_exhausted - /** - failed_precondition. - */ - case failed_precondition - /** - aborted. - */ - case aborted - /** - out_of_range. - */ - case out_of_range - /** - unimplemented. - */ - case unimplemented - /** - internal. - */ - case `internal` - /** - unavailable. - */ - case unavailable - /** - data_loss. - */ - case data_loss - /** - unauthenticated. - */ - case unauthenticated - } -} diff --git a/Sources/OpenTelemetryApi/Trace/Span.swift b/Sources/OpenTelemetryApi/Trace/Span.swift index a1859059..d5c30a4b 100644 --- a/Sources/OpenTelemetryApi/Trace/Span.swift +++ b/Sources/OpenTelemetryApi/Trace/Span.swift @@ -156,23 +156,7 @@ public extension SpanBase { return setAttribute(key: key.rawValue, value: AttributeValue.bool(value)) } - @available(*, deprecated, message: "parameter SemanticAttributes is deprecated. Use SemanticConventions.") - func setAttribute(key: SemanticAttributes, value: String) { - return setAttribute(key: key.rawValue, value: AttributeValue.string(value)) - } - @available(*, deprecated, message: "parameter SemanticAttributes is deprecated. Use SemanticConventions.") - func setAttribute(key: SemanticAttributes, value: Int) { - return setAttribute(key: key.rawValue, value: AttributeValue.int(value)) - } - @available(*, deprecated, message: "parameter SemanticAttributes is deprecated. Use SemanticConventions.") - func setAttribute(key: SemanticAttributes, value: Double) { - return setAttribute(key: key.rawValue, value: AttributeValue.double(value)) - } - @available(*, deprecated, message: "parameter SemanticAttributes is deprecated. Use SemanticConventions.") - func setAttribute(key: SemanticAttributes, value: Bool) { - return setAttribute(key: key.rawValue, value: AttributeValue.bool(value)) - } } public extension SpanExceptionRecorder { diff --git a/Sources/OpenTelemetryApi/Trace/SpanId.swift b/Sources/OpenTelemetryApi/Trace/SpanId.swift index e1af6594..fb6579db 100644 --- a/Sources/OpenTelemetryApi/Trace/SpanId.swift +++ b/Sources/OpenTelemetryApi/Trace/SpanId.swift @@ -7,7 +7,7 @@ import Foundation /// A struct that represents a span identifier. A valid span identifier is an 8-byte array with at /// least one non-zero byte. -public struct SpanId: Equatable, Comparable, Hashable, CustomStringConvertible, Codable { +public struct SpanId: Equatable, Comparable, Hashable, CustomStringConvertible, Codable, Sendable { public static let size = 8 public static let invalidId: UInt64 = 0 public static let invalid = SpanId(id: invalidId) diff --git a/Sources/OpenTelemetryApi/Trace/TraceFlags.swift b/Sources/OpenTelemetryApi/Trace/TraceFlags.swift index 2915008f..5a5d384b 100644 --- a/Sources/OpenTelemetryApi/Trace/TraceFlags.swift +++ b/Sources/OpenTelemetryApi/Trace/TraceFlags.swift @@ -8,7 +8,7 @@ import Foundation /// A struct that represents global trace options. These options are propagated to all child spans. /// These determine features such as whether a Span should be traced. It is /// implemented as a bitmask. -public struct TraceFlags: Equatable, CustomStringConvertible, Codable { +public struct TraceFlags: Equatable, CustomStringConvertible, Codable, Sendable { /// Default options. Nothing set. private static let defaultOptions: UInt8 = 0 /// Bit to represent whether trace is sampled or not. diff --git a/Sources/OpenTelemetryApi/Trace/TraceId.swift b/Sources/OpenTelemetryApi/Trace/TraceId.swift index f4fdc885..7ae7d2a7 100644 --- a/Sources/OpenTelemetryApi/Trace/TraceId.swift +++ b/Sources/OpenTelemetryApi/Trace/TraceId.swift @@ -7,9 +7,10 @@ import Foundation /// A struct that represents a trace identifier. A valid trace identifier is a 16-byte array with at /// least one non-zero byte. -public struct TraceId: Comparable, Hashable, CustomStringConvertible, Equatable, Codable { +public struct TraceId: Comparable, Hashable, CustomStringConvertible, Equatable, Codable, Sendable { public static let size = 16 public static let invalidId: UInt64 = 0 + public static let invalid = TraceId() // The internal representation of the TraceId. diff --git a/Sources/OpenTelemetryConcurrency/OpenTelemetry.swift b/Sources/OpenTelemetryConcurrency/OpenTelemetry.swift index 2813f2f4..d294d17d 100644 --- a/Sources/OpenTelemetryConcurrency/OpenTelemetry.swift +++ b/Sources/OpenTelemetryConcurrency/OpenTelemetry.swift @@ -9,7 +9,7 @@ import OpenTelemetryApi typealias _OpenTelemetry = OpenTelemetryApi.OpenTelemetry /// A wrapper type which provides a span builder just like `Tracer`, returns a type of `SpanBuilderBase` to hide APIs on `SpanBuilder` that aren't correctly usable when using a structured concurrency based context manager. -public struct TracerWrapper { +public struct TracerWrapper: @unchecked Sendable { /// The inner `Tracer` used to construct a span builder. Be careful when accessing this property, as it may make it easier to use API's that don't function properly with your configuration. public let inner: Tracer @@ -19,7 +19,7 @@ public struct TracerWrapper { } /// A wrapper type which provides a `Tracer` just like `TracerProvider`, but wraps it in a `TracerWrapper` to hide APIs on `SpanBuilder` that aren't correctly usable when using a structured concurrency based context manager. -public struct TracerProviderWrapper { +public struct TracerProviderWrapper: @unchecked Sendable { /// The inner `TracerProvider` used to construct a `Tracer`. Be careful when accessing this property, as it may make it easier to use API's that don't function properly with your configuration. public let inner: TracerProvider @@ -118,7 +118,7 @@ public struct OpenTelemetry: Sendable { } @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) -public struct OpenTelemetryContextProvider { +public struct OpenTelemetryContextProvider: @unchecked Sendable { var contextManager: ContextManager /// Returns the Span from the current context diff --git a/Sources/OpenTelemetrySdk/Common/InstrumentationLibraryInfo.swift b/Sources/OpenTelemetrySdk/Common/InstrumentationLibraryInfo.swift index 425cce0f..3264c105 100644 --- a/Sources/OpenTelemetrySdk/Common/InstrumentationLibraryInfo.swift +++ b/Sources/OpenTelemetrySdk/Common/InstrumentationLibraryInfo.swift @@ -8,7 +8,7 @@ import OpenTelemetryApi /// Holds information about the instrumentation library specified when creating an instance of /// TracerSdk using TracerProviderSdk. -public struct InstrumentationScopeInfo: Hashable, Codable, Equatable { +public struct InstrumentationScopeInfo: Hashable, Codable, Equatable, Sendable { public private(set) var name: String = "" public private(set) var version: String? public private(set) var schemaUrl: String? diff --git a/Sources/OpenTelemetrySdk/Logs/Data/ReadableLogRecord.swift b/Sources/OpenTelemetrySdk/Logs/Data/ReadableLogRecord.swift index 0d174ef4..54d36b24 100644 --- a/Sources/OpenTelemetrySdk/Logs/Data/ReadableLogRecord.swift +++ b/Sources/OpenTelemetrySdk/Logs/Data/ReadableLogRecord.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public struct ReadableLogRecord: Codable { +public struct ReadableLogRecord: Codable, @unchecked Sendable { public init(resource: Resource, instrumentationScopeInfo: InstrumentationScopeInfo, timestamp: Date, observedTimestamp: Date? = nil, spanContext: SpanContext? = nil, severity: Severity? = nil, body: AttributeValue? = nil, attributes: [String: AttributeValue], eventName: String? = nil) { self.resource = resource self.instrumentationScopeInfo = instrumentationScopeInfo diff --git a/Sources/OpenTelemetrySdk/Logs/Export/NoopLogRecordExporter.swift b/Sources/OpenTelemetrySdk/Logs/Export/NoopLogRecordExporter.swift index 540a88c7..051c8a8a 100644 --- a/Sources/OpenTelemetrySdk/Logs/Export/NoopLogRecordExporter.swift +++ b/Sources/OpenTelemetrySdk/Logs/Export/NoopLogRecordExporter.swift @@ -5,7 +5,7 @@ import Foundation -public class NoopLogRecordExporter: LogRecordExporter { +public final class NoopLogRecordExporter: LogRecordExporter, @unchecked Sendable { public static let instance = NoopLogRecordExporter() public func export(logRecords: [ReadableLogRecord], explicitTimeout: TimeInterval? = nil) -> ExportResult { diff --git a/Sources/OpenTelemetrySdk/Logs/LoggerProviderSdk.swift b/Sources/OpenTelemetrySdk/Logs/LoggerProviderSdk.swift index b6300f21..8d050cbf 100644 --- a/Sources/OpenTelemetrySdk/Logs/LoggerProviderSdk.swift +++ b/Sources/OpenTelemetrySdk/Logs/LoggerProviderSdk.swift @@ -6,8 +6,8 @@ import Foundation import OpenTelemetryApi -public class LoggerProviderSdk: LoggerProvider { - private var sharedState: LoggerSharedState +public final class LoggerProviderSdk: LoggerProvider, @unchecked Sendable { + private let sharedState: LoggerSharedState private let loggerRegistry: ComponentRegistry public init(clock: Clock = MillisClock(), resource: Resource = EnvVarResource.get(), diff --git a/Sources/OpenTelemetrySdk/Logs/Processors/NoopLogRecordProcessor.swift b/Sources/OpenTelemetrySdk/Logs/Processors/NoopLogRecordProcessor.swift index 634c2827..ab5b6064 100644 --- a/Sources/OpenTelemetrySdk/Logs/Processors/NoopLogRecordProcessor.swift +++ b/Sources/OpenTelemetrySdk/Logs/Processors/NoopLogRecordProcessor.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class NoopLogRecordProcessor: LogRecordProcessor { +public final class NoopLogRecordProcessor: LogRecordProcessor, @unchecked Sendable { public static let noopLogRecordProcessor = NoopLogRecordProcessor() public func onEmit(logRecord: ReadableLogRecord) {} diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/AggregationSelector.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/AggregationSelector.swift index d7c79713..2d152031 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/AggregationSelector.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/AggregationSelector.swift @@ -12,7 +12,7 @@ public protocol DefaultAggregationSelector { func getDefaultAggregation(for instrument: InstrumentType) -> Aggregation } -public class AggregationSelector: DefaultAggregationSelector { +public final class AggregationSelector: DefaultAggregationSelector, @unchecked Sendable { public static let instance = AggregationSelector() public let selector: AggregationResolver diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/Base2ExponentialHistogramAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/Base2ExponentialHistogramAggregation.swift index e778775a..140d5458 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/Base2ExponentialHistogramAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/Base2ExponentialHistogramAggregation.swift @@ -6,11 +6,11 @@ import Foundation import OpenTelemetryApi -public class Base2ExponentialHistogramAggregation: Aggregation { +public final class Base2ExponentialHistogramAggregation: Aggregation, @unchecked Sendable { private static let defaultMaxBuckets = 160 private static let defaultMaxScale = 20 - public private(set) static var instance = Base2ExponentialHistogramAggregation(maxBuckets: defaultMaxBuckets, maxScale: defaultMaxScale) + public static let instance = Base2ExponentialHistogramAggregation(maxBuckets: defaultMaxBuckets, maxScale: defaultMaxScale) let maxBuckets: Int let maxScale: Int diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DefaultAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DefaultAggregation.swift index 21579a0f..2f7463bf 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DefaultAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DefaultAggregation.swift @@ -5,8 +5,8 @@ import Foundation -public class DefaultAggregation: Aggregation { - public private(set) static var instance = DefaultAggregation() +public final class DefaultAggregation: Aggregation, @unchecked Sendable { + public static let instance = DefaultAggregation() public func createAggregator(descriptor: InstrumentDescriptor, exemplarFilter: ExemplarFilter) -> any Aggregator { resolve(for: descriptor).createAggregator(descriptor: descriptor, exemplarFilter: exemplarFilter) diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregation.swift index 5ae84db1..2a618b78 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregation.swift @@ -6,8 +6,8 @@ import Foundation import OpenTelemetryApi -public class DropAggregation: Aggregation { - public private(set) static var instance = DropAggregation() +public final class DropAggregation: Aggregation, @unchecked Sendable { + public static let instance = DropAggregation() public func createAggregator(descriptor: InstrumentDescriptor, exemplarFilter: ExemplarFilter) -> any Aggregator { return DropAggregator() diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregator.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregator.swift index f82daa9b..c4860ab7 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregator.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/DropAggregator.swift @@ -6,8 +6,8 @@ import Foundation import OpenTelemetryApi -public class DropAggregator: Aggregator { - public private(set) static var POINT_DATA = PointData(startEpochNanos: 0, endEpochNanos: 0, attributes: [String: AttributeValue](), exemplars: [ExemplarData]()) +public final class DropAggregator: Aggregator, @unchecked Sendable { + public static let POINT_DATA = PointData(startEpochNanos: 0, endEpochNanos: 0, attributes: [String: AttributeValue](), exemplars: [ExemplarData]()) public func createHandle() -> AggregatorHandle { AggregatorHandle(exemplarReservoir: ExemplarReservoirCollection.doubleNoSamples()) diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/ExplicitBucketHistogramAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/ExplicitBucketHistogramAggregation.swift index 6254cadd..81bdfa5c 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/ExplicitBucketHistogramAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/ExplicitBucketHistogramAggregation.swift @@ -6,9 +6,9 @@ import Foundation import OpenTelemetryApi -public class ExplicitBucketHistogramAggregation: Aggregation { - public private(set) static var DEFAULT_BOUNDARIES: [Double] = [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000, 2_500, 5_000, 7_500] - public private(set) static var instance = ExplicitBucketHistogramAggregation(bucketBoundaries: DEFAULT_BOUNDARIES) +public final class ExplicitBucketHistogramAggregation: Aggregation, @unchecked Sendable { + public static let DEFAULT_BOUNDARIES: [Double] = [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000, 2_500, 5_000, 7_500] + public static let instance = ExplicitBucketHistogramAggregation(bucketBoundaries: DEFAULT_BOUNDARIES) let bucketBoundaries: [Double] diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/LastValueAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/LastValueAggregation.swift index e19b806b..8bafbf3a 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/LastValueAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/LastValueAggregation.swift @@ -6,8 +6,8 @@ import Foundation import OpenTelemetryApi -public class LastValueAggregation: Aggregation { - public private(set) static var instance = LastValueAggregation() +public final class LastValueAggregation: Aggregation, @unchecked Sendable { + public static let instance = LastValueAggregation() public func createAggregator(descriptor: InstrumentDescriptor, exemplarFilter: ExemplarFilter) -> Aggregator { switch descriptor.valueType { diff --git a/Sources/OpenTelemetrySdk/Metrics/Aggregation/SumAggregation.swift b/Sources/OpenTelemetrySdk/Metrics/Aggregation/SumAggregation.swift index b9a8e86e..9f2f9c92 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Aggregation/SumAggregation.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Aggregation/SumAggregation.swift @@ -6,8 +6,8 @@ import Foundation import OpenTelemetryApi -public class SumAggregation: Aggregation { - public private(set) static var instance = SumAggregation() +public final class SumAggregation: Aggregation, @unchecked Sendable { + public static let instance = SumAggregation() public func isCompatible(with descriptor: InstrumentDescriptor) -> Bool { switch descriptor.type { diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/Base2ExponentialHistogramIndexer.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/Base2ExponentialHistogramIndexer.swift index 252065af..cb67fbea 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/Base2ExponentialHistogramIndexer.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/Base2ExponentialHistogramIndexer.swift @@ -6,9 +6,9 @@ import Foundation import OpenTelemetryApi -public class Base2ExponentialHistogramIndexer: Codable { - private static var cache = [Int: Base2ExponentialHistogramIndexer]() - private static var cacheLock = Lock() +public final class Base2ExponentialHistogramIndexer: Codable, @unchecked Sendable { + nonisolated(unsafe) private static var cache = [Int: Base2ExponentialHistogramIndexer]() + nonisolated(unsafe) private static var cacheLock = Lock() private let scale: Int private let scaleFactor: Double diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/DoublePointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/DoublePointData.swift index c80501fc..caeece96 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/DoublePointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/DoublePointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class DoublePointData: PointData, Codable { +public class DoublePointData: PointData, Codable, @unchecked Sendable { public var value: Double enum CodingKeys: String, CodingKey { diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/ExponentialHistogramPointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/ExponentialHistogramPointData.swift index 789e13db..03931f8b 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/ExponentialHistogramPointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/ExponentialHistogramPointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class ExponentialHistogramPointData: PointData, Codable { +public class ExponentialHistogramPointData: PointData, Codable, @unchecked Sendable { public var scale: Int public var sum: Double public var count: Int diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/HistogramPointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/HistogramPointData.swift index 34fb339f..62476b62 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/HistogramPointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/HistogramPointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class HistogramPointData: PointData, Codable { +public class HistogramPointData: PointData, Codable, @unchecked Sendable { public var sum: Double public var count: UInt64 public var min: Double diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/LongPointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/LongPointData.swift index ea1104c8..9920ac46 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/LongPointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/LongPointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class LongPointData: PointData, Codable { +public class LongPointData: PointData, Codable, @unchecked Sendable { public var value: Int enum CodingKeys: String, CodingKey { diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/SummaryPointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/SummaryPointData.swift index 2bd75cc1..5cf533c3 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/Internal/SummaryPointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/Internal/SummaryPointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class SummaryPointData: PointData, Codable { +public class SummaryPointData: PointData, Codable, @unchecked Sendable { public var count: UInt64 public var sum: Double public var values: [ValueAtQuantile] diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/MetricData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/MetricData.swift index 201fe3c1..964e2e66 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/MetricData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/MetricData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public enum MetricDataType: Codable { +public enum MetricDataType: Codable, Sendable { case LongGauge case DoubleGauge case LongSum @@ -19,7 +19,7 @@ public enum MetricDataType: Codable { @available(*, deprecated, renamed: "MetricData") public typealias StableMetricData = MetricData -public struct MetricData: Equatable, Codable { +public struct MetricData: Equatable, Codable, Sendable { public private(set) var resource: Resource public private(set) var instrumentationScopeInfo: InstrumentationScopeInfo public private(set) var name: String @@ -41,7 +41,7 @@ public struct MetricData: Equatable, Codable { .Data(aggregationTemporality: .cumulative, points: [PointData]()) ) - public class Data: Equatable { + public class Data: Equatable, @unchecked Sendable { public private(set) var points: [PointData] public private(set) var aggregationTemporality: AggregationTemporality @@ -270,7 +270,7 @@ extension MetricData { @available(*, deprecated, renamed: "HistogramData") public typealias StableHistogramData = HistogramData -public class HistogramData: MetricData.Data { +public class HistogramData: MetricData.Data, @unchecked Sendable { init(aggregationTemporality: AggregationTemporality, points: [HistogramPointData]) { super.init(aggregationTemporality: aggregationTemporality, points: points) } @@ -279,7 +279,7 @@ public class HistogramData: MetricData.Data { @available(*, deprecated, renamed: "ExponentialHistogramData") public typealias StableExponentialHistogramData = ExponentialHistogramData -public class ExponentialHistogramData: MetricData.Data { +public class ExponentialHistogramData: MetricData.Data, @unchecked Sendable { override init(aggregationTemporality: AggregationTemporality, points: [PointData]) { super.init(aggregationTemporality: aggregationTemporality, points: points) } @@ -288,7 +288,7 @@ public class ExponentialHistogramData: MetricData.Data { @available(*, deprecated, renamed: "GaugeData") public typealias StableGaugeData = GaugeData -public class GaugeData: MetricData.Data { +public class GaugeData: MetricData.Data, @unchecked Sendable { override init(aggregationTemporality: AggregationTemporality, points: [PointData]) { super.init(aggregationTemporality: aggregationTemporality, points: points) } @@ -297,7 +297,7 @@ public class GaugeData: MetricData.Data { @available(*, deprecated, renamed: "SumData") public typealias StableSumData = SumData -public class SumData: MetricData.Data { +public class SumData: MetricData.Data, @unchecked Sendable { override init(aggregationTemporality: AggregationTemporality, points: [PointData]) { super.init(aggregationTemporality: aggregationTemporality, points: points) } @@ -306,7 +306,7 @@ public class SumData: MetricData.Data { @available(*, deprecated, renamed: "SummaryData") public typealias StableSummaryData = SummaryData -public class SummaryData: MetricData.Data { +public class SummaryData: MetricData.Data, @unchecked Sendable { override init(aggregationTemporality: AggregationTemporality, points: [PointData]) { super.init(aggregationTemporality: aggregationTemporality, points: points) } diff --git a/Sources/OpenTelemetrySdk/Metrics/Data/PointData.swift b/Sources/OpenTelemetrySdk/Metrics/Data/PointData.swift index 565ab22d..d5b9e5a8 100644 --- a/Sources/OpenTelemetrySdk/Metrics/Data/PointData.swift +++ b/Sources/OpenTelemetrySdk/Metrics/Data/PointData.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class PointData: Equatable { +public class PointData: Equatable, @unchecked Sendable { init(startEpochNanos: UInt64, endEpochNanos: UInt64, attributes: [String: AttributeValue], exemplars: [ExemplarData]) { self.startEpochNanos = startEpochNanos self.endEpochNanos = endEpochNanos diff --git a/Sources/OpenTelemetrySdk/Metrics/MeterProviderSdk.swift b/Sources/OpenTelemetrySdk/Metrics/MeterProviderSdk.swift index 9e5ae46f..7ba91261 100644 --- a/Sources/OpenTelemetrySdk/Metrics/MeterProviderSdk.swift +++ b/Sources/OpenTelemetrySdk/Metrics/MeterProviderSdk.swift @@ -6,7 +6,7 @@ import Foundation import OpenTelemetryApi -public class MeterProviderError: Error {} +public final class MeterProviderError: Error {} @available(*, deprecated, renamed: "MeterProviderSdk") public typealias StableMeterProviderSdk = MeterProviderSdk diff --git a/Sources/OpenTelemetrySdk/Metrics/RegisteredReader.swift b/Sources/OpenTelemetrySdk/Metrics/RegisteredReader.swift index 2a89e3bb..4eec8eb2 100644 --- a/Sources/OpenTelemetrySdk/Metrics/RegisteredReader.swift +++ b/Sources/OpenTelemetrySdk/Metrics/RegisteredReader.swift @@ -11,7 +11,7 @@ import OpenTelemetryApi public class RegisteredReader: Equatable, Hashable { #if canImport(Darwin) - private(set) static var id_counter: Int32 = 0 + private(set) nonisolated(unsafe) static var id_counter: Int32 = 0 #else private(set) static var id_counter = ManagedAtomic(0) #endif diff --git a/Sources/OpenTelemetrySdk/Metrics/State/EmptyMetricStorage.swift b/Sources/OpenTelemetrySdk/Metrics/State/EmptyMetricStorage.swift index cdec0779..d40afff7 100644 --- a/Sources/OpenTelemetrySdk/Metrics/State/EmptyMetricStorage.swift +++ b/Sources/OpenTelemetrySdk/Metrics/State/EmptyMetricStorage.swift @@ -6,12 +6,12 @@ import Foundation import OpenTelemetryApi -public class EmptyMetricStorage: SynchronousMetricStorageProtocol { +public final class EmptyMetricStorage: SynchronousMetricStorageProtocol, @unchecked Sendable { public func recordLong(value: Int, attributes: [String: OpenTelemetryApi.AttributeValue]) {} public func recordDouble(value: Double, attributes: [String: OpenTelemetryApi.AttributeValue]) {} - public static var instance = EmptyMetricStorage() + public static let instance = EmptyMetricStorage() public var metricDescriptor: MetricDescriptor = .init(name: "", description: "", unit: "") diff --git a/Sources/OpenTelemetrySdk/Metrics/View/AttributeProcessor.swift b/Sources/OpenTelemetrySdk/Metrics/View/AttributeProcessor.swift index fab05dd8..9010a76c 100644 --- a/Sources/OpenTelemetrySdk/Metrics/View/AttributeProcessor.swift +++ b/Sources/OpenTelemetrySdk/Metrics/View/AttributeProcessor.swift @@ -89,7 +89,7 @@ public class JoinedAttributeProcessor: AttributeProcessor { } } -public class NoopAttributeProcessor: AttributeProcessor { +public final class NoopAttributeProcessor: AttributeProcessor, @unchecked Sendable { static let noop = NoopAttributeProcessor() private init() {} public func process(incoming: [String: AttributeValue]) -> [String: AttributeValue] { diff --git a/Sources/OpenTelemetrySdk/Resources/Resource.swift b/Sources/OpenTelemetrySdk/Resources/Resource.swift index be6c459b..76292cac 100644 --- a/Sources/OpenTelemetrySdk/Resources/Resource.swift +++ b/Sources/OpenTelemetrySdk/Resources/Resource.swift @@ -8,7 +8,7 @@ import OpenTelemetryApi /// Resource represents a resource, which capture identifying information about the entities /// for which signals (stats or traces) are reported. -public struct Resource: Equatable, Hashable, Codable { +public struct Resource: Equatable, Hashable, Codable, Sendable { private static let maxLength = 255 /// A dictionary of labels that describe the resource. diff --git a/Sources/OpenTelemetrySdk/Resources/ResourceAttributes.swift b/Sources/OpenTelemetrySdk/Resources/ResourceAttributes.swift index 46d829a7..c785ab90 100644 --- a/Sources/OpenTelemetrySdk/Resources/ResourceAttributes.swift +++ b/Sources/OpenTelemetrySdk/Resources/ResourceAttributes.swift @@ -1166,7 +1166,7 @@ public enum ResourceAttributes: String { Name of the cloud provider. */ /// - Tag: otelCloudProviderValues - public struct CloudProviderValues: CustomStringConvertible { + public struct CloudProviderValues: CustomStringConvertible, Sendable { /** Alibaba Cloud. */ @@ -1211,7 +1211,7 @@ public enum ResourceAttributes: String { The cloud platform in use. */ /// - Tag: otelCloudPlatformValues - public struct CloudPlatformValues: CustomStringConvertible { + public struct CloudPlatformValues: CustomStringConvertible, Sendable { /** Alibaba Cloud Elastic Compute Service. */ @@ -1359,7 +1359,7 @@ public enum ResourceAttributes: String { The CPU architecture the host system is running on. */ /// - Tag: otelHostArchValues - public struct HostArchValues: CustomStringConvertible { + public struct HostArchValues: CustomStringConvertible, Sendable { /** AMD64. */ @@ -1408,7 +1408,7 @@ public enum ResourceAttributes: String { The operating system type. */ /// - Tag: otelOsTypeValues - public struct OsTypeValues: CustomStringConvertible { + public struct OsTypeValues: CustomStringConvertible, Sendable { /** Microsoft Windows. */ @@ -1469,7 +1469,7 @@ public enum ResourceAttributes: String { The language of the telemetry SDK. */ /// - Tag: otelTelemetrySdkLanguageValues - public struct TelemetrySdkLanguageValues: CustomStringConvertible { + public struct TelemetrySdkLanguageValues: CustomStringConvertible, Sendable { /** cpp. */ diff --git a/Sources/OpenTelemetrySdk/Trace/Data/SpanData.swift b/Sources/OpenTelemetrySdk/Trace/Data/SpanData.swift index cf49e268..ac669874 100644 --- a/Sources/OpenTelemetrySdk/Trace/Data/SpanData.swift +++ b/Sources/OpenTelemetrySdk/Trace/Data/SpanData.swift @@ -7,7 +7,7 @@ import Foundation import OpenTelemetryApi /// representation of all data collected by the Span. -public struct SpanData: Equatable, Codable { +public struct SpanData: Equatable, Codable, @unchecked Sendable { /// The trace id for this span. public private(set) var traceId: TraceId @@ -195,7 +195,7 @@ public struct SpanData: Equatable, Codable { public extension SpanData { /// Timed event. - struct Event: Equatable, Codable { + struct Event: Equatable, Codable, @unchecked Sendable { public private(set) var timestamp: Date public private(set) var name: String public private(set) var attributes: [String: AttributeValue] @@ -222,7 +222,7 @@ public extension SpanData { } public extension SpanData { - struct Link: Codable { + struct Link: Codable, @unchecked Sendable { public let context: SpanContext public let attributes: [String: AttributeValue] diff --git a/Sources/OpenTelemetrySdk/Trace/Samplers/Samplers.swift b/Sources/OpenTelemetrySdk/Trace/Samplers/Samplers.swift index 09ab2e3d..55e4c3f1 100644 --- a/Sources/OpenTelemetrySdk/Trace/Samplers/Samplers.swift +++ b/Sources/OpenTelemetrySdk/Trace/Samplers/Samplers.swift @@ -9,9 +9,9 @@ import OpenTelemetryApi /// Struct to access a set of pre-defined Samplers. public enum Samplers { /// A Sampler that always makes a "yes" decision on Span sampling. - public static var alwaysOn: Sampler = AlwaysOnSampler() + public nonisolated(unsafe) static let alwaysOn: Sampler = AlwaysOnSampler() /// Sampler that always makes a "no" decision on Span sampling. - public static var alwaysOff: Sampler = AlwaysOffSampler() + public nonisolated(unsafe) static let alwaysOff: Sampler = AlwaysOffSampler() /// Returns a new TraceIdRatioBased Sampler. The probability of sampling a trace is equal to that /// of the specified probability. /// - Parameter probability: The desired probability of sampling. Must be within [0.0, 1.0]. @@ -34,8 +34,8 @@ public enum Samplers { localParentNotSampled: localParentNotSampled) } - static var alwaysOnDecision: Decision = SimpleDecision(decision: true) - static var alwaysOffDecision: Decision = SimpleDecision(decision: false) + nonisolated(unsafe) static let alwaysOnDecision: Decision = SimpleDecision(decision: true) + nonisolated(unsafe) static let alwaysOffDecision: Decision = SimpleDecision(decision: false) } class AlwaysOnSampler: Sampler { diff --git a/Tests/OpenTelemetryApiTests/Baggage/DefaultBaggageManagerTests.swift b/Tests/OpenTelemetryApiTests/Baggage/DefaultBaggageManagerTests.swift index ddd17e34..ebc40145 100644 --- a/Tests/OpenTelemetryApiTests/Baggage/DefaultBaggageManagerTests.swift +++ b/Tests/OpenTelemetryApiTests/Baggage/DefaultBaggageManagerTests.swift @@ -10,7 +10,7 @@ import OpenTelemetryTestUtils private let key = EntryKey(name: "key")! private let value = EntryValue(string: "value")! -class TestBaggage: Baggage { +final class TestBaggage: Baggage, @unchecked Sendable { static func baggageBuilder() -> BaggageBuilder { EmptyBaggageBuilder() } @@ -34,6 +34,7 @@ class DefaultBaggageManagerTestsInfo: OpenTelemetryContextTestCase { } } +@MainActor class DefaultBaggageManagerTests: DefaultBaggageManagerTestsInfo { func testBuilderMethod() { let builder = defaultBaggageManager.baggageBuilder() @@ -61,6 +62,7 @@ class DefaultBaggageManagerTests: DefaultBaggageManagerTestsInfo { #if canImport(_Concurrency) @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) + @MainActor class DefaultBaggageManagerConcurrency: DefaultBaggageManagerTestsInfo { override var contextManagers: [any ContextManager] { Self.concurrencyContextManagers() @@ -86,6 +88,7 @@ class DefaultBaggageManagerTests: DefaultBaggageManagerTestsInfo { } #endif +@MainActor class DefaultBaggageManagerTestsImperative: DefaultBaggageManagerTestsInfo { override var contextManagers: [any ContextManager] { Self.imperativeContextManagers() @@ -105,11 +108,13 @@ class DefaultBaggageManagerTestsImperative: DefaultBaggageManagerTestsInfo { XCTAssertTrue(defaultBaggageManager.getCurrentBaggage() === baggage) let semaphore = DispatchSemaphore(value: 0) let semaphore2 = DispatchSemaphore(value: 0) - DispatchQueue.global().async { - XCTAssert(self.defaultBaggageManager.getCurrentBaggage() === self.baggage) + let manager = defaultBaggageManager + let testBaggage = baggage + DispatchQueue.global().async { @Sendable in + XCTAssert(manager.getCurrentBaggage() === testBaggage) semaphore2.signal() semaphore.wait() - XCTAssertNil(self.defaultBaggageManager.getCurrentBaggage()) + XCTAssertNil(manager.getCurrentBaggage()) expec.fulfill() } semaphore2.wait() diff --git a/Tests/OpenTelemetryApiTests/Context/ActivityContextManagerTests.swift b/Tests/OpenTelemetryApiTests/Context/ActivityContextManagerTests.swift index 46eec4c6..07a9ac68 100644 --- a/Tests/OpenTelemetryApiTests/Context/ActivityContextManagerTests.swift +++ b/Tests/OpenTelemetryApiTests/Context/ActivityContextManagerTests.swift @@ -8,6 +8,7 @@ import OpenTelemetryTestUtils import XCTest + @MainActor class ActivityContextManagerTests: OpenTelemetryContextTestCase { override var contextManagers: [any ContextManager] { Self.activityContextManagers() @@ -16,7 +17,7 @@ let defaultTracer = DefaultTracer.instance let firstBytes: [UInt8] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, UInt8(ascii: "a")] - var spanContext: SpanContext! + nonisolated(unsafe) var spanContext: SpanContext! override func setUp() { spanContext = SpanContext.create(traceId: TraceId(fromBytes: firstBytes), spanId: SpanId(fromBytes: firstBytes, withOffset: 8), traceFlags: TraceFlags(), traceState: TraceState()) @@ -32,9 +33,11 @@ ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === span1) let expec = expectation(description: "testStartAndEndSpanInAsyncQueue") - DispatchQueue.global().async { - let span2 = self.createSpan(parentSpan: span1, name: "testStartAndEndSpanInAsyncQueue2") - self.endSpanAndValidateContext(span: span2, parentSpan: span1) + let tracer = defaultTracer + DispatchQueue.global().async { @Sendable in + let span2 = tracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncQueue2").startSpan() + ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span2) + span2.end() expec.fulfill() } waitForExpectations(timeout: 30) @@ -49,14 +52,17 @@ XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === span1) let expec = expectation(description: "testStartAndEndSpanInAsyncQueueTwice1") let expec2 = expectation(description: "testStartAndEndSpanInAsyncQueueTwice2") - DispatchQueue.global().async { - let span2 = self.createSpan(parentSpan: span1, name: "testStartAndEndSpanInAsyncQueueTwice2") - self.endSpanAndValidateContext(span: span2, parentSpan: span1) + let tracer = defaultTracer + DispatchQueue.global().async { @Sendable in + let span2 = tracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncQueueTwice2").startSpan() + ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span2) + span2.end() expec.fulfill() } - DispatchQueue.global().async { - let span3 = self.createSpan(parentSpan: span1, name: "testStartAndEndSpanInAsyncQueueTwice3") - self.endSpanAndValidateContext(span: span3, parentSpan: span1) + DispatchQueue.global().async { @Sendable in + let span3 = tracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncQueueTwice3").startSpan() + ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span3) + span3.end() expec2.fulfill() } waitForExpectations(timeout: 30) @@ -134,11 +140,10 @@ let expec = expectation(description: "testStartAndEndSpanInAsyncTaskTwice") Task { XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === span1) - async let one: () = createAsyncSpan(parentSpan: span1, name: "Child1") - async let two: () = createAsyncSpan(parentSpan: span1, name: "Child2") + await createAsyncSpan(parentSpan: span1, name: "Child1") + await createAsyncSpan(parentSpan: span1, name: "Child2") XCTAssert(OpenTelemetry.instance.contextProvider.activeSpan === span1) - await one - await two + expec.fulfill() } waitForExpectations(timeout: 30) @@ -151,11 +156,10 @@ let span1 = defaultTracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncTaskTwice1").startSpan() ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === span1) - async let one: () = createAsyncSpan(parentSpan: span1, name: "Child1") - async let two: () = createAsyncSpan(parentSpan: span1, name: "Child2") + await createAsyncSpan(parentSpan: span1, name: "Child1") + await createAsyncSpan(parentSpan: span1, name: "Child2") XCTAssert(OpenTelemetry.instance.contextProvider.activeSpan === span1) - await one - await two + span1.end() XCTAssert(OpenTelemetry.instance.contextProvider.activeSpan === nil) } @@ -222,9 +226,12 @@ let span1 = defaultTracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncTask1").startSpan() ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) let expec = expectation(description: "testStartAndEndSpanInAsyncTaskWithParent") - Task.detached { + let tracer = defaultTracer + Task.detached { @Sendable in XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === nil) - await self.createAsyncSpan(parentSpan: nil, name: "detachedspan") + let newSpan = tracer.spanBuilder(spanName: "detachedspan").startSpan() + ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: newSpan) + newSpan.end() XCTAssert(OpenTelemetry.instance.contextProvider.activeSpan === nil) expec.fulfill() } @@ -239,9 +246,12 @@ let span1 = defaultTracer.spanBuilder(spanName: "testStartAndEndSpanInAsyncTask1").startSpan() ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) let expec = expectation(description: "testStartAndEndSpanInAsyncTaskWithParent") - Task.detached { + let tracer = defaultTracer + Task.detached { @Sendable in XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === nil) - await self.createAsyncSpan(parentSpan: nil, name: "detachedspan") + let newSpan = tracer.spanBuilder(spanName: "detachedspan").startSpan() + ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: newSpan) + newSpan.end() XCTAssert(OpenTelemetry.instance.contextProvider.activeSpan === nil) expec.fulfill() } @@ -321,26 +331,25 @@ XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === span1) // Add it to one parent in one thread - DispatchQueue.global().async { - let parent1 = self.defaultTracer.spanBuilder(spanName: "parent1").startSpan() + let tracer = defaultTracer + DispatchQueue.global().async { @Sendable in + let parent1 = tracer.spanBuilder(spanName: "parent1").startSpan() ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: parent1) XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === parent1) let activeSpan = ActivityContextManager.instance.getCurrentContextValue(forKey: .span) XCTAssert(activeSpan === parent1) - ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) parent1.end() } // Add it to another parent in another thread - DispatchQueue.global().async { - let parent2 = self.defaultTracer.spanBuilder(spanName: "parent2").startSpan() + DispatchQueue.global().async { @Sendable in + let parent2 = tracer.spanBuilder(spanName: "parent2").startSpan() ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: parent2) XCTAssert(ActivityContextManager.instance.getCurrentContextValue(forKey: .span) === parent2) let activeSpan = ActivityContextManager.instance.getCurrentContextValue(forKey: .span) XCTAssert(activeSpan === parent2) - ActivityContextManager.instance.setCurrentContextValue(forKey: .span, value: span1) parent2.end() } diff --git a/Tests/OpenTelemetryApiTests/Trace/SpanIdTests.swift b/Tests/OpenTelemetryApiTests/Trace/SpanIdTests.swift index 3e0e62df..0405a131 100644 --- a/Tests/OpenTelemetryApiTests/Trace/SpanIdTests.swift +++ b/Tests/OpenTelemetryApiTests/Trace/SpanIdTests.swift @@ -75,7 +75,7 @@ final class SpanIdTests: XCTestCase { XCTAssertEqual(second, try decoder.decode(SpanId.self, from: encoder.encode(second))) } - static var allTests = [ + static let allTests = [ ("testIsValid", testIsValid), ("testFromHexString", testFromHexString), ("testToHexString", testToHexString), diff --git a/Tests/OpenTelemetryApiTests/Trace/TraceIdTests.swift b/Tests/OpenTelemetryApiTests/Trace/TraceIdTests.swift index 069bf9a5..ef3c12a0 100644 --- a/Tests/OpenTelemetryApiTests/Trace/TraceIdTests.swift +++ b/Tests/OpenTelemetryApiTests/Trace/TraceIdTests.swift @@ -105,7 +105,7 @@ final class TraceIdTests: XCTestCase { XCTAssertEqual(short, try decoder.decode(TraceId.self, from: encoder.encode(short))) } - static var allTests = [ + static let allTests = [ ("testInvalidTraceId", testInvalidTraceId), ("testInvalidTraceId", testInvalidTraceId), ("testIsValid", testIsValid), diff --git a/Tests/OpenTelemetryApiTests/Trace/TracestateTests.swift b/Tests/OpenTelemetryApiTests/Trace/TracestateTests.swift index 3f72da5a..d1edea67 100644 --- a/Tests/OpenTelemetryApiTests/Trace/TracestateTests.swift +++ b/Tests/OpenTelemetryApiTests/Trace/TracestateTests.swift @@ -160,7 +160,7 @@ final class TraceStateTests: XCTestCase { XCTAssertEqual(multiValueTraceState, try decoder.decode(TraceState.self, from: encoder.encode(multiValueTraceState))) } - static var allTests = [ + static let allTests = [ ("testGet", testGet), ("testGetEntries", testGetEntries), ("testDisallowsEmptyKey", testDisallowsEmptyKey), diff --git a/Tests/OpenTelemetrySdkTests/ConcurrencyTests.swift b/Tests/OpenTelemetrySdkTests/ConcurrencyTests.swift index 6e437eb8..cd5bb483 100644 --- a/Tests/OpenTelemetrySdkTests/ConcurrencyTests.swift +++ b/Tests/OpenTelemetrySdkTests/ConcurrencyTests.swift @@ -45,24 +45,24 @@ await tracer .spanBuilder(spanName: "basic") .withActiveSpan { _ in + let testTracer = self.tracer await Task.detached { // Detached task doesn't inherit context XCTAssertNil(OpenTelemetry.instance.contextProvider.activeSpan) - let detached = self.tracer.spanBuilder(spanName: "detached").startSpan() + let detached = testTracer.spanBuilder(spanName: "detached").startSpan() XCTAssertNil((detached as! SpanSdk).parentContext) }.value } } - func testTask() async { + nonisolated func testTask() async { await tracer .spanBuilder(spanName: "basic") .withActiveSpan { span in - await Task { - XCTAssertIdentical(OpenTelemetry.instance.contextProvider.activeSpan, span) - let attached = self.tracer.spanBuilder(spanName: "attached").startSpan() - XCTAssertEqual((attached as! SpanSdk).parentContext, (span as! SpanSdk).context) - }.value + let testTracer = self.tracer + XCTAssertIdentical(OpenTelemetry.instance.contextProvider.activeSpan, span) + let attached = testTracer.spanBuilder(spanName: "attached").startSpan() + XCTAssertEqual((attached as! SpanSdk).parentContext, (span as! SpanSdk).context) } } } diff --git a/Tests/OpenTelemetrySdkTests/Trace/SpanBuilderSdkTests.swift b/Tests/OpenTelemetrySdkTests/Trace/SpanBuilderSdkTests.swift index 824f91c9..7802379c 100644 --- a/Tests/OpenTelemetrySdkTests/Trace/SpanBuilderSdkTests.swift +++ b/Tests/OpenTelemetrySdkTests/Trace/SpanBuilderSdkTests.swift @@ -311,17 +311,17 @@ final class SpanBuilderSdkTestImperative: SpanBuilderSdkTestInfo { } #if canImport(os.activity) - import os.activity + @preconcurrency import os.activity // Bridging Obj-C variabled defined as c-macroses. See `activity.h` header. - private let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bitPattern: -2), "_os_activity_current"), + private nonisolated(unsafe) let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bitPattern: -2), "_os_activity_current"), to: os_activity_t.self) @_silgen_name("_os_activity_create") private func _os_activity_create(_ dso: UnsafeRawPointer?, _ description: UnsafePointer, _ parent: Unmanaged?, _ flags: os_activity_flag_t) -> AnyObject! - private let dso = UnsafeMutableRawPointer(mutating: #dsohandle) + private nonisolated(unsafe) let dso = UnsafeMutableRawPointer(mutating: #dsohandle) final class SpanBuilderSdkTestActivity: SpanBuilderSdkTestInfo { override var contextManagers: [any ContextManager] {