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

Commit 407c998

Browse files
committed
Add installation instructions 📖
1 parent f94d88d commit 407c998

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,26 @@
66
`BaggageContext` is a minimal (zero-dependency) "context" library meant to "carry" baggage (metadata) for cross-cutting tools such as tracers.
77
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).
88

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.
910

11+
## Installation
1012

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.
14+
15+
```swift
16+
dependencies: [
17+
.package(url: "https://github.com/slashmo/gsoc-swift-baggage-context.git", from: "0.1.0")
18+
]
19+
```
1220

1321
## Context-Passing Guidelines
1422

15-
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
1624
aiming to adopt `BaggageContext` (or any of its uses, such as Distributed Tracing), we suggest the following set of guidelines:
1725

1826
### Argument naming/positioning
1927

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).
2129

2230
When passing baggage context explicitly we strongly suggest sticking to the following style guideline:
2331

@@ -30,7 +38,7 @@ When passing baggage context explicitly we strongly suggest sticking to the foll
3038

3139
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”.
3240

33-
Examples:
41+
Examples:
3442

3543
- `func request(_ url: URL,` **`context: BaggageContext`** `)`, which may be called as `httpClient.request(url, context: context)`
3644
- `func handle(_ request: RequestObject,` **`context: FrameworkContext`** `)`
@@ -62,7 +70,7 @@ When adapting an existing library/framework to support `BaggageContext` and it a
6270
- if they take no framework context, accept a `context: BaggageContext` which is the same guideline as for all other cases
6371
- 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.
6472

65-
Examples:
73+
Examples:
6674

6775
- `Lamda.Context` may contain `baggage` and this way offer traceIDs and other values
6876
- passing context to a `Lambda.Context` unaware library becomes: `http.request(url: "...", context: context.baggage)`.

0 commit comments

Comments
 (0)