dd-sdk-flutter icon indicating copy to clipboard operation
dd-sdk-flutter copied to clipboard

Support for custom trace

Open fahmisdk6 opened this issue 2 years ago • 9 comments

We want to implement tracing where we have full control to start and stop the tracing. For example we want to track the time needed from user tap Submit button in screen A until screen B fully loaded. We currently use https://firebase.google.com/docs/perf-mon/custom-code-traces?platform=flutter#add-custom-code-traces but want to implement it in datadog.

We have tried current solutions from dd-sdk-flutter but found some restrictions:

  1. addTiming seems to only suitable to track screen opened -> something loaded
  2. track-user-action has restriction of 10s and will automatically stopped when user move to another screen
  3. track-custom-resource need to be treated as http request, need url, method etc.

We also noticed that datadog android has capability of tracing, is it equivalent to firebase perf custom trace and can we implement it in flutter? https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/android/?tab=kotlin

Thanks

fahmisdk6 avatar Oct 18 '23 02:10 fahmisdk6

Hi @fahmisdk6, thanks for filing an issue.

We currently looking into ways to support this exact use case across all of the mobile SDKs, as well as eventual support for custom tracing in the Flutter SDK, but we're still working out the specifics.

For better tracking, please also make sure you reach out to your CSM and have them file a feature request. This helps us gauge interest and prioritize appropriately.

As a workaround, Note that some folks have used start / stop resource for this. While it does require a url / http request method, you can just supply constant fake values for them. Datadog should accept the resource anyway.

However, for your use case, it sounds like you want the resource to span between two views. Is that accurate?

fuzzybinary avatar Oct 18 '23 21:10 fuzzybinary

Thank for your response, so I can conclude that the implementation is still in "gauging-interest" phase, right?

However, for your use case, it sounds like you want the resource to span between two views. Is that accurate?

Yes, the trace should be view agnostic as we only need to measure the duration between event A to event B.

fahmisdk6 avatar Oct 19 '23 02:10 fahmisdk6

Hi again @fuzzybinary, can you confirm if our use case can be catered by these two native implementations? https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/android/?tab=kotlin https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/ios/?tab=cocoapods

If yes, then my company consider to create unofficial plugin to implement these in flutter.

fahmisdk6 avatar Oct 19 '23 03:10 fahmisdk6

Hi @fahmisdk6,

We're a bit farther from gauging interest but since we are also still working out some particulars around implementation I've decided to use that tag for now (and also I want to make sure anyone who needs similar functionality reaches out to their CSM so we can get a clear picture of whether we're hitting everyone's needs).

Native tracing might work for your use case, yes. However, we actually stopped using native tracing in the Flutter SDK because of this bug which completely broke iOS tracing. It's possible this has been fixed on the Apple side, but I'm not sure.

fuzzybinary avatar Oct 19 '23 13:10 fuzzybinary