@Override public String toString() { return getClass().getSimpleName() + "[" + config.getName() + "]"; }
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); }
@Override public String toString() { return getClass().getSimpleName() + "[" + config.getName() + "]"; }
protected AbstractMetricsReader(final T config) { this.config = config; this.logger = LoggerFactory.getLogger("reader." + config.getName()); this.timingsLogger = LoggerFactory.getLogger("timings.reader"); variables = prepareVariables(); }
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, InputConfig> configureInputs(final List<InputXBean> list) { final LinkedHashMap<String, InputXBean> xbeans = TemplatableXBeanUtils.sortByDependency(list); final Map<String, InputConfig> result = new HashMap<>(); for (final InputXBean fromItem : xbeans.values()) { TemplatableXBeanUtils.applyTemplate(fromItem, xbeans); if (fromItem.isInstantiatable()) { final InputConfig item = fromItem.toConfig(); if (result.containsKey(item.getName())) { throw new ConfigurationException("Two inputs with the same name "+item.getName()); } result.put(item.getName(), item); } } return result; }
private Map<String, InputConfig> configureInputs(final List<InputXBean> list) { final LinkedHashMap<String, InputXBean> xbeans = TemplatableXBeanUtils.sortByDependency(list); final Map<String, InputConfig> result = new HashMap<>(); for (final InputXBean fromItem : xbeans.values()) { TemplatableXBeanUtils.applyTemplate(fromItem, xbeans); if (fromItem.isInstantiatable()) { final InputConfig item = fromItem.toConfig(); if (result.containsKey(item.getName())) { throw new ConfigurationException("Two inputs with the same name "+item.getName()); } result.put(item.getName(), item); } } return result; }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(inputs); final GlobalObjectFactory factory = bootstrapper; for(final InputConfig input : bootstrapper.getConfiguration().getInputs()) { SamplerStats.init(); if (names.isEmpty() || names.contains(input.getName())) { final MetricsReader reader = factory.newReaderForInput(input); reader.open(); System.out.println("Reader: " + input.getName()); for(final MetricName item : reader.readNames()) { System.out.println("\tName:" + item.getName()); System.out.println("\tDescription:" + item.getDescription()); } reader.close(); SamplerStats.unset(); } } } }
@Override protected void runBootstrapped() { final Set<String> names = new HashSet<>(); names.addAll(inputs); final GlobalObjectFactory factory = bootstrapper; for(final InputConfig input : bootstrapper.getConfiguration().getInputs()) { SamplerStats.init(); if (names.isEmpty() || names.contains(input.getName())) { final MetricsReader reader = factory.newReaderForInput(input); reader.open(); System.out.println("Reader: " + input.getName()); for(final MetricName item : reader.readNames()) { System.out.println("\tName:" + item.getName()); System.out.println("\tDescription:" + item.getDescription()); } reader.close(); SamplerStats.unset(); } } } }