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

Way to time guice providers #323

Open
Kalyan-M opened this issue Jul 18, 2023 · 1 comment
Open

Way to time guice providers #323

Kalyan-M opened this issue Jul 18, 2023 · 1 comment

Comments

@Kalyan-M
Copy link

I have a lot of provider methods in a guice module. I want to time every provider method in order to debug startup time of my application. Does guicy have any mechanism to achieve this? If not, is there any way I can implement a custom annotation to time the methods instead of manually adding timers to all methods?

@xvik
Copy link
Owner

xvik commented Jul 24, 2023

Diagnostic report shows internal guice timers:

GuiceBundle.builder() 
    ...
    .printDiagnosticInfo()

Output will contain something like this:

    ├── [47%] INJECTOR created in 204.2 ms
    │   ├── Module execution: 124 ms
    │   ├── Interceptors creation: 2 ms
    │   ├── TypeListeners & ProvisionListener creation: 2 ms
    │   ├── Scopes creation: 1 ms
    │   ├── Binding creation: 20 ms
    │   ├── Module annotated method scanners creation: 1 ms
    │   ├── Binding initialization: 29 ms
    │   ├── Collecting injection requests: 2 ms
    │   ├── Static validation: 3 ms
    │   ├── Instance member validation: 3 ms
    │   ├── Provider verification: 1 ms
    │   ├── Static member injection: 7 ms
    │   ├── Instance injection: 3 ms
    │   └── Preloading singletons: 4 ms

These are intercepted internal guice timers (guice internal stats) and there is no other stats (provided by guice). If it will not be enough you will have to write your own timers.

Configuration report docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants