Package ru.vyarus.dropwizard.guice.debug
Class ConfigurationDiagnostic
java.lang.Object
ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
ru.vyarus.dropwizard.guice.debug.ConfigurationDiagnostic
- All Implemented Interfaces:
GuiceyLifecycleListener
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDiagnostic bundle builder. -
Constructor Summary
ConstructorsConstructorDescriptionInitialize bundle with default diagnostic configuration. -
Method Summary
Methods inherited from class ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
applicationRun, applicationShutdown, applicationStarting, applicationStopped, beforeInit, beforeRun, bundlesInitialized, bundlesResolved, bundlesStarted, classpathExtensionsResolved, commandsResolved, configurationHooksProcessed, dropwizardBundlesInitialized, extensionsInstalled, extensionsInstalledBy, extensionsResolved, initialized, injectorCreation, installersResolved, jerseyConfiguration, jerseyExtensionsInstalled, jerseyExtensionsInstalledBy, lookupBundlesResolved, manualExtensionsValidated, modulesAnalyzed, onEvent
-
Constructor Details
-
ConfigurationDiagnostic
public ConfigurationDiagnostic()Initialize bundle with default diagnostic configuration. Configures most commonly required info. Suitable for bundle usage with lookup mechanism.
-
-
Method Details
-
applicationStarted
Description copied from class:GuiceyLifecycleAdapterCalled after complete dropwizard startup. Actually the same as jetty lifecycle started event (LifeCycle.Listener.lifeCycleStarted(org.eclipse.jetty.util.component.LifeCycle)), which is called after complete jetty startup.- Overrides:
applicationStartedin classGuiceyLifecycleAdapter- Parameters:
event- event object- See Also:
-
equals
-
hashCode
public int hashCode() -
builder
- Returns:
- diagnostic report configuration builder
-
builder
- Parameters:
reportTitle- report name for logs- Returns:
- builder for bundle configuration
-