Skip to content

Commit

Permalink
Explicitly depend on LoggingContext version of tracing API (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
slashmo committed Sep 21, 2021
1 parent 7471ed2 commit e4f825f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 112 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
images:
- swift:5.3
- swift:5.4
- swiftlang/swift:nightly-master
container: ${{ matrix.images }}
steps:
Expand All @@ -33,6 +34,7 @@ jobs:
matrix:
images:
- swift:5.3
- swift:5.4
- swiftlang/swift:nightly-master
container: ${{ matrix.images }}
defaults:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
.build/
.swiftpm/
Documentation/
Package.resolved
106 changes: 0 additions & 106 deletions Package.resolved

This file was deleted.

5 changes: 4 additions & 1 deletion Package.swift
Expand Up @@ -8,18 +8,21 @@ let package = Package(
.library(name: "OtlpGRPCSpanExporting", targets: ["OtlpGRPCSpanExporting"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-distributed-tracing.git", from: "0.1.2"),
.package(url: "https://github.com/apple/swift-distributed-tracing.git", .upToNextMinor(from: "0.1.2")),
.package(url: "https://github.com/apple/swift-distributed-tracing-baggage.git", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.0.0"),
],
targets: [
.target(name: "OpenTelemetry", dependencies: [
.product(name: "Tracing", package: "swift-distributed-tracing"),
.product(name: "Baggage", package: "swift-distributed-tracing-baggage"),
.product(name: "NIO", package: "swift-nio"),
]),
.testTarget(name: "OpenTelemetryTests", dependencies: [
.target(name: "OpenTelemetry"),
.product(name: "Tracing", package: "swift-distributed-tracing"),
.product(name: "Baggage", package: "swift-distributed-tracing-baggage"),
]),

.target(name: "OtlpGRPCSpanExporting", dependencies: [
Expand Down
5 changes: 4 additions & 1 deletion README.md
@@ -1,9 +1,12 @@
# OpenTelemetry for Swift

[![Swift 5.3](https://img.shields.io/badge/Swift-5.3-%23f05137)](https://swift.org)
[![Made for Swift Distributed Tracing](https://img.shields.io/badge/Made%20for-Swift%20Distributed%20Tracing-%23f05137)](https://github.com/apple/swift-distributed-tracing)
[![Swift 5.4](https://img.shields.io/badge/Swift-5.4-%23f05137)](https://swift.org)
[![Swift 5.5](https://img.shields.io/badge/Swift-5.5-%23f05137)](https://swift.org)
[![CI](https://github.com/slashmo/opentelemetry-swift/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/slashmo/opentelemetry-swift/actions/workflows/ci.yaml)

[![Made for Swift Distributed Tracing](https://img.shields.io/badge/Made%20for-Swift%20Distributed%20Tracing-%23f05137)](https://github.com/apple/swift-distributed-tracing)

An OpenTelemetry client implementation for Swift.

"OpenTelemetry Swift" builds on top of [Swift Distributed Tracing](https://github.com/apple/swift-distributed-tracing)
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenTelemetry/SpanContext/Baggage+SpanContext.swift
Expand Up @@ -16,10 +16,10 @@ import CoreBaggage
extension Baggage {
public internal(set) var spanContext: OTel.SpanContext? {
get {
self[SpanContextKey]
self[SpanContextKey.self]
}
set {
self[SpanContextKey] = newValue
self[SpanContextKey.self] = newValue
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenTelemetryTests/RecordedSpanTests.swift
Expand Up @@ -26,7 +26,7 @@ final class RecordedSpanTests: XCTestCase {
)
var baggage = Baggage.topLevel
baggage.spanContext = spanContext
baggage[TestBaggageKey] = 42
baggage[TestBaggageKey.self] = 42

let startTime = DispatchWallTime.now()
let endTime = DispatchWallTime.now()
Expand Down Expand Up @@ -59,7 +59,7 @@ final class RecordedSpanTests: XCTestCase {
recordedSpan.baggage.spanContext,
"The baggage of a recorded span should not contain the span context."
)
XCTAssertEqual(recordedSpan.baggage[TestBaggageKey], 42)
XCTAssertEqual(recordedSpan.baggage[TestBaggageKey.self], 42)
XCTAssertEqual(recordedSpan.startTime, startTime)
XCTAssertEqual(recordedSpan.endTime, endTime)
XCTAssertEqual(recordedSpan.attributes, attributes)
Expand Down

0 comments on commit e4f825f

Please sign in to comment.