/** * Should only be used outside of this class by the internal unit tests */ @Deprecated public static void reset(MeasurementSession measurementSession) { started = false; disabled = false; if (configuration == null) { reloadPluginsAndConfiguration(); } if (measurementSession == null) { CorePlugin corePlugin = getPlugin(CorePlugin.class); measurementSession = new MeasurementSession(corePlugin.getApplicationName(), corePlugin.getHostName(), corePlugin.getInstanceName()); } onShutdownActions.add(AgentAttacher.performRuntimeAttachment()); startMonitoring(measurementSession); healthCheckRegistry.register("Startup", new HealthCheck() { @Override protected Result check() throws Exception { if (started) { return Result.healthy(); } else { return Result.unhealthy("stagemonitor is not started"); } } }); logStatus(); new ConfigurationLogger().logConfiguration(configuration); }
public <T extends RequestTrace> void monitorStart(MonitoredRequest<T> monitoredRequest) { final long start = System.nanoTime(); RequestInformation<T> info = new RequestInformation<T>(); info.monitoredRequest = monitoredRequest; detectForwardedRequest(info); request.set(info); try { if (!corePlugin.isStagemonitorActive()) { return; } if (Stagemonitor.getMeasurementSession().isNull()) { createMeasurementSession(); } info.firstRequest = noOfRequests.get() == 0; if (Stagemonitor.getMeasurementSession().getInstanceName() == null) { getInstanceNameFromExecution(monitoredRequest); } if (info.monitorThisRequest()) { if (!Stagemonitor.isStarted()) { info.startup = Stagemonitor.startMonitoring(); } beforeExecution(monitoredRequest, info); } } finally { info.overhead1 = System.nanoTime() - start; } }