private SamplingEngine(){ producerRegistry = ProducerRegistryFactory.getProducerRegistryInstance(); }
/** * Unregister storage from producer registry. */ public void unregister() { ProducerRegistryFactory.getProducerRegistryInstance().unregisterProducer(this); }
@Override public void deInitialize() { ProducerRegistryFactory.getProducerRegistryInstance().unregisterProducer(globalRequestProcessorProducer); } }
public BuiltInRuntimeProducer(){ mxBean = ManagementFactory.getRuntimeMXBean(); statsList = new ArrayList<IStats>(1); stats = new RuntimeStats(); statsList.add(stats); BuiltinUpdater.addTask(new TimerTask() { @Override public void run() { readMbean(); }}); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); }
@Override public void initialize() { globalRequestProcessorProducer = new GlobalRequestProcessorProducer(); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(globalRequestProcessorProducer); }
/** * Creates and sets up the ProducerRegistryAPIImpl. ProducerRegistryAPIImpl is meant to be a singleton. */ ProducerRegistryAPIImpl(){ _cachedProducerList = null; _cachedProducerMap = null; _cachedIntervalInfos = null; registry = ProducerRegistryFactory.getProducerRegistryInstance(); registry.addListener(this); intervalRegistry = IntervalRegistry.getInstance(); }
public BuiltInGCProducer() { mxBeans = ManagementFactory.getGarbageCollectorMXBeans(); iStatsList = new ArrayList<>(mxBeans.size()); List<String> beanNames = new ArrayList<>(); for (GarbageCollectorMXBean bean : mxBeans) { iStatsList.add(new GCStats(bean.getName())); beanNames.add(bean.getName()); } BuiltinUpdater.addTask(new TimerTask() { @Override public void run() { readMbean(); } }); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); Accumulators.createGCAccumulators(beanNames); }
/** * Creates a new BlueprintProducer object with given parameters * @param aProducerId a producer id * @param aCategory the name of the category (for presentation needs) * @param aSubsystem the name of the subsystem (for presentation needs) */ public BlueprintProducer(String aProducerId, String aCategory, String aSubsystem){ producerId = aProducerId; category = aCategory; subsystem = aSubsystem; stats = new ActionStats("execute", getMonitoringIntervals()); statsList = new CopyOnWriteArrayList<IStats>(); statsList.add(stats); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); }
public BuiltInOSProducer() { mxBean = ManagementFactory.getOperatingSystemMXBean(); statsList = new ArrayList<IStats>(1); stats = new OSStats(); statsList.add(stats); try { clazz = Class.forName(clazzname); } catch (ClassNotFoundException e) { log.warn("Couldn't find unix version of os class: " + clazzname + ", osstats won't operate properly - " + e.getMessage()); } if (!isUnixOS) { log.warn("Couldn't find unix version of os class: " + clazzname + ", osstats won't operate properly for all stats. Current type is: " + mxBean.getClass().getName()); } BuiltinUpdater.addTask(new TimerTask() { @Override public void run() { readMbean(); } }); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); Accumulators.setupCPUAccumulators(); }
/** * Package protected constructor. */ BuiltInThreadCountProducer(){ stats = new ThreadCountStats(); statsList = new CopyOnWriteArrayList<ThreadCountStats>(); statsList.add(stats); threadMxBean = ManagementFactory.getThreadMXBean(); IProducerRegistry reg = ProducerRegistryFactory.getProducerRegistryInstance(); reg.registerProducer(this); BuiltinUpdater.addTask(new TimerTask() { @Override public void run() { readThreads(); } }); }
public TieableRepository() { ProducerRegistryFactory.getProducerRegistryInstance().addListener(this); listeners.put("default", defaultListener); UpdateTriggerServiceFactory.getUpdateTriggerService().addUpdateable(this, 60); }
/** * Creates a new storage with given wrapper. * @param aName storage name * @param aWrapper wrapper name */ public Storage(String aName, StorageWrapper<K, V> aWrapper){ name = aName + '-' + instanceCount.incrementAndGet(); wrapper = aWrapper; stats = new StorageStats(name); statsList = new ArrayList<StorageStats>(1); statsList.add(stats); category = DEF_CATEGORY; subsystem = DEF_SUBSYSTEM; IProducerRegistry reg = ProducerRegistryFactory.getProducerRegistryInstance(); reg.registerProducer(this); RuntimeException e = new RuntimeException(); e.fillInStackTrace(); creationInfo = new CreationInfo(e.getStackTrace()); }
/** * Initialization. Moved out to be reused in unit-tests. */ private void init(){ statsMap = new ConcurrentHashMap<>(); statsList = new CopyOnWriteArrayList<>(); cumulatedStats = new ErrorStats("cumulated"); statsList.add(cumulatedStats); catchers = new ConcurrentHashMap<>(); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); //add charts for cumulated errors. AfterStartTasks.submitTask(new Runnable() { @Override public void run() { AccumulatorRepository.getInstance().createAccumulator(createAccumulatorDefinition("Errors.Cumulated.Total", "total", "cumulated")); } }); AfterStartTasks.submitTask(new Runnable() { @Override public void run() { AccumulatorRepository.getInstance().createAccumulator(createAccumulatorDefinition("Errors.Cumulated.Initial", "initial", "cumulated")); } }); errorHandlingConfig = null; }
/** * Package protected constructor. */ BuiltInThreadStatesProducer(){ cumulated = new ThreadStateStats("cumulated"); statsMap = new EnumMap<>(Thread.State.class); statsList = new CopyOnWriteArrayList<ThreadStateStats>(); statsList.add(cumulated); for (Thread.State state : Thread.State.values()){ ThreadStateStats statsObject = new ThreadStateStats(state.name()); statsMap.put(state, statsObject); statsList.add(statsObject); } threadMxBean = ManagementFactory.getThreadMXBean(); IProducerRegistry reg = ProducerRegistryFactory.getProducerRegistryInstance(); reg.registerProducer(this); BuiltinUpdater.addTask(new TimerTask() { @Override public void run() { readThreads(); } }); }
category = "filter"; ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this);
/** * Creates a new MoskitoInvocationProxy with given implementation, handler and stats factory, and interfaces to monitor. * @param anImplementation Implementation object for all interfaces, i.e. MyServiceImpl * @param aHandler the call handler, i.e. net.java.dev.moskito.core.predefined.ServiceStatsCallHandler * @param factory the factory for the stats, i.e. net.java.dev.moskito.core.predefined.ServiceStatsFactory * @param producerId the id of the producer (for ui) i.e. MyService or MyService-1 ... * @param category the key/name/id for the monitored category i.e. service,api,controller,persistence * @param subsystem the key/name/id for the monitored i.e. user,shop,messaging * @param interfaces interfaces which can be called from outside, i.e. MyService */ public MoskitoInvokationProxy(Object anImplementation, IOnDemandCallHandler aHandler, IOnDemandStatsFactory<S> factory, String producerId, String category, String subsystem, Class<?>... interfaces ){ if (interfaces.length==0) throw new RuntimeException("No interfaces specified!"); implementation = anImplementation; supportedInterfaces = interfaces; handler = aHandler; producer = new OnDemandStatsProducer<>(producerId, category, subsystem, factory); producer.setTracingSupported(true); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer); guessExceptions(); }
@Override public void initialize() { if(configurationName == null) throw new PHPPluginBootstrapException("Configuration name is not set for Moskito PHP plugin"); log.info("Initializing Moskito PHP plugin with configuration " + configurationName + "..."); // Register PHP execution stats decorator DecoratorRegistryFactory.getDecoratorRegistry().addDecorator( PHPScriptExecutionStats.class, new PhpScriptExecutionStatDecorator() ); configBootstrapper = new ConfigBootstrapper(configurationName); // Loading plugin mappers and connectors configBootstrapper.bootstrapPlugin(ProducerRegistryFactory.getProducerRegistryInstance()); }
/** * Default Constructor, init mbean, mbeanServer, iStats. */ public BuiltinGlobalRequestProcessorProducer() { List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); boolean isAjp = MoskitoConfigurationHolder.getConfiguration().getTomcatRequestProcessorProducerConfig().isAjp(); boolean isHttp = MoskitoConfigurationHolder.getConfiguration().getTomcatRequestProcessorProducerConfig().isHttp(); String key = isAjp && isHttp ? "*" : isHttp ? "http*" : "ajp*"; try { for (MBeanServer server : servers) { Set<ObjectInstance> instances = server.queryMBeans(new ObjectName(String.format(MBEAN_NAME, key)), null); if (instances.size() == 0) { continue; } List<String> beanNames = initFieldsAndCreateStats(server, instances); addUpdaterTask(); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); Accumulators.createGlobalRequestProcessorAccumulators(beanNames); break; } } catch (MalformedObjectNameException e) { log.error("Failed to get GlobalRequestProcessor mbeans", e); } }
IProducerRegistry registry = ProducerRegistryFactory.getProducerRegistryInstance(); if (config.isJavaMemoryProducers()){ registry.registerProducer(new BuiltInMemoryProducer(BuiltInMemoryProducer.FREE));
return p; ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer);