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
Add basic README files to those libraries that didnt include one
Make MultiSpanProcessor public again, I found myself duplicating this code when creating Spans directly and was using several span processors, so make it useful for anyone
This example shows the URLSessionInstrumentation in action.
4
+
It only shows the minimum configuration: Just by initializing the class, all network request that happen after it will be captured by Opentelemetry as Spans. Check URLSessionInstrumentation README for more information.
Apple have created their own metrics API which has been adopted by a number of other packages including, but not limited to, Vapor - a prominent Server Side Swift platform.
4
+
5
+
This shim essentially redirects the data to the OpenTelemetry API functions.
6
+
7
+
```
8
+
let meter: Meter = // ... Your existing code to create a meter
9
+
let metrics = OpenTelemetrySwiftMetrics(meter: meter)
10
+
MetricsSystem.bootstrap(metrics)
11
+
```
12
+
13
+
If this is adopted, we may wish to add OpenTelemetry to the README of their package alongside SwiftPrometheus and StatsD. That would be a PR on their repo.
14
+
15
+
Tried to follow similar patterns to other products, but let me know if you need things changing!
16
+
17
+
Potentially this could be renamed/re-homed to an "Importers" directory to follow more closely with the "Exporters" systems. This would demonstrate a clear route forward for future bridges such as a swift-log product once we add support for logs.
This package captures the network calls produced by URLSession. Just by initializing the cl
4
+
5
+
6
+
## Usage
7
+
8
+
Initialize the class with `URLSessionInstrumentation(configuration: URLSessionInstrumentationConfiguration())` to automatically capture all network calls.
9
+
10
+
This behaviour can be modified or augmented by using the optional callbacks defined in `URLSessionInstrumentationConfiguration` :
11
+
12
+
`shouldInstrument: ((URLRequest) -> (Bool)?)?` : Filter which requests you want to instrument, all by default
13
+
14
+
`shouldRecordPayload: ((URLSession) -> (Bool)?)?`: Implement if you want the session to record payload data, false by default.
15
+
16
+
`shouldInjectTracingHeaders: ((inout URLRequest) -> (Bool)?)?`: Allows filtering which requests you want to inject headers to follow the trace, true by default. You can also modify the request or add other headers in this method.
17
+
18
+
`nameSpan: ((URLRequest) -> (String)?)?` - Modifies the name for the given request instead of stantard Opentelemetry name
19
+
20
+
`createdRequest: ((URLRequest, Span) -> Void)?` - Called after request is created, it allows to add extra information to the Span
21
+
22
+
`receivedResponse: ((URLResponse, DataOrFile?, Span) -> Void)?`- Called after response is received, it allows to add extra information to the Span
23
+
24
+
`receivedError: ((Error, DataOrFile?, HTTPStatus, Span) -> Void)?` - Called after an errror is received, it allows to add extra information to the Span
0 commit comments