Amanjeet Singh

    Amanjeet Singh

    1 year ago
    Excited to announce DaggerTrack, A Gradle plugin that automatically adds clock tracking to dagger components and their subcomponents. Snapshots available now: https://github.com/amanjeetsingh150/dagger-track Project Website: https://amanjeetsingh150.github.io/dagger-track/ Useful for people optimizing their dagger graphs. Gives you wall clock time, on CPU and off CPU time for your injection. Do try it and give your reviews for further improvements. Contributions, feature requests, and issues are welcome.
    Colton Idle

    Colton Idle

    1 year ago
    Ooh. Sounds interesting. Will try to integrate this later tonight.
    Jeremy

    Jeremy

    1 year ago
    Can library track the first time a dependency is initialized? Some things like OkHttp/Gson introduce delay when first init but the actual injection is fast I've found
    Amanjeet Singh

    Amanjeet Singh

    1 year ago
    Hey @Jeremy thanks for reaching out currently DaggerTrack gives you total time took by dependencies of class say your application class to inject. The time per dependency is something which is in pipeline for this. But you can still see which of your classes took largest time to inject by replicating a cold start through adb commands and then narrow down through debug API tracing to see what is taking maximum time. Hope the answer helps. Let me know if you need any further help on this.
    Jeremy

    Jeremy

    1 year ago
    👍 Currently we just add firebase trackers in modules. I've found in multiple apps that init of dagger graph is longest single component of app startup. Maybe library could allow folks to inject arbitrary tracking code for integration w/ their own trackers in prod
    Amanjeet Singh

    Amanjeet Singh

    1 year ago
    Agreed, the dagger init is longest. For now, you can profile on your release debuggable builds to see which component is taking maximum and then further use this debug API record trace for that component injection to record per dependency timehttps://developer.android.com/reference/android/os/Debug#startMethodTracing(java.lang.String,%20int,%20int)
    For recording the particular time in production as you suggested through trackers I have thought of some ideas like exposing annotations from library which will help you to record any desired dependency and then dump tracking logs to a file or maybe analytics. Will definitely work on this. Let me know if you any other feedbacks while using the library 🙂
    Jeremy

    Jeremy

    1 year ago
    yep annotations would work, we currently just use
    @AddTrace
    on the module methods for "expensive" dependencies (okhttp, gson, react native) etc
    If doing this automatically I'd make sure to post whether main thread or not