Introduction

edit

The Elastic APM iOS Agent measures the performance of your mobile applications in real-time.

How does the agent work?

edit

The Elastic APM iOS Agent uses the OpenTelemetry-Swift SDK. The agent automatically traces URLSessions and provides distributed traces annotated with device information along with your back-end services instrumented with Open-Telemetry.

The agent also captures any custom open-telemetry traces or measurements created using the OpenTelemetry-Swift API.

How to add instrumentation

edit

This agent will configure the OpenTelementry-Swift TracerProvider and MetricProvider, and set them as the global OpenTelemetry providers. They can be accessed through the OpenTelemetry SDK as follows:

let tracerProvider = OpenTelemetry.instance.tracerProvider
let meterProvider = OpenTelemetry.instance.meterProvider

These objects can be used to acquire new tracers and meters that will send their captured data to the Elastic APM Server. More details on how to use OpenTelemetry to instrument your app can be found in the OpenTelemetry.io Swift manual instrumentation docs.

Examples can be found in opentelemetry-swift/examples.

Additional components

edit

APM Agents work in conjunction with the APM Server, Elasticsearch, and Kibana. The APM Guide provides details on how these components work together, and provides a matrix outlining Agent and Server compatibility.

Open Telemetry Components

edit

The iOS Agent utilizes several OpenTelemetry-Swift libraries to provide automatic instrumentation of your applications and services. Details about these instrumentation libraries can be found in the official opentelementry.io Swift Libraries documentation.

For network instrumentation, the agent uses NSURLSessionInstrumentation. This provides network instrumentation in the form of spans and enables distributed tracing for all instrumented downstream services.

Detailed information on the device, operating system, and application is provided by SDKResourceExtension. More information on which data points are captured can be found in the opentelementry.io SDKResourceExtension documentation.

Elastic maps OpenTelemetry attributes to Elastic-specific fields. Details of these mappings can be found in the Elastic Mobile Agent Spec.