Skip to main content

Quickstart

Registration and configuration

To start the procedure, perform the following actions.

  1. Log in to the Tracer account.
  2. Create or join organization.
  3. Add an Android project (you must have administrator or owner permissions).

Connecting tracer dependencies to the project

In your <project>/settings.gradle.

pluginManagement {
repositories {
maven { url 'https://artifactory-external.vkpartner.ru/artifactory/maven/' }
}
} dependencyResolutionManagement {
repositories {
maven { url 'https://artifactory-external.vkpartner.ru/artifactory/maven/' }
}
}

In your <project>/<app-module>/build.gradle.

plugins {
id 'ru.ok.tracer' version '0.2.7'
}

tracer {
defaultConfig {
See in the "Settings" section
pluginToken = "PLUGIN_TOKEN"
appToken = "APP_TOKEN"
// Enables mapping loading for the build. By default: disabled.
uploadMapping = true
}
// You can also set configuration for every flavor, buildType, and buildVariant.
// Configurations inherit defaultConfig.
debug {
// Parameters...
}
demoDebug {
// Parameters...
}
}

dependencies {
// Plug-ins are independent of each other. You can connect only ones,
// that are required at the moment.
// Crashes and ANR gathering and analysis
implementation "ru.ok.tracer:tracer-crash-report:0.2.7"
// Native crashes gathering and analysis
implementation "ru.ok.tracer:tracer-crash-report-native:0.2.7"
// OOM heap dumps gathering and analysis
implementation "ru.ok.tracer:tracer-heap-dumps:0.2.7"
// Device disk usage analysis
implementation "ru.ok.tracer:tracer-disk-usage:0.2.7"
// Sampling profiler
implementation "ru.ok.tracer:tracer-profiler-sampling:0.2.7"
// Systrace
implementation "ru.ok.tracer:tracer-profiler-systrace:0.2.7"
}

Enabling and configuring tracer plug-ins in your project

Enable the HasTracerConfiguration interface in your Application.kt (see below).

class MyApplication : Application(), HasTracerConfiguration {
override val tracerConfiguration: List<TracerConfiguration>
get() = listOf(
CoreTracerConfiguration.build {
// tracer core options
},
CrashReportConfiguration.build {
// crash collector options
},
CrashFreeConfiguration.build {
// crash free counting options
},
HeapDumpConfiguration.build {
// ООМ heap dumps collector options
},
DiskUsageConfiguration.build {
// disk usage analyzer options
},
SystraceProfilerConfiguration.build {
// production systrace profiler options
},
SamplingProfilerConfiguration.build {
// sampling profiler options
},
)
}

The HasTracerConfiguration.tracerConfiguration property will be called once on Application.onCreate process start but only after Application.attachBaseContext. In getter you can call the app context but it is early to call anything that will be initialized in onCreate.

Below is a detailed description of the options:

  • CoreTracerConfiguration — see below on this page.
  • CrashReportConfiguration and CrashFreeConfiguration — on page Crash and ANR.
  • HeapDumpConfiguration — on page Heap Dumps.
  • DiskUsageConfiguration — on page Disk Usage.
  • SystraceProfilerConfiguration — on page Systrace Profiler.
  • SamplingProfilerConfiguration — on page Sampling Profiler.

CoreTracerConfiguration description

In a rare case you might want to configure the tracer core in your project, retrieve CoreTracerConfiguration from HasTracerConfiguration.

class MyApplication : Application(), HasTracerConfiguration {
override val tracerConfiguration: List<TracerConfiguration>
get() = listOf(
CoreTracerConfiguration.build {
// your options
},
)
}

Below are the CoreTracerConfiguration.Builder options.

  • setEnabled — not used and will be removed in version 0.3.x—tracer core is always enabled, however, inactive if there are no enabled plug-ins.
  • setHost, provideHost — tracer address change.
  • setStatHost, provideStatHost — tracer address change for the crash free feature.
  • setCustomAppKey, provideCustomAppKey — replaces sampleUploadToken from the gradle plug-in configuration.