Skip to content

Commit 8a9f843

Browse files
theletterfcartermp
andauthored
Edit instrumentation libraries pages: Swift (#4372)
Co-authored-by: Phillip Carter <[email protected]>
1 parent 080bbd6 commit 8a9f843

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

content/en/docs/languages/swift/libraries.md

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
---
22
title: Instrumentation Libraries
33
linkTitle: Libraries
4-
description: How to use Swift instrumentation libraries
54
weight: 40
65
cSpell:ignore: darwin inout iphone NSURL wifi
76
---
87

98
<!-- markdownlint-disable no-duplicate-heading -->
109

11-
OpenTelemetry-Swift provides several instrumentation libraries that generate
12-
instrumentation for you when they're installed and initialized.
10+
{{% docs/languages/libraries-intro "Swift" %}}
11+
12+
## Use instrumentation libraries
13+
14+
OpenTelemetry-Swift provides several
15+
[instrumentation libraries](/docs/specs/otel/glossary/#instrumentation-library)
16+
that generate instrumentation for you when they're installed and initialized.
17+
18+
For example,
19+
[the NSURLSession instrumentation](https://github.com/open-telemetry/opentelemetry-swift/tree/main/Sources/Instrumentation/URLSession)
20+
automatically creates [spans](/docs/concepts/signals/traces/#spans) for all
21+
network requests made with NSURLSessions.
22+
23+
## Setup
24+
25+
All instrumentation libraries are available in OpenTelemetry Swift. To turn on
26+
an instrumentation, follow its usage instructions.
1327

1428
## `SDKResourceExtension`
1529

@@ -57,7 +71,7 @@ values to the appropriate
5771
| `os.version` | `15.4.0` | `ProcessInfo.processInfo.operatingSystemVersion` |
5872
| `os.description` | `iOS Version 15.4 (Build 19E240)` | A combination of os name, version and build. |
5973

60-
## `NSURLSession` Instrumentation
74+
## `NSURLSession` instrumentation
6175

6276
This instrumentation creates spans for all network requests made with
6377
NSURLSessions. It also injects distributed tracing headers in instrumented
@@ -147,10 +161,26 @@ events. This functionality is shown in `Simple Exporter` example.
147161

148162
### Usage
149163

150-
Just add SignpostIntegration as any other Span Processor (see the
164+
Add SignpostIntegration as any other Span Processor (see the
151165
[manual instrumentation](../instrumentation/)) docs for details on configuring
152166
your providers:
153167

154168
```swift
155169
OpenTelemetry.instance.tracerProvider.addSpanProcessor(SignPostIntegration())
156170
```
171+
172+
## Available instrumentation libraries
173+
174+
A full list of instrumentation libraries produced by OpenTelemetry is available
175+
from the
176+
[opentelemetry-swift](https://github.com/open-telemetry/opentelemetry-swift/tree/main/Sources/Instrumentation)
177+
repository.
178+
179+
You can also find more instrumentations available in the
180+
[registry](/ecosystem/registry/?language=swift&component=instrumentation).
181+
182+
## Next steps
183+
184+
After you have set up instrumentation libraries, you might want to add your own
185+
[instrumentation](/docs/languages/swift/instrumentation) to your code, to
186+
collect custom telemetry data.

0 commit comments

Comments
 (0)