Class ConfigurationDiagnostic

  • All Implemented Interfaces:
    GuiceyLifecycleListener

    public class ConfigurationDiagnostic
    extends GuiceyLifecycleAdapter
    Guicey configuration diagnostic listener. Must be registered with GuiceBundle.Builder.listen( ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleListener...). Prints detailed configuration info and startup metrics.

    Sections:

    • startup stats - collected timers and counters showing how much time were spent on different stages
    • options - used options
    • diagnostic section - summary of installed bundles, modules, used installers and extensions (showing execution order). Shows what was configured.
    • context tree - tree showing configuration hierarchy (configuration sources). Shows from where configuration parts come from.

    Reporting is highly configurable. Default configuration shows most valuable (but not all possible) info. To create bundle with custom configuration use builder:

    
          ConfigurationDiagnostic.builder()
              .printStartupStats(true)
              .printConfiguration(new DiagnosticConfig().printAll())
              .build();
     

    Actual diagnostic rendering is performed by DiagnosticRenderer, ContextTreeRenderer, OptionsRenderer and StatsRenderer. They may be used directly, for example, to show report on web page.

    Reporting is performed after context startup (pure guicey context (in tests) or entire web context) and so does not affect collected statistics (timings).

    Only one listener with the same title will be registered to allow safe multiple registrations (de-duplication).

    Since:
    16.08.2019
    • Constructor Detail

      • ConfigurationDiagnostic

        public ConfigurationDiagnostic()
        Initialize bundle with default diagnostic configuration. Configures most commonly required info. Suitable for bundle usage with lookup mechanism.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • builder

        public static ConfigurationDiagnostic.Builder builder​(java.lang.String reportTitle)
        Parameters:
        reportTitle - report name for logs
        Returns:
        builder for bundle configuration