Set up Network Monitoring

This page helps you get started with Luciq's network performance monitoring on Android

Getting Started

In order to allow Luciq App Performance Monitoring to capture network requests, you will need to include our Gradle plugin in your project. Currently, we support capturing requests made via OkHttpClient and HTTPURLConnection.

  1. Add the dependency to your project's build.gradle file.

plugins {
  id("ai.luciq.library") version "18.0.0" apply false // adds luciq plugin
}
  1. Add the plugin in your application's build.gradle:

plugins { 
  id("luciq-apm") // Luciq APM Plugin
}

📘 The Plugin DSL in Kotlin is supported starting SDK version 12.4.1.

Plugin Alternatives:

You can always use a manual approach to capture requests made via the OkHttpClient by adding our Interceptor and EventListener using the below code snippets:

OkHttpClient.Builder()
    // add your interceptors here
    .addInterceptor(LuciqAPMOkhttpInterceptor())

    // Add Luciq EventListener
    .eventListener(LuciqApmOkHttpEventListener(/** optional: add your own EventListener here **/))
    // Or Add Luciq EventListenerFactory
    .eventListenerFactory(LuciqApmOkHttpEventListener.Factory(/** optional: add your own EventListener factory here **/))
    .build()

GraphQL Support

APM Network Logs are independent from Bug and Crash Reporting

Please note that Network Logs that are captured in Bug and Crash reports will not be captured by APM, the only way to enabled Network performance monitoring in APM is by adding this plugin. Enabling Network performance monitoring has no effect on Network Logs captured in Bug and Crash reports, these are configured separately and are completely independent from APM.


gRPC Support

Luciq supports the logging of gRPC requests. You'll first need to add the gRPC intereceptor module to your dependencies.

Integration

With Luciq already integrated and added to your dependencies, you'll only need to add the following dependency to your applications build.gradle:

📘 Minimum SDK Version

The gRPC interceptor is supported starting SDK version 10.13.0.

Minimum SDK Version

Intercepting gRPC requests

When creating a gRPC channel using your preferred builder, create a new instance of LuciqAPMGrpcInterceptor and attach it to the builder using intercept method as shown in the example below:


Trace Attributes

Sometimes, you may need to add additional data or attributes to your network traces. This can be done using the API below.

You can add up to 20 unique trace attributes per each trace.


Payload Size

By default, Luciq captures the payload size of the request and response; this should help with determining if the payload size could be causing any issues with network delays. The payload size is the size of the payload itself, so it does not include the header's size.

Luciq automatically buckets payload sizes into different buckets based on the distribution of the data per network group, with a minimum sensitivity of 10 bytes per bucket.


Disabling/Enabling Network Performance Monitoring

Once you include the plugin as described in the Getting Started section, capturing network requests is enabled by default. However, you can still disable Network performance monitoring by configuring the plugin in your build.gradle file as described below:

Please note that Luciq does not control network logs captured in Bug and Crash reports, it only controls APM.

Last updated