DataDog / dd-sdk-flutter

Flutter bindings and tools for utilizing Datadog Mobile SDKs
Apache License 2.0
41 stars 40 forks source link

Datadog RUM is not working in Flutter Web #584

Closed ChanghyeonYoon closed 2 months ago

ChanghyeonYoon commented 3 months ago

Describe the bug

I followed the web part as written in the official documentation, but the data is not being collected in the RUM Dashboard.

Reproduction steps

index.html

<script type="text/javascript" src="https://www.datadoghq-browser-agent.com/us1/v5/datadog-logs.js"></script>
<script type="text/javascript" src="https://www.datadoghq-browser-agent.com/us1/v5/datadog-rum-slim.js"></script>

main.dart

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

await DatadogSdk.runApp(configuration, TrackingConsent.granted, () async {
    runApp()
    }
   );

In Web Inspect, downloaded sdk.

image

But in RUM Dashboard, I can't see logs web traffic.

SDK logs

No response

Expected behavior

No response

Affected SDK versions

datadog_flutter_plugin: ^2.3.0 datadog_tracking_http_client: ^2.1.0

Latest working SDK version

No response

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

Yes

Flutter Version

3.19.3

Setup Type

No response

Device Information

image

Other relevant information

No response

fuzzybinary commented 3 months ago

Hi @ChanghyeonYoon

Did you start any RUM views in your application? Either by using the Navigation Observers or my manually calling startView?

bernat-gomez commented 2 months ago

Hi @ChanghyeonYoon

Did you start any RUM views in your application? Either by using the Navigation Observers or my manually calling startView?

HI @fuzzybinary, is that step mandatory? Is there any updated docs with latest info to set up the SDK in flutter web?

Thanks

ChanghyeonYoon commented 2 months ago

After add manually calling startView, it was work! But this step in Advanced Configutaion. I think it need move to mandatory step!!

bernat-gomez commented 2 months ago

After add manually calling startView, it was work! But this step in Advanced Configutaion. I think it need move to mandatory step!!

With navigators observers property at app level works as well. Thx @ChanghyeonYoon and @fuzzybinary

fuzzybinary commented 2 months ago

Great you were able to get it working! I'll close this issue. If you have any other issues please let me know.

Is that step mandatory? Is there any updated docs with latest info to set up the SDK in flutter web?

Yes, having a view active is required, so right now this step is mandatory. That said we highly recommend using the RouterObserver over manual calls to startView and stopView.

For now, Flutter Web support is fairly limited (documentation on the limitations is here). If you need full support for Flutter Web, please reach out to your CSM to request it.