protected AbstractMetricsReader(final T config) { this.config = config; this.logger = LoggerFactory.getLogger("reader." + config.getName()); this.timingsLogger = LoggerFactory.getLogger("timings.reader"); variables = prepareVariables(); }
private Map<String, Object> prepareVariables() { final Map<String, Object> result = new HashMap<>(); result.putAll(config.getVariables()); try { @SuppressWarnings("unchecked") final Map<String, Object> configProperties = BeanUtils.describe(config); for (final Entry<String, Object> entry : configProperties.entrySet()) { final String name = entry.getKey(); if (!IGNORED_CONFIG_PROPERTIES.contains(name)) { result.put(CONFIG_VAR_PREFIX + "." + name, entry.getValue()); } } } catch (final IllegalAccessException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } catch (final InvocationTargetException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } catch (final NoSuchMethodException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } defineCustomVariables(result); return Collections.unmodifiableMap(result); }
private Map<String, Object> prepareVariables() { final Map<String, Object> result = new HashMap<>(); result.putAll(config.getVariables()); try { @SuppressWarnings("unchecked") final Map<String, Object> configProperties = BeanUtils.describe(config); for (final Entry<String, Object> entry : configProperties.entrySet()) { final String name = entry.getKey(); if (!IGNORED_CONFIG_PROPERTIES.contains(name)) { result.put(CONFIG_VAR_PREFIX + "." + name, entry.getValue()); } } } catch (final IllegalAccessException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } catch (final InvocationTargetException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } catch (final NoSuchMethodException e) { logger.warn("Failed to introspect configuration bean: " + config, e); } defineCustomVariables(result); return Collections.unmodifiableMap(result); }
protected AbstractMetricsReader(final T config) { this.config = config; this.logger = LoggerFactory.getLogger("reader." + config.getName()); this.timingsLogger = LoggerFactory.getLogger("timings.reader"); variables = prepareVariables(); }