/** * Constructor. * * @param configuration Module configuration * @param reporters Reporter list * @param globalConfiguration Global diagnostics configuration * @throws ConfigurationException in case the provided module configuration is not valid */ public SlowQueryModule(ModuleConfiguration configuration, List<Reporter> reporters, final GlobalConfiguration globalConfiguration) throws ConfigurationException { super(configuration, reporters, globalConfiguration); config = SlowQueryConfiguration.create(configuration.options); service = configuration.getMeasurementOrDefault(DEFAULT_MEASUREMENT_NAME); slowQueryCountMeasurementName = service + SLOW_QUERY_COUNT_SUFFIX; slowQueryLogDecider = SlowQueryLogDecider.create(config); slowQueryCounts = new HashMap<>(); for (StatementType statementType : StatementType.values()) { slowQueryCounts.put(statementType, new AtomicCounter()); } if (config.slowQueryCountReportEnabled()) { timer = new Timer(SLOW_QUERY_COUNT_THREAD_NAME); timer.schedule(new SlowQueryReportTask(), 0, config.slowQueryCountReportingRateInMillis()); } else { timer = null; } }