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

iOS: Tracing feature is enabled, but no Tracer is registered. The Tracing integration with Logging will not work. #280

Closed
masterwok opened this issue Nov 15, 2022 · 2 comments · Fixed by #281
Labels
bug Something isn't working

Comments

@masterwok
Copy link

I'm seeing the warning, Tracing feature is enabled, but no 'Tracer' is registered. The Tracing integration with Logging will not work. when debugging an iOS application with the logging verbosity set to verbose. We are not seeing this warning on Android.

I found a reference to this warning in a react native ticket which may offer a little more insight: https://github.com/datadog/dd-sdk-reactnative/issues/135?ref=https://coder.social

What is the cause of this warning and how can it be resolved? Any help is greatly appreciated. Thank you for all of your help so far!

flutter: [DATADOG SDK] 🐶 → 11:41:51.800 ⚠️ Tracing feature is enabled, but no `Tracer` is registered. The Tracing integration with Logging will not work.
flutter: [DATADOG SDK] 🐶 → 11:42:13.822 NTP time synchronization completed.
Server time will be used for signing events (0.024s difference with device time).
flutter: [DATADOG SDK] 🐶 → 11:42:17.204 💡 (tracing) No upload. Batch to upload: NO, System conditions: ✅
flutter: [DATADOG SDK] 🐶 → 11:42:17.208 ⏳ (RUM) Uploading batch...
flutter: [DATADOG SDK] 🐶 → 11:42:17.209 ⏳ (logging) Uploading batch...
flutter: [DATADOG SDK] 🐶 → 11:42:17.363    → (RUM) accepted, won't be retransmitted: [response code: 202 (accepted), request ID: 0C937F77-FEE4-4C05-B993-6F49F486CFE7]
flutter: [DATADOG SDK] 🐶 → 11:42:17.374    → (logging) accepted, won't be retransmitted: [response code: 202 (accepted), request ID: CCB6AE3A-3974-4810-A4E5-9C5694250C5B]
flutter: [DATADOG SDK] 🐶 → 11:42:41.202 💡 (RUM) No upload. Batch to upload: NO, System conditions: ✅

Our DataDog initialization use case is the following:

class InitializeDatadog extends CommandUseCase<void> {
  static final _protocolRegex = RegExp('http(s)*:\\/\\/');

  final DatadogConfig _datadogConfig;
  final ProxyConfig _proxyConfig;
  final List<String> _firstPartyHosts;

  InitializeDatadog(
    this._datadogConfig,
    this._proxyConfig,
    this._firstPartyHosts,
  );

  @override
  Future<void> invoke() async {
    if (!kReleaseMode) {
      DatadogSdk.instance.sdkVerbosity = Verbosity.verbose;
    }

    final hostsWithoutProtocol = _firstPartyHosts.map((host) => host.replaceAll(_protocolRegex, '')).toList();

    final datadogConfig = DdSdkConfiguration(
      clientToken: _datadogConfig.clientToken,
      env: _datadogConfig.environment,
      serviceName: _datadogConfig.serviceName,
      site: DatadogSite.us1,
      trackingConsent: TrackingConsent.granted,
      nativeCrashReportEnabled: true,
      firstPartyHosts: hostsWithoutProtocol,
      loggingConfiguration: LoggingConfiguration(
        sendLogsToDatadog: true,
        sendNetworkInfo: true,
      ),
      rumConfiguration: RumConfiguration(applicationId: _datadogConfig.rumApplicationId),
    );

    // Only enable HTTP tracking when the proxy is disabled as doing so will override the HTTP overrides in place by our
    // proxy.
    if (!_proxyConfig.isProxyEnabled) {
      datadogConfig.enableHttpTracking();
    }

    await DatadogSdk.instance.initialize(datadogConfig);
  }
}

We're also using the DatadogNavigationObserver within our MaterialApp configuration and our InitializeDataDog use case is invoked before the MaterialApp widget is built.

        return MaterialApp(
          debugShowCheckedModeBanner: false,
          localizationsDelegates: const [
            S.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          theme: themeLight(context),
          darkTheme: themeDark(context),
          themeMode: themeMode,
          supportedLocales: S.delegate.supportedLocales,
          navigatorKey: widget._navigatorKey,
          initialRoute: widget._isUserAuthenticated ? Routes.dashboard : Routes.onBoarding,
          onGenerateInitialRoutes: (initialRoute) => _onGenerateInitialRoutes(initialRoute, isUserPinSet),
          navigatorObservers: [
            DatadogNavigationObserver(datadogSdk: DatadogSdk.instance),
          ],
          routes: Routes.routeMap,
        );

Describe what you expected:

I'm not expecting to avoid seeing a warning that tracing will not work.

Additional context

  • Dart/Flutter version: Flutter 3.3.7
  • Android/iOS OS version: iOS
  • Device Model: iPhone 13 simulator
  • Datadog SDK version: 1.1.1
  • Versions of any other relevant dependencies: datadog_tracking_http_client: ^1.1.0
@masterwok masterwok added the bug Something isn't working label Nov 15, 2022
@fuzzybinary
Copy link
Member

Hi @masterwok -- I'll take a look at what might be causing that message, but the warning can safely be ignored.

This is referring to native Trace and Span creation, which is possible in the Native SDKs but was deprecated in Flutter (see #146 for reasons why).

This won't affect the distributed traces available as part of the datadog_tracing_http_client package.

fuzzybinary added a commit that referenced this issue Nov 16, 2022
Tracing was enabled by default, as was "bundleWithTracing" on logs, which was resulting in an extra warning on initialization.

Fixes #280
@masterwok
Copy link
Author

Thank you!

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

Successfully merging a pull request may close this issue.

2 participants