Skip to content

Commit 1816d22

Browse files
committed
formatting and review followup
1 parent 1a44257 commit 1816d22

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Sources/InMemoryTracing/InMemorySpanContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ extension ServiceContext {
4545
}
4646
}
4747

48-
struct InMemorySpanContextKey: ServiceContextKey {
48+
private struct InMemorySpanContextKey: ServiceContextKey {
4949
typealias Value = InMemorySpanContext
5050
}

Sources/InMemoryTracing/InMemoryTracer.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ extension InMemoryTracer {
114114

115115
extension InMemoryTracer {
116116

117-
/// Array of active spans, i.e. spans which have been started by have not yet finished (by calling `Span/end()`).
117+
/// Array of active spans, i.e. spans which have been started but have not yet finished (by calling `Span/end()`).
118118
public var activeSpans: [InMemorySpan] {
119119
_activeSpans.withValue { active in Array(active.values) }
120120
}
@@ -152,10 +152,13 @@ extension InMemoryTracer {
152152
}
153153

154154
/// Clears all registered finished spans, as well as injections/extractions performed by this tracer.
155-
public func clearAll() {
155+
public func clearAll(includingActive: Bool = false) {
156156
_finishedSpans.withValue { $0 = [] }
157157
_injections.withValue { $0 = [] }
158158
_extractions.withValue { $0 = [] }
159+
if includingActive {
160+
_activeSpans.withValue { $0 = [] }
161+
}
159162
}
160163
}
161164

@@ -240,7 +243,7 @@ extension InMemoryTracer {
240243
/// The carrier object from which the context values were extracted from,
241244
/// e.g. this frequently is an HTTP request or similar.
242245
public let carrier: any Sendable
243-
/// The constructed service context, containing the extracted ``ServiceContext/inMemoryTraceContext``.
246+
/// The constructed service context, containing the extracted ``ServiceContext/inMemorySpanContext``.
244247
public let context: ServiceContext
245248
}
246249
}

Tests/InMemoryTracingTests/InMemoryTracerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ private struct UnrelatedContextKey: ServiceContextKey {
417417
typealias Value = Int
418418
}
419419

420-
final class MockClock {
420+
private final class MockClock {
421421
var _now: UInt64 = 0
422422

423423
init() {}

0 commit comments

Comments
 (0)