You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,26 @@
6
6
`BaggageContext` is a minimal (zero-dependency) "context" library meant to "carry" baggage (metadata) for cross-cutting tools such as tracers.
7
7
It is purposefully not tied to any specific use-case (in the spirit of the [Tracing Plane paper](https://cs.brown.edu/~jcmace/papers/mace18universal.pdf)'s BaggageContext), however it should enable a vast majority of use cases cross-cutting tools need to support. Unlike mentioned in the paper, our `BaggageContext` does not implement its own serialization scheme (today).
8
8
9
+
See https://github.com/slashmo/gsoc-swift-tracing for actual instrument types and implementations which can be used to deploy various cross-cutting instruments all reusing the same baggage type.
9
10
11
+
## Installation
10
12
11
-
See https://github.com/slashmo/gsoc-swift-tracing for actual instrument types and implementations which can be used to deploy various cross-cutting instruments all reusing the same baggage type.
13
+
You can install the `BaggageContext` library through the Swift Package Manager. The library itself is called `Baggage`, so that's what you'd import in your Swift files.
In order for context-passing to feel consistent and Swifty among all server-side (and not only) libraries and frameworks
23
+
In order for context-passing to feel consistent and Swifty among all server-side (and not only) libraries and frameworks
16
24
aiming to adopt `BaggageContext` (or any of its uses, such as Distributed Tracing), we suggest the following set of guidelines:
17
25
18
26
### Argument naming/positioning
19
27
20
-
In order to propagate baggage through function calls (and asynchronous-boundaries it may often be necessary to pass it explicitly (unless wrapper APIs are provided which handle the propagation automatically).
28
+
In order to propagate baggage through function calls (and asynchronous-boundaries it may often be necessary to pass it explicitly (unless wrapper APIs are provided which handle the propagation automatically).
21
29
22
30
When passing baggage context explicitly we strongly suggest sticking to the following style guideline:
23
31
@@ -30,7 +38,7 @@ When passing baggage context explicitly we strongly suggest sticking to the foll
30
38
31
39
This way when reading the call side, users of these APIs can learn to "ignore" or "skim over" the context parameter and the method signature remains human-readable and “Swifty”.
32
40
33
-
Examples:
41
+
Examples:
34
42
35
43
-`func request(_ url: URL,`**`context: BaggageContext`**`)`, which may be called as `httpClient.request(url, context: context)`
@@ -62,7 +70,7 @@ When adapting an existing library/framework to support `BaggageContext` and it a
62
70
- if they take no framework context, accept a `context: BaggageContext` which is the same guideline as for all other cases
63
71
- if they already _must_ take a context object and you are out of words (or your API already accepts your framework context as "context"), pass the baggage as **last** parameter (see above) yet call the parameter `baggage` to disambiguate your `context` object from the `baggage` context object.
64
72
65
-
Examples:
73
+
Examples:
66
74
67
75
-`Lamda.Context` may contain `baggage` and this way offer traceIDs and other values
68
76
- passing context to a `Lambda.Context` unaware library becomes: `http.request(url: "...", context: context.baggage)`.
0 commit comments