Search in sources :

Example 6 with HBData

use of org.alfresco.heartbeat.datasender.HBData in project alfresco-repository by Alfresco.

the class SessionsUsageDataCollectorTest method testSystemUsageDataIsCollected.

@Test
public void testSystemUsageDataIsCollected() {
    HBData sessionsUsage = grabDataByCollectorId(sessionsUsageDataCollector.getCollectorId());
    assertNotNull("Sessions usage data missing.", sessionsUsage);
    Map<String, Object> data = sessionsUsage.getData();
    assertTrue(data.containsKey("activeTickets"));
    assertEquals("Wrong number of active tickets", TICKET_NON_EXPIRED, data.get("activeTickets"));
}
Also used : HBData(org.alfresco.heartbeat.datasender.HBData) Test(org.junit.Test)

Example 7 with HBData

use of org.alfresco.heartbeat.datasender.HBData in project alfresco-repository by Alfresco.

the class AuthoritiesDataCollectorTest method testAuthDataIsCollected.

@Test
public void testAuthDataIsCollected() {
    HBData authorityInfo = grabDataByCollectorId(authorityDataCollector.getCollectorId());
    assertNotNull("Authority info data missing.", authorityInfo);
    Map<String, Object> data = authorityInfo.getData();
    assertTrue(data.containsKey("numUsers"));
    assertTrue(data.containsKey("numGroups"));
}
Also used : HBData(org.alfresco.heartbeat.datasender.HBData) Test(org.junit.Test)

Example 8 with HBData

use of org.alfresco.heartbeat.datasender.HBData in project alfresco-repository by Alfresco.

the class ModelUsageDataCollectorTest method testModelUsageDataIsCollected.

@Test
public void testModelUsageDataIsCollected() {
    HBData modelUsage = grabDataByCollectorId(usageModelCollector.getCollectorId());
    assertNotNull("Model usage data missing.", modelUsage);
    Map<String, Object> data = modelUsage.getData();
    assertTrue(data.containsKey("numOfActiveModels"));
    assertTrue(data.containsKey("numOfActiveTypes"));
    assertTrue(data.containsKey("numOfActiveAspects"));
}
Also used : HBData(org.alfresco.heartbeat.datasender.HBData) Test(org.junit.Test)

Example 9 with HBData

use of org.alfresco.heartbeat.datasender.HBData in project alfresco-repository by Alfresco.

the class AuthoritiesDataCollector method collectData.

@Override
public List<HBData> collectData() {
    this.logger.debug("Preparing repository usage (authorities) data...");
    Map<String, Object> authoritiesUsageValues = new HashMap<>();
    authoritiesUsageValues.put("numUsers", new Integer(this.authorityService.getAllAuthoritiesInZone(AuthorityService.ZONE_APP_DEFAULT, AuthorityType.USER).size()));
    authoritiesUsageValues.put("numGroups", new Integer(this.authorityService.getAllAuthoritiesInZone(AuthorityService.ZONE_APP_DEFAULT, AuthorityType.GROUP).size()));
    HBData authoritiesUsageData = new HBData(this.currentRepoDescriptorDAO.getDescriptor().getId(), this.getCollectorId(), this.getCollectorVersion(), new Date(), authoritiesUsageValues);
    return Arrays.asList(authoritiesUsageData);
}
Also used : HBData(org.alfresco.heartbeat.datasender.HBData)

Example 10 with HBData

use of org.alfresco.heartbeat.datasender.HBData in project alfresco-remote-api by Alfresco.

the class RenditionsDataCollector method collectData.

@Override
public List<HBData> collectData() {
    List<HBData> collectedData = new LinkedList<>();
    String systemId = this.currentRepoDescriptorDAO.getDescriptor().getId();
    String collectorId = this.getCollectorId();
    String collectorVersion = this.getCollectorVersion();
    Date timestamp = new Date();
    // We don't mind if new renditions are added while we iterate, as we will pick them up next time.
    for (ThumbnailDefinition rendition : renditionRequests.keySet()) {
        String renditionName = rendition.getName();
        String targetMimetype = rendition.getMimetype();
        for (Map.Entry<String, AtomicInteger> entry : renditionRequests.remove(rendition).entrySet()) {
            String sourceMimetype = entry.getKey();
            AtomicInteger count = entry.getValue();
            Map<String, Object> values = new HashMap<>();
            values.put("rendition", renditionName);
            values.put("count", count.intValue());
            values.put("sourceMimetype", sourceMimetype);
            values.put("targetMimetype", targetMimetype);
            // Decided it would be simpler to be able to combine results in Kibana from different nodes
            // and days if the data was flattened (denormalized) out at this point. It is very likely
            // that different nodes would have different sets of sourceMimetypes which would make summing
            // the counts harder to do, if there was a single entry for each rendition with a nested
            // structure for each sourceMimetype.
            collectedData.add(new HBData(systemId, collectorId, collectorVersion, timestamp, values));
            if (logger.isDebugEnabled()) {
                logger.debug(renditionName + " " + count + " " + sourceMimetype + " " + targetMimetype);
            }
        }
    }
    return collectedData;
}
Also used : ThumbnailDefinition(org.alfresco.repo.thumbnail.ThumbnailDefinition) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) HBData(org.alfresco.heartbeat.datasender.HBData) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Map(java.util.Map) LinkedList(java.util.LinkedList) Date(java.util.Date)

Aggregations

HBData (org.alfresco.heartbeat.datasender.HBData)24 Test (org.junit.Test)16 Map (java.util.Map)7 Date (java.util.Date)5 HashMap (java.util.HashMap)5 OperatingSystemMXBean (com.sun.management.OperatingSystemMXBean)2 UnixOperatingSystemMXBean (com.sun.management.UnixOperatingSystemMXBean)2 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)2 Connection (java.sql.Connection)1 DatabaseMetaData (java.sql.DatabaseMetaData)1 SQLException (java.sql.SQLException)1 LinkedList (java.util.LinkedList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 HBBaseDataCollector (org.alfresco.heartbeat.HBBaseDataCollector)1 HBDataSenderService (org.alfresco.heartbeat.datasender.HBDataSenderService)1 CustomModelsInfo (org.alfresco.repo.dictionary.CustomModelsInfo)1 ThumbnailDefinition (org.alfresco.repo.thumbnail.ThumbnailDefinition)1 AuditService (org.alfresco.service.cmr.audit.AuditService)1 ModuleDetails (org.alfresco.service.cmr.module.ModuleDetails)1