diff --git a/docs/README.md b/docs/README.md index b6c565d300..26f78daac7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ # Datadog Android SDK documentation This folder has dedicated documentation for: - +* [Initialize the SDK](sdk_initialization.md) * [Collect and send logs from your Android application to Datadog](log_collection.md). * [Trace your Android application](trace_collection.md). * [Monitoring your Android application](rum_collection.md). @@ -11,4 +11,4 @@ This folder has dedicated documentation for: * [Timber API integration](timber_integration.md). * [Migrating from earlier versions to the v1.0 of the dd-sdk-android](Migrating_To_1.0.0.md). * [SDK Perfomance](sdk_performance.md) -* [SDK Benchmarks](sdk_benchmarks.md) \ No newline at end of file +* [SDK Benchmarks](sdk_benchmarks.md) diff --git a/docs/log_collection.md b/docs/log_collection.md index 5d0e1365af..5ce25de835 100644 --- a/docs/log_collection.md +++ b/docs/log_collection.md @@ -8,8 +8,6 @@ Send logs to Datadog from your Android applications with [Datadog's `dd-sdk-andr * Record real client IP addresses and User-Agents. * Optimized network usage with automatic bulk posts. -**Note**: The `dd-sdk-android` library supports all Android versions from API level 19 (KitKat). - ## Setup 1. Add the Gradle dependency by declaring the library as a dependency in your `build.gradle` file: @@ -24,56 +22,64 @@ Send logs to Datadog from your Android applications with [Datadog's `dd-sdk-andr } ``` -2. Initialize the library with your application context, [tracking consent][7], and the [Datadog client token][2] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][6] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][3] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][2]: - - {{< tabs >}} - {{% tab "US" %}} - -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() - - val config = DatadogConfig.Builder("", "", "") - .build() - Datadog.initialize(this, trackingConsent, config) +2. Initialize the library with your application context, tracking consent, and the [Datadog client token][2] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][6] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][3] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][2]: + + {{< tabs >}} + {{% tab "US" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder().build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } } -} -``` - - {{% /tab %}} - {{% tab "EU" %}} - -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() - - val config = DatadogConfig.Builder("", "", "") - .useEUEndpoints() - .build() - Datadog.initialize(this, trackingConsent, config) + ``` + {{% /tab %}} + {{% tab "EU" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder() + .useEUEndpoints() + .build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } + } + ``` + {{% /tab %}} + {{< /tabs >}} + + To be compliant with the GDPR regulation, the SDK requires the tracking consent value at initialization. + The tracking consent can be one of the following values: + * `TrackingConsent.PENDING`: The SDK starts collecting and batching the data but does not send it to the data + collection endpoint. The SDK waits for the new tracking consent value to decide what to do with the batched data. + * `TrackingConsent.GRANTED`: The SDK starts collecting the data and sends it to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK does not collect any data. You will not be able to manually send any logs, traces, or + RUM events. + + To update the tracking consent after the SDK is initialized, call: `Datadog.setTrackingConsent()`. + The SDK changes its behavior according to the new consent. For example, if the current tracking consent is `TrackingConsent.PENDING` and you update it to: + * `TrackingConsent.GRANTED`: The SDK sends all current batched data and future data directly to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK wipes all batched data and does not collect any future data. + + Note that in the credentials required for initialization, your application variant name is also required. This is important because it enables the right proguard `mapping.txt` file to be automatically uploaded at build time. This allows a Datadog dashboard to de-obfuscate the stack traces. + + Use the utility method `isInitialized` to check if the SDK is properly initialized: + + ```kotlin + if(Datadog.isInitialized()){ + // your code here } -} -``` - - {{% /tab %}} - {{< /tabs >}} - - There is also a utility method which gives you the current state of the SDK. You can use this to check if it was properly initialized or not: - - ```kotlin - if(Datadog.isInitialized()){ - // your code here - } - ``` - - When writing your application, you can enable development logs. All internal messages in the library with a priority equal or higher than the provided level are then logged to Android's Logcat. - - ```kotlin - Datadog.setVerbosity(Log.INFO) - ``` - + ``` + When writing your application, you can enable development logs by calling the `setVerbosity` method. All internal messages in the library with a priority equal to or higher than the provided level are then logged to Android's Logcat: + ```kotlin + Datadog.setVerbosity(Log.INFO) + ``` + 3. Configure the Android Logger: ```kotlin @@ -244,4 +250,3 @@ If your existing codebase is using Timber, you can forward all those logs to Da [4]: https://docs.datadoghq.com/logs/processing/attributes_naming_convention/ [5]: https://docs.datadoghq.com/tagging/ [6]: https://docs.datadoghq.com/real_user_monitoring/android/?tab=us -[7]: gdpr.md diff --git a/docs/native_crash_collection.md b/docs/native_crash_collection.md index 577cdc70c1..a5f388c710 100644 --- a/docs/native_crash_collection.md +++ b/docs/native_crash_collection.md @@ -19,15 +19,38 @@ dependencies { } ``` -### Plugins - -1. The NDKCrashReporterPlugin handles the crash signals at the native level and reports them as errors by adding more explicit information (for example: backtrace, signal name, signal relevant error message) in the Datadog logs dashboard: +Initialize the library with your application context, tracking consent, and the [Datadog client token][1] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][3] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][2] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][1]: ```kotlin +class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + + val configuration = Configuration.Builder() + .addPlugin(NDKCrashReporterPlugin(), Feature.CRASH) + .build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } +} +``` +To be compliant with the GDPR regulation, the SDK requires the tracking consent value at initialization. +The tracking consent can be one of the following values: -val config = DatadogConfig.Builder("", "", "") - .addPlugin(NDKCrashReporterPlugin(), Feature.CRASH) - .build() -Datadog.initialize(this, config) +* `TrackingConsent.PENDING`: The SDK starts collecting and batching the data but does not send it to the data + collection endpoint. The SDK waits for the new tracking consent value to decide what to do with the batched data. +* `TrackingConsent.GRANTED`: The SDK starts collecting the data and sends it to the data collection endpoint. +* `TrackingConsent.NOT_GRANTED`: The SDK does not collect any data. You will not be able to manually send any logs, traces, or + RUM events. -``` +To update the tracking consent after the SDK is initialized, call: `Datadog.setTrackingConsent()`. +The SDK changes its behavior according to the new consent. For example, if the current tracking consent is `TrackingConsent.PENDING` and you update it to: + +* `TrackingConsent.GRANTED`: The SDK sends all current batched data and future data directly to the data collection endpoint. +* `TrackingConsent.NOT_GRANTED`: The SDK wipes all batched data and does not collect any future data. + +Note that in the credentials required for initialization, your application variant name is also required. This is important because it enables the right proguard `mapping.txt` file to be automatically uploaded at build time. This allows a Datadog dashboard to de-obfuscate the stack traces. + +[1]: https://docs.datadoghq.com/account_management/api-app-keys/#client-tokens +[2]: https://docs.datadoghq.com/account_management/api-app-keys/#api-keys +[3]: https://docs.datadoghq.com/real_user_monitoring/android/?tab=us diff --git a/docs/rum_collection.md b/docs/rum_collection.md index 184d36b5f6..f32ca93771 100644 --- a/docs/rum_collection.md +++ b/docs/rum_collection.md @@ -20,58 +20,93 @@ Send [Real User Monitoring data][1] to Datadog from your Android applications wi } ``` -2. Initialize the library with your application context, [tracking consent][9], and [Datadog client token][4]. For security reasons, you must use a client token: you cannot use [Datadog API keys][5] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][4]. You also need to provide an Application ID (see our [RUM Getting Started page][3]). - - {{< tabs >}} - {{% tab "US" %}} +2. Initialize the library with your application context, tracking consent, and the [Datadog client token][4] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][3] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][5] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][4]: + + {{< tabs >}} + {{% tab "US" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder().build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } + } + ``` + {{% /tab %}} + {{% tab "EU" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder() + .useEUEndpoints() + .build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } + } + ``` + {{% /tab %}} + {{< /tabs >}} + + To be compliant with the GDPR regulation, the SDK requires the tracking consent value at initialization. + The tracking consent can be one of the following values: + * `TrackingConsent.PENDING`: The SDK starts collecting and batching the data but does not send it to the data + collection endpoint. The SDK waits for the new tracking consent value to decide what to do with the batched data. + * `TrackingConsent.GRANTED`: The SDK starts collecting the data and sends it to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK does not collect any data. You will not be able to manually send any logs, traces, or + RUM events. -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() + To update the tracking consent after the SDK is initialized, call: `Datadog.setTrackingConsent()`. + The SDK changes its behavior according to the new consent. For example, if the current tracking consent is `TrackingConsent.PENDING` and you update it to: + * `TrackingConsent.GRANTED`: The SDK sends all current batched data and future data directly to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK wipes all batched data and does not collect any future data. - val config = DatadogConfig.Builder("", "", "") - .trackInteractions() - .useViewTrackingStrategy(strategy) - .build() - Datadog.initialize(this, trackingConsent, config) - } -} -``` + Note that in the credentials required for initialization, your application variant name is also required. This is important because it enables the right proguard `mapping.txt` file to be automatically uploaded at build time. This allows a Datadog dashboard to de-obfuscate the stack traces. - {{% /tab %}} - {{% tab "EU" %}} + Use the utility method `isInitialized` to check if the SDK is properly initialized: -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() - - val config = DatadogConfig.Builder("", "", "") - .trackInteractions() - .useViewTrackingStrategy(strategy) - .useEUEndpoints() - .build() - Datadog.initialize(this, trackingConsent, config) + ```kotlin + if(Datadog.isInitialized()){ + // your code here } -} -``` + ``` + When writing your application, you can enable development logs by calling the `setVerbosity` method. All internal messages in the library with a priority equal to or higher than the provided level are then logged to Android's Logcat: + ```kotlin + Datadog.setVerbosity(Log.INFO) + ``` - {{% /tab %}} - {{< /tabs >}} +3. To enable the automatic view tracking in the SDK, provide a tracking strategy at initialization. + Depending on your application's architecture, you can choose one of several implementations of `ViewTrackingStrategy`: -Depending on your application's architecture, you can choose one of several implementations of `ViewTrackingStrategy`: + - `ActivityViewTrackingStrategy`: Every activity in your application is considered a distinct view. + - `FragmentViewTrackingStrategy`: Every fragment in your application is considered a distinct view. + - `NavigationViewTrackingStrategy`: If you use the Android Jetpack Navigation library, this is the recommended strategy. It automatically tracks the navigation destination as a distinct view. + - `MixedViewTrackingStrategy`: Every activity or fragment in your application is considered a distinct view. This strategy is a mix between the `ActivityViewTrackingStrategy` and `FragmentViewTrackingStrategy`. + + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + + val configuration = Configuration.Builder() + .trackInteractions() + .useViewTrackingStrategy(strategy) + .build() + + Datadog.initialize(this, credentials, configuration, trackingConsent) + } + } + ``` + + **Note**: For `ActivityViewTrackingStrategy`, `FragmentViewTrackingStrategy`, or `MixedViewTrackingStrategy` you can filter which `Fragment` or `Activity` is tracked as a RUM View by providing a `ComponentPredicate` implementation in the constructor. + + **Note**: By default, the library won't track any view. If you decide not to provide a view tracking strategy you will have to manually send the views by calling the `startView` and `stopView` methods yourself. - - `ActivityViewTrackingStrategy`: Every activity in your application is considered a distinct view. - - `FragmentViewTrackingStrategy`: Every fragment in your application is considered a distinct view. - - `NavigationViewTrackingStrategy`: If you use the Android Jetpack Navigation library, this is the recommended strategy. It automatically tracks the navigation destination as a distinct view. - - `MixedViewTrackingStrategy`: Every activity or fragment in your application is considered a distinct view. This strategy is a mix between the `ActivityViewTrackingStrategy` and `FragmentViewTrackingStrategy`. - - **Note**: For `ActivityViewTrackingStrategy`, `FragmentViewTrackingStrategy`, or `MixedViewTrackingStrategy` you can filter which `Fragment` or `Activity` is tracked as a RUM View by providing a `ComponentPredicate` implementation in the constructor. - - **Note**: By default, the library won't track any view. If you decide not to provide a view tracking strategy you will have to manually send the views by calling the `startView` and `stopView` methods yourself. -3. Configure and register the RUM Monitor. You only need to do it once, usually in your application's `onCreate()` method: +4. Configure and register the RUM Monitor. You only need to do it once, usually in your application's `onCreate()` method: ```kotlin val monitor = RumMonitor.Builder() @@ -82,7 +117,7 @@ Depending on your application's architecture, you can choose one of several impl GlobalRum.registerIfAbsent(monitor) ``` -4. If you want to track your OkHttp requests as resources, you can add the provided [Interceptor][6] as follows: +5. If you want to track your OkHttp requests as resources, add the provided [Interceptor][6]: ```kotlin val okHttpClient = OkHttpClient.Builder() @@ -94,7 +129,7 @@ Depending on your application's architecture, you can choose one of several impl **Note**: If you also use multiple Interceptors, this one must be called first. -5. (Optional) If you want to get timing information in Resources (such as time to first byte, DNS resolution, etc.), you can add the [Event][6] listener factory as follows: +6. (Optional) If you want to get timing information in Resources (such as time to first byte, DNS resolution, etc.), add the [Event][6] listener factory: ```kotlin val okHttpClient = OkHttpClient.Builder() @@ -103,9 +138,9 @@ Depending on your application's architecture, you can choose one of several impl .build() ``` -6. (Optional) If you want to manually track RUM events, you can use the `GlobalRum` class. +7. (Optional) If you want to manually track RUM events, use the `GlobalRum` class. - To track views, call the `RumMonitor#startView` when the view becomes visible and interactive (equivalent with the lifecycle event `onResume`) followed by `RumMonitor#stopView` when the view is no longer visible(equivalent with the lifecycle event `onPause`) as follows: + To track views, call the `RumMonitor#startView` when the view becomes visible and interactive (equivalent to the lifecycle event `onResume`) followed by `RumMonitor#stopView` when the view is no longer visible (equivalent to the lifecycle event `onPause`): ```kotlin fun onResume(){ @@ -139,7 +174,7 @@ Depending on your application's architecture, you can choose one of several impl } ``` -7. (Optional) If you want to add custom information as attributes to all RUM events, you can use the `GlobalRum` class. +8. (Optional) If you want to add custom information as attributes to all RUM events, you can use the `GlobalRum` class. ```kotlin // Adds an attribute to all future RUM events @@ -313,4 +348,3 @@ If you use Apollo, let it use your `OkHttpClient`, and you'll get RUM and APM in [6]: https://square.github.io/okhttp/interceptors/ [7]: https://square.github.io/okhttp/events/ [8]: https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper -[9]: gdpr.md diff --git a/docs/sdk_initialization.md b/docs/sdk_initialization.md new file mode 100644 index 0000000000..40c3efbff4 --- /dev/null +++ b/docs/sdk_initialization.md @@ -0,0 +1,78 @@ +#SDK Initialization + +1. Add the Gradle dependency by declaring the library as a dependency in your `build.gradle` file: + + ```conf + repositories { + maven { url "https://dl.bintray.com/datadog/datadog-maven" } + } + + dependencies { + implementation "com.datadoghq:dd-sdk-android:x.x.x" + } + ``` + +2. Initialize the library with your application context, [tracking consent][3], and the [Datadog client token][1] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][4] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][2] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][1]: + + {{< tabs >}} + {{% tab "US" %}} + +```kotlin +class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + + val configuration = Configuration.Builder().build() + val credentials = Credentials( + , + , + , + + ) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } +} +``` + {{% /tab %}} + {{% tab "EU" %}} + +```kotlin +class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + + val configuration = Configuration.Builder() + .useEUEndpoints() + .build() + val credentials = Credentials( + , + , + , + + ) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } +``` + + {{% /tab %}} + {{< /tabs >}} + +Note that in the credentials required for initialization, your application variant name is also required. This is important because it enables the right proguard `mapping.txt` file to be automatically uploaded at build time. This allows a Datadog dashboard to de-obfuscate the stack traces. + + Use the utility method `isInitialized` to check if the SDK is properly initialized: + + ```kotlin + if(Datadog.isInitialized()){ + // your code here + } + ``` + When writing your application, you can enable development logs by calling the `setVerbosity` method. All internal messages in the library with a priority equal to or higher than the provided level are then logged to Android's Logcat: + ```kotlin + Datadog.setVerbosity(Log.INFO) + ``` +**Note**: The `dd-sdk-android` library supports all Android versions from API level 19 (KitKat). + +[1]: https://docs.datadoghq.com/account_management/api-app-keys/#client-tokens +[2]: https://docs.datadoghq.com/account_management/api-app-keys/#api-keys +[3]: gdpr.md +[4]: https://docs.datadoghq.com/real_user_monitoring/android/?tab=us diff --git a/docs/trace_collection.md b/docs/trace_collection.md index 92a8e2b7fd..1112fa635d 100644 --- a/docs/trace_collection.md +++ b/docs/trace_collection.md @@ -18,43 +18,65 @@ Send [traces][1] to Datadog from your Android applications with [Datadog's `dd-s dependencies { implementation "com.datadoghq:dd-sdk-android:x.x.x" } - ``` - -2. Initialize the library with your application context, [tracking consent][7], and [Datadog client token][4]. For security reasons, you must use a client token: you cannot use [Datadog API keys][5] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][4]: - - {{< tabs >}} - {{% tab "US" %}} + ``` -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() +2. Initialize the library with your application context, tracking consent, and the [Datadog client token][4] and Application ID generated when you create a new RUM application in the Datadog UI (see [Getting Started with Android RUM Collection][7] for more information). For security reasons, you must use a client token: you cannot use [Datadog API keys][5] to configure the `dd-sdk-android` library as they would be exposed client-side in the Android application APK byte code. For more information about setting up a client token, see the [client token documentation][4]: - val config = DatadogConfig.Builder("", "", "") - .build() - Datadog.initialize(this, trackingConsent, config) + {{< tabs >}} + {{% tab "US" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder().build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } } -} -``` - - {{% /tab %}} - {{% tab "EU" %}} + ``` + {{% /tab %}} + {{% tab "EU" %}} + ```kotlin + class SampleApplication : Application() { + override fun onCreate() { + super.onCreate() + val configuration = Configuration.Builder() + .useEUEndpoints() + .build() + val credentials = Credentials(,,,) + Datadog.initialize(this, credentials, configuration, trackingConsent) + } + } + ``` + {{% /tab %}} + {{< /tabs >}} + + To be compliant with the GDPR regulation, the SDK requires the tracking consent value at initialization. + The tracking consent can be one of the following values: + * `TrackingConsent.PENDING`: The SDK starts collecting and batching the data but does not send it to the data + collection endpoint. The SDK waits for the new tracking consent value to decide what to do with the batched data. + * `TrackingConsent.GRANTED`: The SDK starts collecting the data and sends it to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK does not collect any data. You will not be able to manually send any logs, traces, or + RUM events. + + To update the tracking consent after the SDK is initialized, call: `Datadog.setTrackingConsent()`. + The SDK changes its behavior according to the new consent. For example, if the current tracking consent is `TrackingConsent.PENDING` and you update it to: + * `TrackingConsent.GRANTED`: The SDK sends all current batched data and future data directly to the data collection endpoint. + * `TrackingConsent.NOT_GRANTED`: The SDK wipes all batched data and does not collect any future data. + + Note that in the credentials required for initialization, your application variant name is also required. This is important because it enables the right proguard `mapping.txt` file to be automatically uploaded at build time. This allows a Datadog dashboard to de-obfuscate the stack traces. + + Use the utility method `isInitialized` to check if the SDK is properly initialized: -```kotlin -class SampleApplication : Application() { - override fun onCreate() { - super.onCreate() - - val config = DatadogConfig.Builder("", "", "") - .useEUEndpoints() - .build() - Datadog.initialize(this, trackingConsent, config) + ```kotlin + if(Datadog.isInitialized()){ + // your code here } -} -``` - - {{% /tab %}} - {{< /tabs >}} + ``` + When writing your application, you can enable development logs by calling the `setVerbosity` method. All internal messages in the library with a priority equal to or higher than the provided level are then logged to Android's Logcat: + ```kotlin + Datadog.setVerbosity(Log.INFO) + ``` 3. Configure and register the Android Tracer. You only need to do it once, usually in your application's `onCreate()` method: @@ -82,7 +104,7 @@ class SampleApplication : Application() { span.finish() ``` -7. Using Scopes: +6. To use scopes in synchronous calls: ```kotlin val span = tracer.buildSpan("").start() try { @@ -113,7 +135,7 @@ class SampleApplication : Application() { } ``` -8. Using scopes in Asynchronous calls: +7. To use scopes in asynchronous calls: ```kotlin val span = tracer.buildSpan("").start() try{ @@ -137,7 +159,7 @@ class SampleApplication : Application() { } ``` -9. (Optional) How to manually distribute traces between your environments, for example frontend - backend: +8. (Optional) To manually distribute traces between your environments, for example frontend to backend: * Step 1: Inject tracer context in the client request. @@ -177,14 +199,12 @@ class SampleApplication : Application() { **Note**: For code bases using the OkHttp client, Datadog provides the implementation below. -10. (Optional) - Provide additional tags alongside your span. +9. (Optional) To provide additional tags alongside your span: ```kotlin span.setTag("http.url", url) ``` -11. (Optional) Attach an error information to a span: - - If you want to mark a span as having an error, you can do so by logging it using the official OpenTracing tags +10. (Optional) To mark a span as having an error, log it using OpenTracing tags: ```kotlin span.log(mapOf(Fields.ERROR_OBJECT to throwable)) @@ -269,4 +289,4 @@ The data on disk will automatically be discarded if it gets too old to ensure th [4]: https://docs.datadoghq.com/account_management/api-app-keys/#client-tokens [5]: https://docs.datadoghq.com/account_management/api-app-keys/#api-keys [6]: https://square.github.io/okhttp/interceptors/ -[7]: gdpr.md +[7]: https://docs.datadoghq.com/real_user_monitoring/android/?tab=us