ObservabilityMetadata

    Provides type-safe access to the ObservabilityMetadata’s values. This API should ONLY be used inside of accessor implementations.

    Observability.swift:416
    struct ObservabilityMetadata

    End users should use “accessors” the key’s author MUST define rather than using this subscript, following this pattern:

    extension ObservabilityMetadata {
      var testID: String? {
        get {
          self[TestIDKey.self]
        }
        set {
          self[TestIDKey.self] = newValue
        }
      }
    }
    
    enum TestIDKey: ObservabilityMetadataKey {
        typealias Value = String
    }

    This is in order to enforce a consistent style across projects and also allow for fine grained control over who may set and who may get such property. Just access control to the Key type itself lacks such fidelity.

    Note that specific baggage and context types MAY (and usually do), offer also a way to set baggage values, however in the most general case it is not required, as some frameworks may only be able to offer reading.

    Citizens in Basics

    Conformances

    Types

    Show obsolete interfaces (1)

    Hide obsolete interfaces

    Typealiases

    Type members

    Instance members

    Show obsolete interfaces (1)

    Hide obsolete interfaces

    Available in PackageModel

    Type members

    Instance members

    Available in PackageLoading

    Type members

    Instance members

    Available in SPMBuildCore

    Instance members

    Available in PackageRegistry

    Type members