Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit acf93e0

Browse files
Merge pull request #2141 from splunk/urbiz-DG26129-rum-ios-ex
[DG26129]: New snippet for RUM iOS
2 parents 0fb6cc2 + 8b0c870 commit acf93e0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

gdi/get-data-in/rum/ios/manual-rum-ios-instrumentation.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ The following example shows how to use the OTel Swift API to report on a functio
130130
span.end() // You can also use defer for this
131131
}
132132
133+
Alternatively, you can also use the following snippet:
134+
135+
.. code-block:: swift
136+
137+
func calculateTax() {
138+
let tracer = OpenTelemetry.instance.tracerProvider.get(instrumentationName: "MyApp", instrumentationVersion: nil)
139+
let span = tracer.spanBuilder(spanName: "calculateTax").startSpan()
140+
span.setAttribute(key: "numClaims", value: claims.count)
141+
//...
142+
//...
143+
span.end() // You can also use defer for this
144+
}
145+
133146
This other example shows how to record an event with no duration, that is, which happens in an instant:
134147
135148
.. code-block:: swift

0 commit comments

Comments
 (0)