Skip to main content

Configuration

Complete reference for all Pulse.shared.initialize(...) parameters. If you just need a quick working setup, see Installation.

note

The SDK ignores subsequent initialize() calls. Call it once, as early as possible.


Required

ParameterDescription
endpointBaseUrlOTLP base URL for your Pulse backend
apiKeyProject API key

Endpoints & Headers

ParameterDefaultDescription
configEndpointUrlAuto-derivedURL to fetch remote SDK config. Omit unless your backend serves config from a different host — see Remote Config.
customEventCollectorUrlnilOverride delivery URL for custom events only
endpointHeadersnilExtra HTTP headers on all outbound requests.

Telemetry Enrichment

globalAttributes

Key/value pairs attached to every span and log. Supported types: .string, .int, .double, .bool, and array variants.

globalAttributes: [
"environment": AttributeValue.string("production"),
"app.version": AttributeValue.string("2.1.0"),
]

See Global Attributes for the full list of what the SDK auto-attaches alongside your values.

resource

Override OpenTelemetry resource attributes (device model, OS, service name). Your values win over SDK defaults.

resource: { attributes in
attributes["service.name"] = .string("MyApp-iOS")
attributes["deployment.environment"] = .string("staging")
}

SDK Behavior

configuration

Controls which attribute groups are injected into every span and log. All are on by default.

MethodWhen called
disableScreenAttributes()Stop injecting screen.name
disableNetworkAttributes()Stop injecting network.connection.type / subtype
disableGlobalAttributes()Stop injecting your custom globalAttributes
configuration: { config in
config.disableScreenAttributes() // don't inject screen.name into every signal
}

dataCollectionState

ValueBehavior
.allowed (default)Telemetry collected and exported
.pending / .deniedSDK skips initialization — nothing collected
Pulse.shared.initialize(
endpointBaseUrl: "https://your-backend.com",
apiKey: "your-api-key",
dataCollectionState: .pending // wait for user consent before collecting
)

Use .pending to gate collection behind a user consent prompt. See Data Collection Consent.


Instrumentations

Configure individual instrumentations via the instrumentations closure. Each has a dedicated guide with all available options.

On by default:

InstrumentationDSL keyGuide
URLSessionurlSession { }Network
Crash reportingcrash { }Crashes
Screen lifecyclescreenLifecycle { }Screen Lifecycle
Session managementsessions { }Sessions
App startup timingappStartup { }App Startup
App lifecycle eventsappLifecycle { }App Lifecycle
User flow trackinginteraction { }Interaction

Needs extra setup:

InstrumentationWhat's neededGuide
Session replayEnable from Pulse DashboardSession Replay
UIKit tapEnable from Pulse DashboardUIKit Tap
Geo attributesACCESS_COARSE_LOCATION permissionLocation

Use the instrumentations block to disable or configure any default instrumentation:

instrumentations: { config in
// disable a default instrumentation
config.crash { $0.enabled(false) }
}

Each instrumentation has its own guide with all available options linked in the table above.


Before-Send Callbacks

Inspect, modify, or drop any signal before it is exported. Return nil to drop.

ParameterSignatureUse
beforeSendSpan(ReadableSpan) -> ReadableSpan?Filter or annotate spans
beforeSendLog(ReadableLogRecord) -> ReadableLogRecord?Filter or annotate logs
beforeSendMetric(MetricData) -> MetricData?Filter metrics
beforeSendSpan: { span in
span.name.contains("/health") ? nil : span // drop health-check spans
},
beforeSendLog: { log in
log.attributes["log.level"]?.description == "debug" ? nil : log
}

Advanced OpenTelemetry

Direct access to the OTel pipeline for custom processors or exporters:

tracerProviderCustomizer: { builder in
builder.add(spanProcessor: MyCustomSpanProcessor())
return builder
},
loggerProviderCustomizer: { processors in
[MyCustomLogProcessor()] + processors // prepend before Pulse's own processors
}

Remote Config

The SDK fetches a server-side config from your Pulse backend on every launch — in the background, non-blocking. The fetched config is persisted on device and applied on the next launch, so mid-session behavior stays consistent.

The config URL is auto-derived from endpointBaseUrl. Only set configEndpointUrl explicitly if your backend serves config from a different host.

Everything below can be changed from the Pulse dashboard without shipping an app update:

  • Enable or disable instrumentations — turn crash reporting, network, session replay, tap tracking, or interaction on/off
  • Set a default sampling rate — e.g. collect telemetry from 10% of all sessions globally
  • Rule-based sampling — override the default rate for specific OS versions, app versions, countries or platforms (e.g. 100% sampling on iOS 16, 10% on all others)
  • Drop attributes — remove sensitive or noisy attributes from all matching signals without touching app code
  • Add attributes — inject computed or static key/value pairs into matching signals

Shutdown

Permanently shuts down the SDK. All subsequent API calls are no-ops and cannot be reversed in the same process.

Pulse.shared.shutdown()

Uninstalls all instrumentations and swizzles, flushes and shuts down processors, deletes persisted telemetry, and clears session data from UserDefaults.


Next Steps

Now that the SDK is configured, explore what you can do with it:

I want to…Go to
Configure a specific instrumentationInstrumentation guides
Track business eventsCustom Events
Report handled errorsError Tracking
Measure operation durationsCustom Spans
Attach user identity to telemetryUser Identification
Add global metadata to all signalsGlobal Attributes
Gate collection behind consentData Collection Consent
Browse all public methodsAPI Reference
Upload symbol fileUpload Symbols