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
public class ConfigurationDiagnostic extends GuiceyLifecycleAdapter
Guicey configuration diagnostic listener. Must be registered withGuiceBundle.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
andStatsRenderer
. 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 Classes Modifier and Type Class Description static class
ConfigurationDiagnostic.Builder
Diagnostic bundle builder.
-
Constructor Summary
Constructors Constructor Description ConfigurationDiagnostic()
Initialize bundle with default diagnostic configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applicationStarted(ApplicationStartedEvent event)
Called after complete dropwizard startup.static ConfigurationDiagnostic.Builder
builder()
static ConfigurationDiagnostic.Builder
builder(java.lang.String reportTitle)
boolean
equals(java.lang.Object obj)
int
hashCode()
-
Methods inherited from class ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
applicationRun, applicationShutdown, applicationStopped, beforeRun, bundlesInitialized, bundlesResolved, bundlesStarted, classpathExtensionsResolved, commandsResolved, configurationHooksProcessed, dropwizardBundlesInitialized, extensionsInstalled, extensionsInstalledBy, extensionsResolved, initialized, injectorCreation, installersResolved, jerseyConfiguration, jerseyExtensionsInstalled, jerseyExtensionsInstalledBy, lookupBundlesResolved, manualExtensionsValidated, modulesAnalyzed, onEvent
-
-
-
-
Method Detail
-
applicationStarted
protected void applicationStarted(ApplicationStartedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called 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:
applicationStarted
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ApplicationStarted
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
builder
public static ConfigurationDiagnostic.Builder builder()
-
builder
public static ConfigurationDiagnostic.Builder builder(java.lang.String reportTitle)
- Parameters:
reportTitle
- report name for logs- Returns:
- builder for bundle configuration
-
-