Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent unexplained logs #612

Open
ChanghyeonYoon opened this issue May 23, 2024 · 1 comment
Open

Persistent unexplained logs #612

ChanghyeonYoon opened this issue May 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ChanghyeonYoon
Copy link

ChanghyeonYoon commented May 23, 2024

Describe the bug

W/Datadog ( 3009): [_dd.sdk_core.default]: A RUM event was detected, but no view is active. To track views automatically, try calling the RumConfiguration.Builder.useViewTrackingStrategy() method.
W/Datadog ( 3009): You can also track views manually using the RumMonitor.startView() and RumMonitor.stopView() methods.

Reproduction steps

final originalOnError = FlutterError.onError;
  FlutterError.onError = (details) {
    DatadogSdk.instance.rum?.handleFlutterError(details);
    originalOnError?.call(details);
  };
  final platformOriginalOnError = PlatformDispatcher.instance.onError;
  PlatformDispatcher.instance.onError = (e, st) {
    DatadogSdk.instance.rum?.addErrorInfo(
      e.toString(),
      RumErrorSource.source,
      stackTrace: st,
    );
    return platformOriginalOnError?.call(e, st) ?? false;
  };

  final configuration = DatadogConfiguration(
    clientToken: datadogClientToken,
    env: Config.instance.env,
    site: DatadogSite.us1,
    nativeCrashReportEnabled: true,
    loggingConfiguration: DatadogLoggingConfiguration(),
    rumConfiguration: DatadogRumConfiguration(
      applicationId: datadogApplicationId,
      sessionSamplingRate: 100.0,
      reportFlutterPerformance: true,
    ),
    firstPartyHosts: ['domain.com'],
  )..enableHttpTracking();

await DatadogSdk.runApp(configuration, TrackingConsent.granted, () async {
    runApp(
      GetMaterialApp.router(
        builder: (context, child) {
          return MediaQuery(
            data: MediaQuery.of(context).copyWith(
              textScaler: const TextScaler.linear(1.0),
            ),
            child: Overlay(
              initialEntries: [
                if (child != null) ...[
                  OverlayEntry(
                    builder: (context) => RumUserActionDetector(
                      rum: DatadogSdk.instance.rum,
                      child: child,
                    ),
                  ),
                ],
              ],
            ),
          );
        },
        theme: ThemeData(
          useMaterial3: true,
          colorSchemeSeed: TWColor.lightBlue500,
        ),
        title: "myApp",
        themeMode: ThemeMode.light,
        routeInformationParser: AppPages.router.routeInformationParser,
        routeInformationProvider: AppPages.router.routeInformationProvider,
        routerDelegate: AppPages.router.routerDelegate,
        debugShowCheckedModeBanner: false,
        localizationsDelegates: const [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
        supportedLocales: const [
          Locale('ko', 'KR'),
        ],
        locale: const Locale('ko'),
      ),
    );
  });

I don't know why, but I keep getting the above log periodically.

SDK logs

No response

Expected behavior

No response

Affected SDK versions

2.3.0

Latest working SDK version

No response

Did you confirm if the latest SDK version fixes the bug?

Yes

Flutter Version

3.22.0

Setup Type

No response

Device Information

No response

Other relevant information

No response

@ChanghyeonYoon ChanghyeonYoon added the bug Something isn't working label May 23, 2024
@fuzzybinary
Copy link
Collaborator

Hi @ChanghyeonYoon ,

This occurs when we're trying to report RUM events with no active view, though the error is coming from the Android native SDK (hence the reference to functions that don't exist in the Flutter SDK).

One major culprit of this warning I realized recently is reportFlutterPerformance, which attempts to report performance metrics even when no view is active, which can get noisy on Android.

However, the best way to avoid it is to try to make sure you always have an active view, usually by having your Router call startView / stopView whenever your view changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants