Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit 7579592

Browse files
authored
Merge pull request #141 from slashmo/refactor/tracer-naming
Drop Instrument suffix in TracingInstrument & TracingInstrumentation
2 parents fe80d76 + c5d3262 commit 7579592

34 files changed

+94
-76
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let package = Package(
55
name: "gsoc-swift-tracing",
66
products: [
77
.library(name: "Instrumentation", targets: ["Instrumentation"]),
8-
.library(name: "TracingInstrumentation", targets: ["TracingInstrumentation"]),
8+
.library(name: "Tracing", targets: ["Tracing"]),
99
.library(name: "NIOInstrumentation", targets: ["NIOInstrumentation"]),
1010
.library(name: "OpenTelemetryInstrumentationSupport", targets: ["OpenTelemetryInstrumentationSupport"])
1111
],
@@ -34,16 +34,16 @@ let package = Package(
3434
),
3535

3636
.target(
37-
name: "TracingInstrumentation",
37+
name: "Tracing",
3838
dependencies: [
3939
"Instrumentation",
4040
]
4141
),
4242
.testTarget(
43-
name: "TracingInstrumentationTests",
43+
name: "TracingTests",
4444
dependencies: [
4545
"Instrumentation",
46-
"TracingInstrumentation",
46+
"Tracing",
4747
"BaggageLogging",
4848
]
4949
),
@@ -66,7 +66,7 @@ let package = Package(
6666
.target(
6767
name: "OpenTelemetryInstrumentationSupport",
6868
dependencies: [
69-
.target(name: "TracingInstrumentation")
69+
.target(name: "Tracing")
7070
]
7171
),
7272
.testTarget(

Sources/Instrumentation/MultiplexInstrument.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ extension MultiplexInstrument: Instrument {
3939
)
4040
where
4141
Injector: InjectorProtocol,
42-
Carrier == Injector.Carrier {
42+
Carrier == Injector.Carrier
43+
{
4344
self.instruments.forEach { $0.inject(context, into: &carrier, using: injector) }
4445
}
4546

@@ -48,7 +49,8 @@ extension MultiplexInstrument: Instrument {
4849
)
4950
where
5051
Carrier == Extractor.Carrier,
51-
Extractor: ExtractorProtocol {
52+
Extractor: ExtractorProtocol
53+
{
5254
self.instruments.forEach { $0.extract(carrier, into: &context, using: extractor) }
5355
}
5456
}

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+EndUser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: EndUserAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+GRPCSemantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: GRPCAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+HTTPSemantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: HTTPAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+NetSemantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: NetAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+PeerSemantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: PeerAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttribute+RPCSemantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
extension SpanAttributeName {
1717
/// - See: RPCAttributes

Sources/OpenTelemetryInstrumentationSupport/SpanAttributeName.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import TracingInstrumentation
14+
import Tracing
1515

1616
/// Namespace for attribute key constants used with `SpanAttributes`.
1717
public enum SpanAttributeName {}

Sources/TracingInstrumentation/InstrumentationSystem+Tracing.swift renamed to Sources/Tracing/InstrumentationSystem+Tracing.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ import Baggage
1515
import Instrumentation
1616

1717
extension InstrumentationSystem {
18-
/// Get a `TracingInstrument` instance of the given type.
18+
/// Get a `Tracer` instance of the given type.
1919
///
2020
/// When using `MultiplexInstrument`, this returns the first instance of the given type stored in the `MultiplexInstrument`.
2121
///
2222
/// Usually tracing libraries will provide their own convenience getter, e.g. CoolTracing could provide `InstrumentationSystem.coolTracer`;
2323
/// if available, prefer using those APIs rather than relying on this general function.
2424
///
25-
/// - Parameter instrumentType: The type of `Instrument` you want to retrieve an instance for.
26-
/// - Returns: An `Instrument` instance of the given type or `nil` if no `Instrument` of that type has been bootstrapped.
27-
public static func tracingInstrument<T>(of instrumentType: T.Type) -> T? where T: TracingInstrument {
25+
/// - Parameter tracerType: The type of `Tracer` you want to retrieve an instance for.
26+
/// - Returns: A `Tracer` instance of the given type or `nil` if no `Tracer` of that type has been bootstrapped.
27+
public static func tracer<T>(of tracerType: T.Type) -> T? where T: Tracer {
2828
return self._findInstrument(where: { $0 is T }) as? T
2929
}
3030

31-
/// Returns the `TracingInstrument` bootstrapped as part of the `InstrumentationSystem`.
31+
/// Returns the `Tracer` bootstrapped as part of the `InstrumentationSystem`.
3232
///
3333
/// If the system was bootstrapped with a `MultiplexInstrument` this function attempts to locate the _first_
34-
/// tracing instrument as passed to the multiplex instrument. If none is found, a `NoOpTracingInstrument` is returned.
34+
/// tracing instrument as passed to the multiplex instrument. If none is found, a `NoOpTracer` is returned.
3535
///
36-
/// - Returns: A `TracingInstrument` if the system was bootstrapped with one, and `NoOpTracingInstrument` otherwise.
37-
public static var tracingInstrument: TracingInstrument {
38-
return (self._findInstrument(where: { $0 is TracingInstrument }) as? TracingInstrument) ?? NoOpTracingInstrument()
36+
/// - Returns: A `Tracer` if the system was bootstrapped with one, and `NoOpTracer` otherwise.
37+
public static var tracer: Tracer {
38+
return (self._findInstrument(where: { $0 is Tracer }) as? Tracer) ?? NoOpTracer()
3939
}
4040
}

0 commit comments

Comments
 (0)