Embrace mobile performance monitoring SDK for Android
The Embrace Android SDK builds on top of OpenTelemetry to capture performance data for Android apps, enabling full-stack observability of your system by connecting mobile and backend telemetry in a seamless way.
Telemetry recorded through this SDK can be consumed on the Embrace platform for Embrace customers, but it can also be used by those who are not Embrace customers to export collected data directly to any OTel Collector, either one that they host or is hosted by another vendors. In effect, this SDK is an alternative to opentelemetry-android or using the OpenTelemetry Java SDK directly for Android apps that want to leverage the OpenTelemetry ecosystem for observability, but also want all the advanced telemetry capture that Embrace is known for like ANR thread sampling, native crash capture, and so forth.
Currently, only Spans and Logs are supported, but other signals will be added in the future.
io.embrace:embrace-swazzler:<version>
.
'io.embrace:embrace-android-sdk:<version>
.main
directory of your app's root source folder (i.e. app/src/main/
), add in a file called embrace-config.json
that contains {}
as its only line.
embrace.disableMappingFileUpload=true
Using the Embrace SDK without being an Embrace customer requires you to set up OTel Exporters to work with the SDK so that recorded telemetry can be sent somewhere. To do that, create and configure instances of your chosen exporters and register them with the Embrace SDK before you start it.
val grafanaCloudExporter = OtlpHttpSpanExporter.builder()
.setEndpoint("https://myinstance.grafana.net/otlp/v1/traces")
.addHeader("Authorization", "YourToken")
.build()
Embrace.getInstance().addSpanExporter(grafanaCloudExporter)
Embrace.getInstance().addLogRecordExporter(SystemOutLogRecordExporter.create())
It is recommended that you start the Embrace SDK in the your Application
object's onCreate()
function (or even earlier) to minimize
the amount of time when telemetry isn't being recorded. This allows performance problems such as crashes and ANRs to be captured as soon
as possible.
internal class MyApplication : Application() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Do your exporter setup before starting the SDK
Embrace.getInstance().start()
}
}
For details about the features the Embrace Android SDK supports, refer to our features page.
appId
and API token
, checkout our integration guide for further instructions.Embrace Android SDK is published under the Apache-2.0 license.