Skip to content

Commit cb24ba3

Browse files
committed
formatting
1 parent 8b522dc commit cb24ba3

File tree

8 files changed

+47
-43
lines changed

8 files changed

+47
-43
lines changed

Sources/Instrumentation/InstrumentationSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum InstrumentationSystem {
5757
/// Returns the globally configured ``InstrumentProtocol``.
5858
///
5959
/// Defaults to a no-op ``InstrumentProtocol`` if ``bootstrap(_:)`` wasn't called before.
60-
public static var instrument: any InstrumentProtocol {
60+
public static var instrument: InstrumentProtocol {
6161
self.lock.withReaderLock { self._instrument }
6262
}
6363
}

Sources/Tracing/InstrumentationSystem+Tracing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension InstrumentationSystem {
2525
public static var tracer: any TracerProtocol {
2626
let found: (any TracerProtocol)? =
2727
(self._findInstrument(where: { $0 is (any TracerProtocol) }) as? (any TracerProtocol))
28-
return found ?? NoOpTracer()
28+
return found ?? NoOpTracer()
2929
}
3030
#endif
3131

Sources/Tracing/NoOpTracer.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ public struct NoOpTracer: LegacyTracerProtocol {
2828
at time: DispatchWallTime,
2929
function: String,
3030
file fileID: String,
31-
line: UInt) -> any SpanProtocol {
31+
line: UInt) -> any SpanProtocol
32+
{
3233
NoOpSpan(baggage: baggage)
3334
}
3435

3536
public func forceFlush() {}
3637

3738
public func inject<Carrier, Inject>(_ baggage: Baggage, into carrier: inout Carrier, using injector: Inject)
38-
where Inject: Injector, Carrier == Inject.Carrier {
39+
where Inject: Injector, Carrier == Inject.Carrier
40+
{
3941
// no-op
4042
}
4143

4244
public func extract<Carrier, Extract>(_ carrier: Carrier, into baggage: inout Baggage, using extractor: Extract)
43-
where Extract: Extractor, Carrier == Extract.Carrier {
45+
where Extract: Extractor, Carrier == Extract.Carrier
46+
{
4447
// no-op
4548
}
4649

@@ -88,7 +91,6 @@ public struct NoOpTracer: LegacyTracerProtocol {
8891

8992
#if swift(>=5.7.0)
9093
extension NoOpTracer: TracerProtocol {
91-
9294
public func startSpan(
9395
_ operationName: String,
9496
baggage: Baggage,
@@ -101,4 +103,4 @@ extension NoOpTracer: TracerProtocol {
101103
NoOpSpan(baggage: baggage)
102104
}
103105
}
104-
#endif
106+
#endif

Sources/Tracing/SpanProtocol.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public protocol SpanProtocol: AnyObject, _SwiftTracingSendableSpan {
9999
/// - SeeAlso: `Span.end()` which automatically uses the "current" time.
100100
// @available(*, deprecated, message: "Use Clock based `end(at:)` instead")
101101
func end(at time: DispatchWallTime)
102-
103102
}
104103

105104
extension SpanProtocol {

Sources/Tracing/Tracer.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ extension Tracer {
4646
)
4747
#else
4848
InstrumentationSystem.legacyTracer.startAnySpan(
49-
operationName,
50-
baggage: baggage,
51-
ofKind: kind,
52-
at: time,
53-
function: function,
54-
file: fileID,
55-
line: line
49+
operationName,
50+
baggage: baggage,
51+
ofKind: kind,
52+
at: time,
53+
function: function,
54+
file: fileID,
55+
line: line
5656
)
5757
#endif
5858
}
@@ -105,7 +105,8 @@ extension Tracer {
105105
ofKind: kind,
106106
function: function,
107107
file: fileID,
108-
line: line) { anySpan in
108+
line: line
109+
) { anySpan in
109110
try operation(anySpan)
110111
}
111112
#else
@@ -114,7 +115,8 @@ extension Tracer {
114115
ofKind: kind,
115116
function: function,
116117
file: fileID,
117-
line: line) { anySpan in
118+
line: line
119+
) { anySpan in
118120
try operation(anySpan)
119121
}
120122
#endif
@@ -136,7 +138,8 @@ extension Tracer {
136138
ofKind: kind,
137139
function: function,
138140
file: fileID,
139-
line: line) { anySpan in
141+
line: line
142+
) { anySpan in
140143
try await operation(anySpan)
141144
}
142145
}
@@ -155,7 +158,8 @@ extension Tracer {
155158
ofKind: kind,
156159
function: function,
157160
file: fileID,
158-
line: line) { anySpan in
161+
line: line
162+
) { anySpan in
159163
try await operation(anySpan)
160164
}
161165
}

Sources/Tracing/TracerProtocol+Legacy.swift

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import Dispatch
1919
// @available(*, deprecated, message: "Use 'TracerProtocol' instead")
2020
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal Baggage
2121
public protocol LegacyTracerProtocol: InstrumentProtocol {
22-
2322
// @available(*, deprecated, message: "Use 'TracerProtocol/startSpan' instead")
2423
func startAnySpan(
2524
_ operationName: String,
@@ -38,15 +37,13 @@ public protocol LegacyTracerProtocol: InstrumentProtocol {
3837
///
3938
/// This function should not block indefinitely, implementations should offer a configurable timeout for flush operations.
4039
func forceFlush()
41-
4240
}
4341

4442
// ==== ------------------------------------------------------------------
4543
// MARK: Legacy implementations for Swift 5.7
4644

4745
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal Baggage
4846
extension LegacyTracerProtocol {
49-
5047
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal Baggage
5148
public func startAnySpan(
5249
_ operationName: String,
@@ -64,7 +61,8 @@ extension LegacyTracerProtocol {
6461
at: time,
6562
function: function,
6663
file: fileID,
67-
line: line)
64+
line: line
65+
)
6866
}
6967

7068
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal Baggage
@@ -110,7 +108,6 @@ extension LegacyTracerProtocol {
110108
throw error // rethrow
111109
}
112110
}
113-
114111
}
115112

116113
#if swift(>=5.7.0)
@@ -135,7 +132,6 @@ extension TracerProtocol {
135132
)
136133
}
137134

138-
139135
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
140136
// @available(*, deprecated, message: "Use 'TracerProtocol/withSpan' instead")
141137
public func withAnySpan<T>(
@@ -151,7 +147,8 @@ extension TracerProtocol {
151147
ofKind: kind,
152148
function: function,
153149
file: fileID,
154-
line: line) { span in
150+
line: line
151+
) { span in
155152
try operation(span)
156153
}
157154
}
@@ -173,7 +170,8 @@ extension TracerProtocol {
173170
ofKind: kind,
174171
function: function,
175172
file: fileID,
176-
line: line) { span in
173+
line: line
174+
) { span in
177175
try await operation(span)
178176
}
179177
}
@@ -193,11 +191,11 @@ extension TracerProtocol {
193191
ofKind: kind,
194192
function: function,
195193
file: fileID,
196-
line: line) { span in
194+
line: line
195+
) { span in
197196
try await operation(span)
198197
}
199198
}
200199
#endif
201-
202200
}
203-
#endif
201+
#endif

Tests/TracingTests/DynamicTracepointTracerTests.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ final class DynamicTracepointTestTracer: LegacyTracerProtocol {
159159
}
160160

161161
func startAnySpan(_ operationName: String,
162-
baggage: InstrumentationBaggage.Baggage,
163-
ofKind kind: Tracing.SpanKind,
164-
at time: DispatchWallTime,
165-
function: String,
166-
file fileID: String,
167-
line: UInt) -> any SpanProtocol
162+
baggage: InstrumentationBaggage.Baggage,
163+
ofKind kind: Tracing.SpanKind,
164+
at time: DispatchWallTime,
165+
function: String,
166+
file fileID: String,
167+
line: UInt) -> any SpanProtocol
168168
{
169169
let tracepoint = TracepointID(function: function, fileID: fileID, line: line)
170170
guard self.shouldRecord(tracepoint: tracepoint) else {
@@ -325,12 +325,13 @@ extension DynamicTracepointTestTracer {
325325
extension DynamicTracepointTestTracer: TracerProtocol {
326326
typealias Span = TracepointSpan
327327
func startSpan(_ operationName: String,
328-
baggage: InstrumentationBaggage.Baggage,
329-
ofKind kind: Tracing.SpanKind,
330-
at time: DispatchWallTime,
331-
function: String,
332-
file fileID: String,
333-
line: UInt) -> TracepointSpan {
328+
baggage: InstrumentationBaggage.Baggage,
329+
ofKind kind: Tracing.SpanKind,
330+
at time: DispatchWallTime,
331+
function: String,
332+
file fileID: String,
333+
line: UInt) -> TracepointSpan
334+
{
334335
let tracepoint = TracepointID(function: function, fileID: fileID, line: line)
335336
guard self.shouldRecord(tracepoint: tracepoint) else {
336337
return TracepointSpan.notRecording(file: fileID, line: line)

Tests/TracingTests/TracerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final class TracerTests: XCTestCase {
6060
func testWithSpan_success() {
6161
guard #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) else {
6262
return
63-
}
63+
}
6464
let tracer = TestTracer()
6565
InstrumentationSystem.bootstrapInternal(tracer)
6666
defer {

0 commit comments

Comments
 (0)