Search in sources :

Example 1 with Monitor

use of org.apache.accumulo.monitor.Monitor in project accumulo by apache.

the class WebViewsIT method createMocks.

@BeforeClass
public static void createMocks() throws TableNotFoundException {
    ServerContext contextMock = createMock(ServerContext.class);
    expect(contextMock.getConfiguration()).andReturn(DefaultConfiguration.getInstance()).anyTimes();
    expect(contextMock.getInstanceID()).andReturn(InstanceId.of("foo")).atLeastOnce();
    expect(contextMock.getInstanceName()).andReturn("foo").anyTimes();
    expect(contextMock.getZooKeepers()).andReturn("foo:2181").anyTimes();
    expect(contextMock.getTableName(TableId.of("foo"))).andReturn("bar").anyTimes();
    Monitor monitorMock = createMock(Monitor.class);
    expect(monitorMock.getContext()).andReturn(contextMock).anyTimes();
    replay(contextMock, monitorMock);
    monitor.set(monitorMock);
}
Also used : Monitor(org.apache.accumulo.monitor.Monitor) ServerContext(org.apache.accumulo.server.ServerContext) BeforeClass(org.junit.BeforeClass)

Example 2 with Monitor

use of org.apache.accumulo.monitor.Monitor in project accumulo by apache.

the class WebViewsIT method finishMocks.

@AfterClass
public static void finishMocks() {
    Monitor m = monitor.get();
    verify(m.getContext(), m);
}
Also used : Monitor(org.apache.accumulo.monitor.Monitor) AfterClass(org.junit.AfterClass)

Example 3 with Monitor

use of org.apache.accumulo.monitor.Monitor in project accumulo by apache.

the class TabletServerInformationTest method testFromThrift.

@Test
public void testFromThrift() {
    TabletServerStatus ts = new TabletServerStatus();
    ts.setBulkImports(Collections.singletonList(new BulkImportStatus()));
    ts.setDataCacheHits(11);
    ts.setDataCacheRequest(22);
    ts.setFlushs(33);
    ts.setHoldTime(44);
    ts.setIndexCacheHits(55);
    ts.setIndexCacheRequest(66);
    ts.setLastContact(77);
    RecoveryStatus recoveries = new RecoveryStatus();
    recoveries.setName("testRecovery");
    recoveries.setProgress(0.42);
    recoveries.setRuntime(4);
    ts.setLogSorts(Collections.singletonList(recoveries));
    ts.setLookups(88);
    ts.setName("tServerTestName:1234");
    ts.setOsLoad(1.23);
    ts.setResponseTime(99);
    ts.setSyncs(101);
    TableInfo tableInfo = new TableInfo();
    tableInfo.tablets = 202;
    tableInfo.ingestRate = 2.34;
    tableInfo.queryRate = 3.45;
    tableInfo.ingestByteRate = 4.56;
    tableInfo.queryByteRate = 5.67;
    tableInfo.scans = new Compacting(301, 401);
    tableInfo.recs = 502;
    tableInfo.majors = new Compacting(501, 601);
    tableInfo.minors = new Compacting(701, 801);
    ts.setTableMap(Collections.singletonMap("tableId0", tableInfo));
    ts.setVersion("testVersion");
    Monitor monitor = EasyMock.createMock(Monitor.class);
    TabletServerInformation tsi = new TabletServerInformation(monitor, ts);
    assertEquals("tServerTestName:1234", tsi.server);
    assertEquals("tServerTestName:1234", tsi.hostname);
    // can only get within a small distance of time, since it is computed from "now" at time of
    // object creation
    assertTrue(Math.abs((System.currentTimeMillis() - 77) - tsi.lastContact) < 500);
    assertEquals(99, tsi.responseTime);
    assertEquals(1.23, tsi.osload, 0.001);
    assertEquals("testVersion", tsi.version);
    CompactionsTypes compactions = tsi.compactions;
    assertEquals(501, compactions.major.running.intValue());
    assertEquals(601, compactions.major.queued.intValue());
    assertEquals(701, compactions.minor.running.intValue());
    assertEquals(801, compactions.minor.queued.intValue());
    assertEquals(301, compactions.scans.running.intValue());
    assertEquals(401, compactions.scans.queued.intValue());
    assertEquals(202, tsi.tablets);
    assertEquals(2.34, tsi.ingest, 0.001);
    assertEquals(3.45, tsi.query, 0.001);
    assertEquals(4.56, tsi.ingestMB, 0.001);
    assertEquals(5.67, tsi.queryMB, 0.001);
    assertEquals(301, tsi.scans.intValue());
    // can't test here; this comes from
    assertEquals(0.0, tsi.scansessions, 0.001);
    // ManagerMonitorInfo
    assertEquals(tsi.scansessions, tsi.scanssessions, 0.001);
    assertEquals(44, tsi.holdtime);
    assertEquals("tServerTestName:1234", tsi.ip);
    assertEquals(502, tsi.entries);
    assertEquals(88, tsi.lookups);
    assertEquals(55, tsi.indexCacheHits);
    assertEquals(66, tsi.indexCacheRequests);
    assertEquals(11, tsi.dataCacheHits);
    assertEquals(22, tsi.dataCacheRequests);
    assertEquals(55 / 66.0, tsi.indexCacheHitRate, 0.001);
    assertEquals(11 / 22.0, tsi.dataCacheHitRate, 0.001);
    RecoveryStatusInformation rec = tsi.logRecoveries.get(0);
    assertEquals("testRecovery", rec.name);
    assertEquals(0.42, rec.progress, 0.001);
    assertEquals(4, rec.runtime.intValue());
}
Also used : BulkImportStatus(org.apache.accumulo.core.master.thrift.BulkImportStatus) Compacting(org.apache.accumulo.core.master.thrift.Compacting) Monitor(org.apache.accumulo.monitor.Monitor) RecoveryStatus(org.apache.accumulo.core.master.thrift.RecoveryStatus) TableInfo(org.apache.accumulo.core.master.thrift.TableInfo) CompactionsTypes(org.apache.accumulo.monitor.rest.tables.CompactionsTypes) TabletServerStatus(org.apache.accumulo.core.master.thrift.TabletServerStatus) RecoveryStatusInformation(org.apache.accumulo.monitor.rest.trace.RecoveryStatusInformation) Test(org.junit.Test)

Aggregations

Monitor (org.apache.accumulo.monitor.Monitor)3 BulkImportStatus (org.apache.accumulo.core.master.thrift.BulkImportStatus)1 Compacting (org.apache.accumulo.core.master.thrift.Compacting)1 RecoveryStatus (org.apache.accumulo.core.master.thrift.RecoveryStatus)1 TableInfo (org.apache.accumulo.core.master.thrift.TableInfo)1 TabletServerStatus (org.apache.accumulo.core.master.thrift.TabletServerStatus)1 CompactionsTypes (org.apache.accumulo.monitor.rest.tables.CompactionsTypes)1 RecoveryStatusInformation (org.apache.accumulo.monitor.rest.trace.RecoveryStatusInformation)1 ServerContext (org.apache.accumulo.server.ServerContext)1 AfterClass (org.junit.AfterClass)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1