Search in sources :

Example 1 with DistributionStats

use of org.apache.geode.distributed.internal.DistributionStats in project geode by apache.

the class MemberMBeanBridge method init.

public MemberMBeanBridge init() {
    CachePerfStats cachePerfStats = this.cache.getCachePerfStats();
    addCacheStats(cachePerfStats);
    addFunctionStats(system.getFunctionServiceStats());
    if (system.getDistributionManager().getStats() instanceof DistributionStats) {
        DistributionStats distributionStats = (DistributionStats) system.getDistributionManager().getStats();
        addDistributionStats(distributionStats);
    }
    if (PureJavaMode.osStatsAreAvailable()) {
        Statistics[] systemStats = null;
        if (HostStatHelper.isSolaris()) {
            systemStats = system.findStatisticsByType(SolarisSystemStats.getType());
        } else if (HostStatHelper.isLinux()) {
            systemStats = system.findStatisticsByType(LinuxSystemStats.getType());
        } else if (HostStatHelper.isOSX()) {
            // @TODO once OSX stats are implemented
            systemStats = null;
        } else if (HostStatHelper.isWindows()) {
            systemStats = system.findStatisticsByType(WindowsSystemStats.getType());
        }
        if (systemStats != null) {
            systemStat = systemStats[0];
        }
    }
    MemoryAllocator allocator = this.cache.getOffHeapStore();
    if ((null != allocator)) {
        OffHeapMemoryStats offHeapStats = allocator.getStats();
        if (null != offHeapStats) {
            addOffHeapStats(offHeapStats);
        }
    }
    addSystemStats();
    addVMStats();
    initializeStats();
    return this;
}
Also used : MemoryAllocator(org.apache.geode.internal.offheap.MemoryAllocator) OffHeapMemoryStats(org.apache.geode.internal.offheap.OffHeapMemoryStats) CachePerfStats(org.apache.geode.internal.cache.CachePerfStats) Statistics(org.apache.geode.Statistics) LRUStatistics(org.apache.geode.internal.cache.lru.LRUStatistics) DistributionStats(org.apache.geode.distributed.internal.DistributionStats)

Example 2 with DistributionStats

use of org.apache.geode.distributed.internal.DistributionStats in project geode by apache.

the class JGroupsMessengerJUnitTest method initMocks.

/**
   * Create stub and mock objects
   */
private void initMocks(boolean enableMcast, Properties addProp) throws Exception {
    if (messenger != null) {
        messenger.stop();
        messenger = null;
    }
    Properties nonDefault = new Properties();
    nonDefault.put(DISABLE_TCP, "true");
    nonDefault.put(MCAST_PORT, enableMcast ? "" + AvailablePortHelper.getRandomAvailableUDPPort() : "0");
    nonDefault.put(MCAST_TTL, "0");
    nonDefault.put(LOG_FILE, "");
    nonDefault.put(LOG_LEVEL, "fine");
    nonDefault.put(LOCATORS, "localhost[10344]");
    nonDefault.put(ACK_WAIT_THRESHOLD, "1");
    nonDefault.putAll(addProp);
    DistributionConfigImpl config = new DistributionConfigImpl(nonDefault);
    RemoteTransportConfig tconfig = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE);
    stopper = mock(Stopper.class);
    when(stopper.isCancelInProgress()).thenReturn(false);
    manager = mock(Manager.class);
    when(manager.isMulticastAllowed()).thenReturn(enableMcast);
    healthMonitor = mock(HealthMonitor.class);
    joinLeave = mock(JoinLeave.class);
    ServiceConfig serviceConfig = new ServiceConfig(tconfig, config);
    services = mock(Services.class);
    when(services.getConfig()).thenReturn(serviceConfig);
    when(services.getCancelCriterion()).thenReturn(stopper);
    when(services.getHealthMonitor()).thenReturn(healthMonitor);
    when(services.getManager()).thenReturn(manager);
    when(services.getJoinLeave()).thenReturn(joinLeave);
    DM dm = mock(DM.class);
    InternalDistributedSystem system = InternalDistributedSystem.newInstanceForTesting(dm, nonDefault);
    when(services.getStatistics()).thenReturn(new DistributionStats(system, statsId));
    messenger = new JGroupsMessenger();
    messenger.init(services);
    // if I do this earlier then test this return messenger as null
    when(services.getMessenger()).thenReturn(messenger);
    String jgroupsConfig = messenger.getJGroupsStackConfig();
    int startIdx = jgroupsConfig.indexOf("<org");
    int insertIdx = jgroupsConfig.indexOf('>', startIdx + 4) + 1;
    jgroupsConfig = jgroupsConfig.substring(0, insertIdx) + "<" + InterceptUDP.class.getName() + "/>" + jgroupsConfig.substring(insertIdx);
    messenger.setJGroupsStackConfigForTesting(jgroupsConfig);
    // System.out.println("jgroups config: " + jgroupsConfig);
    messenger.start();
    messenger.started();
    interceptor = (InterceptUDP) messenger.myChannel.getProtocolStack().getTransport().getUpProtocol();
}
Also used : JoinLeave(org.apache.geode.distributed.internal.membership.gms.interfaces.JoinLeave) HealthMonitor(org.apache.geode.distributed.internal.membership.gms.interfaces.HealthMonitor) DM(org.apache.geode.distributed.internal.DM) RemoteTransportConfig(org.apache.geode.internal.admin.remote.RemoteTransportConfig) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) DistributionManager(org.apache.geode.distributed.internal.DistributionManager) Manager(org.apache.geode.distributed.internal.membership.gms.interfaces.Manager) Services(org.apache.geode.distributed.internal.membership.gms.Services) Stopper(org.apache.geode.distributed.internal.membership.gms.Services.Stopper) ServiceConfig(org.apache.geode.distributed.internal.membership.gms.ServiceConfig) DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) DistributionStats(org.apache.geode.distributed.internal.DistributionStats)

Example 3 with DistributionStats

use of org.apache.geode.distributed.internal.DistributionStats in project geode by apache.

the class MemberLevelStatsJUnitTest method init.

public void init() {
    cachePerfStats = new CachePerfStats(system);
    funcServiceStats = new FunctionServiceStats(system, "FunctionExecution");
    long statId = OSProcess.getId();
    distributionStats = new DistributionStats(system, statId);
    DistributionStats.enableClockStats = true;
    dlockStats = new DLockStats(system, statId);
    bridge = new MemberMBeanBridge();
    bridge.addCacheStats(cachePerfStats);
    bridge.addFunctionStats(funcServiceStats);
    bridge.addDistributionStats(distributionStats);
    bridge.addLockServiceStats(dlockStats);
    VMStatsContract vmstats = system.getStatSampler().getVMStats();
    assertTrue(vmstats instanceof VMStats50);
    bridge.addSystemStats();
    bridge.addVMStats();
    for (int i = 0; i < 4; i++) {
        DiskStoreStats stats = new DiskStoreStats(system, name.getMethodName() + i);
        diskStatsList.add(stats);
        bridge.addDiskStoreStats(stats);
    }
    for (int i = 0; i < 4; i++) {
        PartitionedRegionStats stats = new PartitionedRegionStats(system, name.getMethodName() + i);
        parRegionStatsList.add(stats);
        bridge.addPartionRegionStats(stats);
    }
}
Also used : FunctionServiceStats(org.apache.geode.internal.cache.execute.FunctionServiceStats) CachePerfStats(org.apache.geode.internal.cache.CachePerfStats) MemberMBeanBridge(org.apache.geode.management.internal.beans.MemberMBeanBridge) VMStatsContract(org.apache.geode.internal.statistics.VMStatsContract) DLockStats(org.apache.geode.distributed.internal.locks.DLockStats) DiskStoreStats(org.apache.geode.internal.cache.DiskStoreStats) PartitionedRegionStats(org.apache.geode.internal.cache.PartitionedRegionStats) DistributionStats(org.apache.geode.distributed.internal.DistributionStats) VMStats50(org.apache.geode.internal.stats50.VMStats50)

Aggregations

DistributionStats (org.apache.geode.distributed.internal.DistributionStats)3 CachePerfStats (org.apache.geode.internal.cache.CachePerfStats)2 Properties (java.util.Properties)1 Statistics (org.apache.geode.Statistics)1 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)1 DM (org.apache.geode.distributed.internal.DM)1 DistributionConfigImpl (org.apache.geode.distributed.internal.DistributionConfigImpl)1 DistributionManager (org.apache.geode.distributed.internal.DistributionManager)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 DLockStats (org.apache.geode.distributed.internal.locks.DLockStats)1 ServiceConfig (org.apache.geode.distributed.internal.membership.gms.ServiceConfig)1 Services (org.apache.geode.distributed.internal.membership.gms.Services)1 Stopper (org.apache.geode.distributed.internal.membership.gms.Services.Stopper)1 HealthMonitor (org.apache.geode.distributed.internal.membership.gms.interfaces.HealthMonitor)1 JoinLeave (org.apache.geode.distributed.internal.membership.gms.interfaces.JoinLeave)1 Manager (org.apache.geode.distributed.internal.membership.gms.interfaces.Manager)1 RemoteTransportConfig (org.apache.geode.internal.admin.remote.RemoteTransportConfig)1 DiskStoreStats (org.apache.geode.internal.cache.DiskStoreStats)1 PartitionedRegionStats (org.apache.geode.internal.cache.PartitionedRegionStats)1 FunctionServiceStats (org.apache.geode.internal.cache.execute.FunctionServiceStats)1