Resource, so telemetry from the process carries one identity.
The application exports to an OpenTelemetry Collector, which forwards to Bronto. If you don’t run a Collector, export directly to Bronto instead — only the endpoint and an API key header change.
The official SDK has no bridge to Apple’s
os.Logger (Unified Logging), and auto-instrumentation coverage is thinner than in other languages. Log records are emitted through the OTel Logs API directly, as shown below. Check the OpenTelemetry Swift registry for community bridges and URLSession instrumentation.Prerequisites
- Swift 5.7 or later; Xcode 14 or later, or Swift Package Manager on Linux
- An OTel Collector reachable from your application, with
logs,metrics, andtracespipelines forwarding to Bronto — see Connect OpenTelemetry Collector to Bronto
Install dependencies
Package.swift
Initialise the SDK
CallconfigureOtel() once at startup, before the first span or log emission:
Otel.swift
The metrics builder names have changed across
opentelemetry-swift releases. If the metrics block doesn’t compile against your version, check the examples in the opentelemetry-swift repository.http://localhost:4318 is the standard OTLP/HTTP address for a Collector on the same host. Use the address reachable from your application if the Collector runs in another container, pod, or host. No authentication is needed between the application and the Collector — the Collector holds the Bronto API key.Instrument your application
main.swift
trace_id and span_id from the current context, so you can jump from a log line to its trace in Bronto.
Verify
Run your application, then check each signal in Bronto, filtering by theservice.name you set:
- Logs — the Search page, in the dataset named after your service
- Metrics — the Metric Explorer
- Traces — the Explore Traces page
- Confirm the Collector is running and reachable at the configured endpoint, and that its pipelines include an
otlpreceiver and the Bronto exporters. - Confirm
configureOtel()runs before the first log or span. - The batch processors export on a background timer — make sure the process does not exit, or the app is not suspended, before the first flush.
- On iOS, App Transport Security blocks plaintext HTTP by default. Use an
https://endpoint, or add a development ATS exception for your local Collector.
Direct export to Bronto
Without a Collector, the application exports straight to Bronto over OTLP/HTTP. Point the endpoint at your Bronto region and add your API key:
See API Keys for how to create a key with ingestion permissions.
GenAI semantic conventions
If your application calls an LLM, OpenTelemetry’s GenAI semantic conventions definegen_ai.* span attributes for model, token usage, and prompt and response content.
Manual spans
There is no first-party GenAI instrumentation for Swift, so set the attributes yourself around each model call:gen_ai.input.messages / gen_ai.output.messages) is opt-in by convention and off by default in the languages that have auto-instrumentation. Since you are setting attributes by hand, apply the same discipline — gate prompt and response content behind your own config flag rather than always sending it.
See the GenAI span conventions for the full attribute list.
For the recommended attribute set and Bronto search queries, see LLM Observability.
