Skip to content

Commit 9fdfcb1

Browse files
committed
rewrite the "instrument your library" guide
1 parent 47c37ca commit 9fdfcb1

File tree

5 files changed

+271
-76
lines changed

5 files changed

+271
-76
lines changed

Sources/Tracing/Docs.docc/Guides/ImplementATracer.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Creating an instrument means adopting the ``Instrument`` protocol (or ``Tracer``
1919

2020
`Instrument` has two requirements:
2121

22-
1. A method to inject values inside a `LoggingContext` into a generic carrier (e.g. HTTP headers)
23-
2. A method to extract values from a generic carrier (e.g. HTTP headers) and store them in a `LoggingContext`
22+
1. A method to inject values inside a `FIXME!!!` into a generic carrier (e.g. HTTP headers)
23+
2. A method to extract values from a generic carrier (e.g. HTTP headers) and store them in a `FIXME!!!`
2424

2525
The two methods will be called by instrumented libraries/frameworks at asynchronous boundaries, giving you a chance to
2626
act on the provided information or to add additional information to be carried across these boundaries.
2727

2828
> Check out the [`Baggage` documentation](https://github.com/apple/swift-distributed-tracing-baggage) for more information on
29-
how to retrieve values from the `LoggingContext` and how to set values on it.
29+
how to retrieve values from the `FIXME!!!` and how to set values on it.
3030

3131
### Creating a `Tracer`
3232

@@ -57,7 +57,7 @@ extension Baggage {
5757
}
5858
}
5959

60-
var context = DefaultLoggingContext.topLevel(logger: ...)
60+
var context = DefaultFIXME!!!.topLevel(logger: ...)
6161
context.baggage.traceID = "4bf92f3577b34da6a3ce929d0e0e4736"
6262
print(context.baggage.traceID ?? "new trace id")
6363
```
@@ -67,10 +67,10 @@ print(context.baggage.traceID ?? "new trace id")
6767

6868
When hitting boundaries like an outgoing HTTP request you call out to the [configured instrument(s)](#Bootstrapping-the-Instrumentation-System):
6969

70-
An HTTP client e.g. should inject the given `LoggingContext` into the HTTP headers of its outbound request:
70+
An HTTP client e.g. should inject the given `FIXME!!!` into the HTTP headers of its outbound request:
7171

7272
```swift
73-
func get(url: String, context: LoggingContext) {
73+
func get(url: String, context: FIXME!!!) {
7474
var request = HTTPRequest(url: url)
7575
InstrumentationSystem.instrument.inject(
7676
context.baggage,
@@ -84,7 +84,7 @@ On the receiving side, an HTTP server should use the following `Instrument` API
8484
`HTTPRequest` into:
8585

8686
```swift
87-
func handler(request: HTTPRequest, context: LoggingContext) {
87+
func handler(request: HTTPRequest, context: FIXME!!!) {
8888
InstrumentationSystem.instrument.extract(
8989
request.headers,
9090
into: &context.baggage,
@@ -97,7 +97,7 @@ func handler(request: HTTPRequest, context: LoggingContext) {
9797
> In case your library makes use of the `NIOHTTP1.HTTPHeaders` type we already have an `HTTPHeadersInjector` &
9898
`HTTPHeadersExtractor` available as part of the `NIOInstrumentation` library.
9999

100-
For your library/framework to be able to carry `LoggingContext` across asynchronous boundaries, it's crucial that you carry the context throughout your entire call chain in order to avoid dropping metadata.
100+
For your library/framework to be able to carry `FIXME!!!` across asynchronous boundaries, it's crucial that you carry the context throughout your entire call chain in order to avoid dropping metadata.
101101

102102
### Tracing your library
103103

@@ -107,7 +107,7 @@ In order to work with the tracer [configured by the end-user](#Bootstrapping-the
107107
should start a `Span` when sending the outgoing HTTP request:
108108

109109
```swift
110-
func get(url: String, context: LoggingContext) {
110+
func get(url: String, context: FIXME!!!) {
111111
var request = HTTPRequest(url: url)
112112

113113
// inject the request headers into the baggage as explained above
@@ -142,14 +142,14 @@ Creating an instrument means adopting the `Instrument` protocol (or `Tracer` in
142142

143143
`Instrument` has two requirements:
144144

145-
1. A method to inject values inside a `LoggingContext` into a generic carrier (e.g. HTTP headers)
146-
2. A method to extract values from a generic carrier (e.g. HTTP headers) and store them in a `LoggingContext`
145+
1. A method to inject values inside a `FIXME!!!` into a generic carrier (e.g. HTTP headers)
146+
2. A method to extract values from a generic carrier (e.g. HTTP headers) and store them in a `FIXME!!!`
147147

148148
The two methods will be called by instrumented libraries/frameworks at asynchronous boundaries, giving you a chance to
149149
act on the provided information or to add additional information to be carried across these boundaries.
150150

151151
> Check out the [`Baggage` documentation](https://github.com/apple/swift-distributed-tracing-baggage) for more information on
152-
how to retrieve values from the `LoggingContext` and how to set values on it.
152+
how to retrieve values from the `FIXME!!!` and how to set values on it.
153153

154154
### Creating a `Tracer`
155155

@@ -180,7 +180,7 @@ extension Baggage {
180180
}
181181
}
182182

183-
var context = DefaultLoggingContext.topLevel(logger: ...)
183+
var context = DefaultFIXME!!!.topLevel(logger: ...)
184184
context.baggage.traceID = "4bf92f3577b34da6a3ce929d0e0e4736"
185185
print(context.baggage.traceID ?? "new trace id")
186186
```

0 commit comments

Comments
 (0)