Class FlurryPerformance.HttpLogger

java.lang.Object
com.flurry.android.FlurryPerformance.HttpLogger
Enclosing class:
FlurryPerformance

public static class FlurryPerformance.HttpLogger extends Object
Provide a HttpLogger class that users can create before connection, then log event after. Flurry will compute the time.

 Example#1: (inside user’s own interceptor when merging is not easy)
   OkHttpClient client = new OkHttpClient.Builder()
       .addInterceptor(new HttpInterceptor() {
          @Override
           public Response intercept(Chain chain) throws IOException {
               Request request = chain.request();

               FlurryPerformance.HttpLogger logger = new FlurryPerformance.HttpLogger();
               Response response = chain.proceed(request);
               logger.logEvent(MyGroupID, request, response);

               return response;
           }
       })
       .build();

 Example#2: (provide your own data, or for any connection call like HttpURLConnection)
   URL url = new URL("https://www.example.com/");
   FlurryPerformance.HttpLogger logger = new FlurryPerformance.HttpLogger();
   HttpURLConnection connection = (HttpURLConnection) url.openConnection();
   ...
   logger.logEvent(MyGroupID, connection.getURL().toString(), connection.getResponseCode(),
           connection.getURL().toString());
 
  • Constructor Details

    • HttpLogger

      public HttpLogger()
  • Method Details

    • logEvent

      public void logEvent(String id, okhttp3.Request request, okhttp3.Response response)
      Log Flurry HTTP/S Network Requests events with okhttp3.Request and okhttp3.Response.
      Parameters:
      id - The group ID
      request - okhttp3.request instance
      response - okhttp3.Response instance
    • logEvent

      public void logEvent(String id, String requestUrl, int responseCode, String responseUrl)
      Log Flurry HTTP/S Network Requests events with users provided data.
      Parameters:
      id - The group ID
      requestUrl - Request URL
      responseCode - Response code
      responseUrl - Response URL