[Alpha] Configure the Splunk RUM Flutter agent

Configure Splunk RUM instrumentation for your Flutter applications.

Attention:

Alpha features described in this document are provided by Splunk to you "as is" without any warranties, maintenance and support, or service-level commitments. Splunk makes this alpha feature available in its sole discretion and may discontinue it at any time. These documents are not yet publicly available and we ask that you keep such information confidential. Use of alpha features is subject to the Splunk Pre-Release Agreement for Hosted Services.

AgentConfiguration

You can configure the Splunk RUM Flutter agent to add custom attributes, adapt the instrumentation to your environment and application, customize sampling, and more.

To configure the Splunk RUM Flutter agent, pass the settings to the agent in an AgentConfiguration object. The following example shows how to configure this object with your Splunk RUM token, Splunk realm, application name, and deployment environment:

SplunkOtelFlutter.instance.install(
    agentConfiguration: AgentConfiguration(
      endpointConfiguration: EndpointConfiguration.forRum(
        realm: 'Your realm',
        rumAccessToken: 'Your app name',
      ),
      appName: 'Your app name',
      deploymentEnvironment: 'Your dev env',
    ),
  );

General settings

Use the following settings to configure the Splunk RUM Flutter agent's AgentConfiguration object:

OptionDescription
appName (required)Sets the application name.
appVersionSets the application version.
deferredUntilForeground

Defer telemetry until the app is brought to the foreground. Default: false

Android only.

deploymentEnvironment (required)Environment for all the spans produced by the application. For example, dev, test, or prod.
enableDebugLoggingActivates debug logging. Default: false
endpointSets the configuration needed to export data to an endpoint. There are two required inputs:
globalAttributesAttributes to append to every span collected. For an example, see Manage global attributes.
instrumentedProcessName

Compares application ID and process name. If they are the same, the application is visible to user. If not, it is the background process.

Android only.

session

Configured by SessionConfiguration for configuring sessions. It has following properties:

  • samplingRate Activates session ID based sampling and sets a sampling ratio. The sampling ratio is the probability of a session being included. Valid values: 0.0 (all dropped) to 1.0 (all included).
user

Configured by UserConfiguration for end user tracking. It has following properties:

  • trackingMode with a default of NO TRACKING.

Instrumentation module settings

You can configure the following modules in the Splunk RUM Flutter agent:

Note: A module's settings only take effect if you activate that module (set its isEnabled attribute to true). All modules except navigation detection are activated by default.

HTTP instrumentation module

Automatic network instrumentation

The Splunk RUM Flutter agent supports automatic instrumentation for the OkHttp and HttpURLConnection HTTP clients for Android.

  • Okhttp3 (Android only)

    This instrumentation automatically modifies the code at build time and adds the necessary hooks for tracing network requests made through the OkHttp3 APIs. To activate this, add the following plugin to your Android application:

    SplunkOtelFlutter.instance.install(
        moduleConfigurations: [
          OkHttp3AutoModuleConfiguration(
            isEnabled: true,
            capturedRequestHeaders: [],
            capturedResponseHeaders: [],
          ),
        ],
      );
    Note: If you don't add the plugin to the application at build time, the runtime OkHttp3AutoModuleConfiguration will have no effect.
  • HttpUrlConnection (Android only)

    This instrumentation automatically modifies the code at build time and adds the necessary hooks for tracing network requests made via the URLConnection , HttpURLConnection, or HttpsURLConnection APIs. To enable this, add the following plugin to your Android application.

    SplunkOtelFlutter.instance.install(
        moduleConfigurations: [
          HttpUrlModuleConfiguration(
            isEnabled: true,
            capturedRequestHeaders: [],
            capturedResponseHeaders: [],
          ),
        ],
      );
    Note: If you don't add the plugin to the application at build time, the runtime HttpUrlModuleConfiguration will have no effect.
    Note:

    Note: There is currently an open issue with Google that may result in a build failure when an application is built with these plugins. It's related to the Jetifier. The issue is tracked in the Google Issue Tracker and can be resolved by setting the enableJetifier flag to false in your gradle.properties file. For example, android.enableJetifier=false

Manual OkHttp instrumentation (Android only)

Not available in the alpha release.

Capture request and response headers (Android only)

You can opt-in to capture certain request and response headers using the HTTP instrumentation module. If those headers are available, the resulting span will contain http.request.header.key and http.response.header.key attributes with the header value(s).

SplunkOtelFlutter.instance.install(
  moduleConfigurations: [
    HttpUrlModuleConfiguration(
      isEnabled: true,
      capturedRequestHeaders: [
        'authorization',
        'content-type',
        'user-agent',
      ],
      capturedResponseHeaders: [
        'content-type',
        'cache-control',
      ],
    ),
    OkHttp3AutoModuleConfiguration(
      isEnabled: true,
      capturedRequestHeaders: [
        'authorization',
        'accept',
      ],
      capturedResponseHeaders: [
        'content-type',
        'content-length',
      ],
    ),
  ],
);
Automatic URLSession instrumentation (iOS only)

Configure automatic instrumentation for URLSession clients to make HTTP network requests.

Specify patterns for NSRegularExpression to exclude requests from instrumentation as in the example below.

SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      NetworkInstrumentationModuleConfiguration(
        isEnabled: true,
        ignoreURLs: [
          RegularExpression(
            pattern: "123",
            options: [
              RegexOption.allowCommentsAndWhitespace,
              RegexOption.anchorsMatchLines,
            ],
          ),
        ],
      ),
    ],
  );
Track navigation events automatically

Automatic detection of screen names is deactivated by default. You can activate it through the isAutomatedTrackingEnabled setting as shown in the examples below.

SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      NavigationModuleConfiguration(
        isEnabled: true,
        isAutomatedTrackingEnabled: false,
      ),
    ],
  );
Track navigation events manually

See Manually track navigation events.

Crash reporting module

The crash reporting module is included in the new Splunk RUM Flutter agent and is activated by default. No additional steps are needed to activate crash reporting. If you want to deactivate crash reporting, see an example below on settings.

Tip: See what attributes are included when this module is activated: Android, iOS.
SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      CrashReportsModuleConfiguration(isEnabled: false)
    ],
  );

Application not responding module (Android only)

Application not responding (ANR) occurs when an Android application's main thread is blocked for more than five seconds, preventing it from processing user input. The detection of ANRs is activated by default. You can deactivate it by setting AnrModuleConfiguration to false as shown in the examples below.

SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      AnrModuleConfiguration(isEnabled: false),
    ],
  );

Slow rendering module

The slow rendering module is activated by default. You can configure its frame detection interval as shown in the examples below.

Tip: See what attributes are included when this module is activated: Android, iOS.
SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      SlowRenderingModuleConfiguration(isEnabled: false, 
      interval: const Duration(seconds: 1)
      ),
    ],
  );

Interaction detection module

Interaction detection is enabled by default. You can deactivate it by setting the isEnabled parameter as in the examples below.

Tip: See what attributes are included when this module is activated: Android, iOS.
SplunkOtelFlutter.instance.install(
    moduleConfigurations: [
      InteractionsModuleConfiguration(isEnabled: false),
    ],
  );

Application lifecycle monitoring module

The application lifecycle monitoring module is included in the new Splunk RUM Flutter agent and is activated by default. To deactivate application lifecycle monitoring, see examples below.

Tip: See what attributes are included when this module is activated: Android, iOS.
placeholder