when(corePlugin.getThreadPoolQueueCapacityLimit()).thenReturn(1000); when(corePlugin.getApplicationName()).thenReturn("JaxRsRequestNameDeterminerTransformerTest"); when(corePlugin.getInstanceName()).thenReturn("test"); when(tracingPlugin.getDefaultRateLimitSpansPerMinute()).thenReturn(1000000d); when(tracingPlugin.getDefaultRateLimitSpansPerMinuteOption()).thenReturn(mock(ConfigurationOption.class));
/** * 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); }
doReturn(spanWrappingTracer).when(tracingPlugin).getTracer(); doReturn("testApplication").when(corePlugin).getApplicationName(); doReturn("testInstance").when(corePlugin).getInstanceName(); servletPlugin.initializePlugin(new StagemonitorPlugin.InitArguments(mock(Metric2Registry.class), configuration, mock(MeasurementSession.class), mock(HealthCheckRegistry.class)));
@Override public void initInternal(FilterConfig filterConfig) throws ServletException { final MeasurementSession measurementSession = new MeasurementSession(getApplicationName(filterConfig), corePlugin.getHostName(), corePlugin.getInstanceName()); Stagemonitor.setMeasurementSession(measurementSession); final ServletContext servletContext = filterConfig.getServletContext(); atLeastServletApi3 = servletContext.getMajorVersion() >= 3; for (HtmlInjector htmlInjector : ServiceLoader.load(HtmlInjector.class)) { htmlInjector.init(new HtmlInjector.InitArguments(configuration, servletContext)); htmlInjectors.add(htmlInjector); } }
private synchronized void createMeasurementSession() { if (Stagemonitor.getMeasurementSession().isNull()) { MeasurementSession session = new MeasurementSession(corePlugin.getApplicationName(), corePlugin.getHostName(), corePlugin.getInstanceName()); Stagemonitor.setMeasurementSession(session); } }