Skip to content

Commit ccbed11

Browse files
committed
formatting
1 parent bc0e9df commit ccbed11

File tree

6 files changed

+27
-26
lines changed

6 files changed

+27
-26
lines changed

Sources/InMemoryTracing/InMemorySpan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import Tracing
1717

1818
/// A ``Span`` created by the ``InMemoryTracer`` that will be retained in memory when ended.
19-
///
19+
///
2020
/// - SeeAlso: ``InMemoryTracer``
2121
public struct InMemorySpan: Span {
2222
public let context: ServiceContext

Sources/InMemoryTracing/InMemoryTracer.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import Tracing
1717

1818
/// An in-memory implementation of the ``Tracer`` protocol which can be used either in testing,
1919
/// or in manual collecting and interrogating traces within a process, and acting on them programatically.
20-
///
20+
///
2121
/// ### Span lifecycle
2222
/// This tracer does _not_ automatically remove spans once they end.
2323
/// Finished spans are retained and available for inspection using the `finishedSpans` property.
24-
/// Spans which have been started but have not yet been called `Span/end()` on are also available
24+
/// Spans which have been started but have not yet been called `Span/end()` on are also available
2525
/// for inspection using the ``activeSpans`` property.
26-
///
27-
/// Spans are retained by the `InMemoryTracer` until they are explicitly removed, e.g. by using
26+
///
27+
/// Spans are retained by the `InMemoryTracer` until they are explicitly removed, e.g. by using
2828
/// ``popFinishedSpans()`` or any of the `clear...` methods (e.g. ``clearFinishedSpans()``)
2929
public struct InMemoryTracer: Tracer {
3030

@@ -41,15 +41,15 @@ public struct InMemoryTracer: Tracer {
4141
private let _extractions = LockedValueBox<[Extraction]>([])
4242

4343
/// Create a new ``InMemoryTracer``.
44-
///
45-
/// - Parameters:
44+
///
45+
/// - Parameters:
4646
/// - Parameter idGenerator: strategy for generating trace and span identifiers
4747
/// - Parameter idGenerator: strategy for generating trace and span identifiers
4848
public init(
4949
idGenerator: IDGenerator = .incrementing,
5050
recordInjections: Bool = true,
5151
recordExtractions: Bool = true
52-
) {
52+
) {
5353
self.idGenerator = idGenerator
5454
self.recordInjections = recordInjections
5555
self.recordExtractions = recordExtractions
@@ -132,15 +132,15 @@ extension InMemoryTracer {
132132
}
133133

134134
/// Gets, without removing, all the finished spans recorded by this tracer.
135-
///
135+
///
136136
/// - SeeAlso: `popFinishedSpans()`
137137
public var finishedSpans: [FinishedInMemorySpan] {
138138
_finishedSpans.withValue { $0 }
139139
}
140-
140+
141141
/// Returns, and removes, all finished spans recorded by this tracer.
142142
public func popFinishedSpans() -> [FinishedInMemorySpan] {
143-
_finishedSpans.withValue { spans in
143+
_finishedSpans.withValue { spans in
144144
defer { spans = [] }
145145
return spans
146146
}
@@ -235,7 +235,6 @@ extension InMemoryTracer {
235235
_extractions.withValue { $0 }
236236
}
237237

238-
239238
/// Represents a recorded call to the InMemoryTracer's ``Instrument/extract(_:into:using:)`` method.
240239
public struct Extraction: Sendable {
241240
/// The carrier object from which the context values were extracted from,
@@ -251,7 +250,7 @@ extension InMemoryTracer {
251250
extension InMemoryTracer {
252251

253252
/// Can be used to customize how trace and span IDs are generated by the ``InMemoryTracer``.
254-
///
253+
///
255254
/// Defaults to a simple sequential numeric scheme (`span-1`, `span-2`, `trace-1`, `trace-2` etc).
256255
public struct IDGenerator: Sendable {
257256
public let nextTraceID: @Sendable () -> String

Sources/Tracing/Tracer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public func withSpan<T, Instant: TracerInstant>(
349349
#endif
350350

351351
#if compiler(>=6.0)
352-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
352+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
353353
#endif
354354
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
355355
public func withSpan<T, Instant: TracerInstant>(
@@ -425,7 +425,7 @@ public func withSpan<T>(
425425
#endif
426426

427427
#if compiler(>=6.0)
428-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
428+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
429429
#endif
430430
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
431431
public func withSpan<T>(
@@ -502,7 +502,7 @@ public func withSpan<T>(
502502
#endif
503503

504504
#if compiler(>=6.0)
505-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
505+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
506506
#endif
507507
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
508508
public func withSpan<T>(

Sources/Tracing/TracerProtocol+Legacy.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ extension LegacyTracer {
341341

342342
#if compiler(>=6.0)
343343
// swift-format-ignore: Spacing // fights with formatter
344-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
344+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
345345
#endif
346346
public func withAnySpan<T, Instant: TracerInstant>(
347347
_ operationName: String,
@@ -432,7 +432,7 @@ extension LegacyTracer {
432432

433433
#if compiler(>=6.0)
434434
// swift-format-ignore: Spacing // fights with formatter
435-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
435+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
436436
#endif
437437
public func withAnySpan<T>(
438438
_ operationName: String,
@@ -631,7 +631,7 @@ extension Tracer {
631631

632632
#if compiler(>=6.0)
633633
// swift-format-ignore: Spacing // fights with formatter
634-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
634+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
635635
#endif
636636
public func withAnySpan<T>(
637637
_ operationName: String,

Sources/Tracing/TracerProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ extension Tracer {
292292

293293
#if compiler(>=6.0)
294294
// swift-format-ignore: Spacing // fights with formatter
295-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
295+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
296296
#endif
297297
public func withSpan<T>(
298298
_ operationName: String,
@@ -382,7 +382,7 @@ extension Tracer {
382382

383383
#if compiler(>=6.0)
384384
// swift-format-ignore: Spacing // fights with formatter
385-
@_disfavoredOverload@available(*, deprecated, message: "Prefer #isolation version of this API")
385+
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
386386
#endif
387387
public func withSpan<T>(
388388
_ operationName: String,

Tests/InMemoryTracingTests/InMemoryTracerTests.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ struct InMemoryTracerTests {
6565
let childSpan = tracer.startSpan("child", context: rootSpan.context)
6666
#expect(childSpan.isRecording == true)
6767
#expect(childSpan.operationName == "child")
68-
#expect(childSpan.spanContext == InMemorySpanContext(traceID: "trace-1", spanID: "span-2", parentSpanID: "span-1"))
68+
#expect(
69+
childSpan.spanContext == InMemorySpanContext(traceID: "trace-1", spanID: "span-2", parentSpanID: "span-1")
70+
)
6971
#expect(tracer.finishedSpans.isEmpty)
7072

7173
let activeSpan = try #require(tracer.activeSpan(identifiedBy: childSpan.context))
@@ -356,8 +358,8 @@ struct InMemoryTracerTests {
356358
@Test("Span can't be ended repeatedly")
357359
func inMemoryDoubleEnd() async {
358360
let endCounter = LockedValueBox<Int>(0)
359-
let span = InMemorySpan.stub { finished in
360-
endCounter.withValue { counter in
361+
let span = InMemorySpan.stub { finished in
362+
endCounter.withValue { counter in
361363
counter += 1
362364
#expect(counter < 2, "Must not end() a span multiple times.")
363365
}
@@ -369,7 +371,7 @@ struct InMemoryTracerTests {
369371
span.end()
370372

371373
clock.setTime(222)
372-
span.end(at: clock.now) // should not blow up, but also, not update time again
374+
span.end(at: clock.now) // should not blow up, but also, not update time again
373375

374376
#expect(endCounter.withValue { $0 } == 1)
375377
}
@@ -387,7 +389,7 @@ extension InMemorySpan {
387389
)
388390
}
389391

390-
fileprivate static func stub(onEnd: @Sendable @escaping (FinishedInMemorySpan) -> ()) -> InMemorySpan {
392+
fileprivate static func stub(onEnd: @Sendable @escaping (FinishedInMemorySpan) -> Void) -> InMemorySpan {
391393
InMemorySpan(
392394
operationName: "stub",
393395
context: .topLevel,

0 commit comments

Comments
 (0)