'Flutter - New Relic does not trace the API Requests from Flutter

What I want:

I want to Integrate New Relic in Flutter App to trace the GraphQL API Requests executed from my App (For GraphQL Requests I've used graphql_flutter Package)

What I have done:

I have added Native Code for New Relic Integration in Android & iOS

I've added a custom plugin for New Relic (Found the plugin from here)

As per the New Relic Android SDK I have added following code in MainActivity.kt File

NewRelic.withApplicationToken("-------APIKEY------")
  .withAnalyticsEvents(true).withDistributedTraceListener(traceListener)
  .withCrashReportingEnabled(true).withInteractionTracing(true)
  .withDefaultInteractions(true).withHttpResponseBodyCaptureEnabled(true)
  .start(this.applicationContext)
         

        NewRelic.enableFeature(FeatureFlag.NetworkRequests)
        NewRelic.enableFeature(FeatureFlag.NetworkErrorRequests)
        NewRelic.enableFeature(FeatureFlag.DefaultInteractions)
        NewRelic.enableFeature(FeatureFlag.InteractionTracing)
        NewRelic.enableFeature(FeatureFlag.DistributedTracing)
        NewRelic.enableFeature(FeatureFlag.HttpResponseBodyCapture)

As per New Relic iOS SDK, I followed the Steps listed here

Issues I am facing:

  1. API Requests executed from Flutter Code are not getting logged in New Relic Dashboard
  2. Only API Requests executed from a Flutter Package which uses MethodChannel for API Requests are logged in New Relic Dashboard


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source