@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(request, response); } catch (Exception e) { BaseException translated = Seed.translateException(e); diagnosticManager.dumpDiagnosticReport(translated); throw translated; } }
@Override public void start(Context context) { for (Map.Entry<String, DiagnosticInfoCollector> entry : diagnosticInfoCollectors.entrySet()) { diagnosticManager.registerDiagnosticInfoCollector(entry.getKey(), entry.getValue()); } } }
@Override public Map<String, Object> execute(Object object) throws Exception { return diagnosticManager.getDiagnosticInfo(null); } }
private static void handleException(Exception e) { Seed.diagnostic().dumpDiagnosticReport(e); if (e instanceof SeedException) { e.printStackTrace(System.err); } else { SeedException.wrap(e, JmhErrorCode.UNEXPECTED_EXCEPTION_DURING_FORKED_BENCHMARK).printStackTrace(System.err); } }
@Override public InitState initialize(InitContext initContext) { webConfig = getConfiguration(WebConfig.class); if (servletContext != null) { diagnosticManager.registerDiagnosticInfoCollector( "web", new WebDiagnosticCollector(servletContext) ); } return InitState.INITIALIZED; }
private static void handleException(Exception e) { BaseException translated = Seed.translateException(e); Seed.diagnostic().dumpDiagnosticReport(translated); translated.printStackTrace(System.err); } }
private synchronized Kernel createKernel(KernelConfiguration kernelConfiguration, DiagnosticManager diagnosticManager) { // Kernel instantiation Kernel kernel = NuunCore.createKernel(kernelConfiguration); FallbackUrlType fallbackUrlType = new FallbackUrlType(); List<Vfs.UrlType> urlTypes = new ArrayList<>(detectedUrlTypes); urlTypes.add(fallbackUrlType); LOGGER.debug("Registered URL types for classpath scan: " + urlTypes); // Kernel initialization (it is assumed that only this class alter Vfs default url types) Vfs.setDefaultURLTypes(urlTypes); kernel.init(); Vfs.setDefaultURLTypes(savedUrlTypes); // Log if any URL were not scanned int failedUrlCount = fallbackUrlType.getFailedUrls().size(); if (failedUrlCount > 0) { for (String failedUrl : fallbackUrlType.getFailedUrls()) { LOGGER.warn("URL not scanned: {}", failedUrl); } } diagnosticManager.registerDiagnosticInfoCollector("kernel", () -> { Map<String, Object> result = new HashMap<>(); result.put("scannedUrls", kernel.scannedURLs()); result.put("failedUrls", fallbackUrlType.getFailedUrls()); return result; }); return kernel; }
private void handleException(Exception e) throws BaseException { BaseException translated = Seed.translateException(e); if (!Seed.hasLifecycleExceptionHandler()) { Seed.diagnostic().dumpDiagnosticReport(translated); } throw translated; } }
private SeedRuntime(Object context, DiagnosticManager diagnosticManager, Coffig configuration, ValidatorFactory validatorFactory, String seedVersion, String businessVersion) { this.context = context; this.diagnosticManager = diagnosticManager; this.configuration = configuration; this.validatorFactory = validatorFactory; this.seedVersion = seedVersion; this.businessVersion = businessVersion; this.diagnosticManager.registerDiagnosticInfoCollector("seed", new RuntimeDiagnosticCollector()); this.prioritizedProvider = ((CompositeProvider) this.configuration.getProvider()).get( PrioritizedProvider.class); this.inMemoryProvider = new InMemoryProvider(); registerConfigurationProvider(this.inMemoryProvider, ConfigurationPriority.DEFAULT); checkConsistency(); }
translated = throwable; diagnosticManager.dumpDiagnosticReport(throwable); translated.printStackTrace(System.err); });
@SuppressWarnings("unchecked") @Override public InitState init(InitContext initContext) { detectSystemPropertiesConfig(); detectKernelParamConfig(initContext); detectConfigurationFiles(initContext); CliContext cliContext = seedRuntime.contextAs(CliContext.class); application = new ApplicationImpl(coffig, initContext.kernelParams(), cliContext != null ? cliContext.getArgs() : new String[0]); configConfig = coffig.get(ConfigConfig.class); diagnosticManager.registerDiagnosticInfoCollector("application", new ApplicationDiagnosticCollector(application)); return InitState.INITIALIZED; }