Search in sources :

Example 6 with IngraphDashboardConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.

the class AbstractManagerTestBase method getTestIngraphDashboardConfig.

protected IngraphDashboardConfigDTO getTestIngraphDashboardConfig(String name) {
    IngraphDashboardConfigDTO ingraphDashboardConfigDTO = new IngraphDashboardConfigDTO();
    ingraphDashboardConfigDTO.setName(name);
    ingraphDashboardConfigDTO.setFabricGroup("test");
    ingraphDashboardConfigDTO.setFetchIntervalPeriod(3600_000);
    ingraphDashboardConfigDTO.setMergeNumAvroRecords(100);
    ingraphDashboardConfigDTO.setGranularitySize(5);
    ingraphDashboardConfigDTO.setGranularityUnit(TimeUnit.MINUTES);
    ingraphDashboardConfigDTO.setBootstrap(true);
    DateTime now = new DateTime();
    ingraphDashboardConfigDTO.setBootstrapStartTime(now.getMillis());
    ingraphDashboardConfigDTO.setBootstrapEndTime(now.minusDays(30).getMillis());
    return ingraphDashboardConfigDTO;
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) DateTime(org.joda.time.DateTime)

Example 7 with IngraphDashboardConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.

the class TestIngraphDatasetConfigManager method testDeleteIngraphDashboard.

@Test(dependsOnMethods = { "testUpdateIngraphDashboard" })
public void testDeleteIngraphDashboard() {
    ingraphDashboardConfigDAO.deleteById(ingraphDashboardConfigId1);
    IngraphDashboardConfigDTO ingraphDashboardConfigDTO = ingraphDashboardConfigDAO.findById(ingraphDashboardConfigId1);
    Assert.assertNull(ingraphDashboardConfigDTO);
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Test(org.testng.annotations.Test)

Example 8 with IngraphDashboardConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.

the class IngraphDashboardConfigResource method viewDashboardConfigs.

@GET
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String viewDashboardConfigs(@DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("100") @QueryParam("jtPageSize") int jtPageSize) {
    List<IngraphDashboardConfigDTO> ingraphDashboardConfigDTOs = ingraphDashboardConfigDAO.findAll();
    List<IngraphDashboardConfigDTO> subList = Utils.sublist(ingraphDashboardConfigDTOs, jtStartIndex, jtPageSize);
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(subList);
    return rootNode.toString();
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with IngraphDashboardConfigDTO

use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.

the class IngraphDashboardConfigResource method createDashboardConfig.

@GET
@Path("/create")
public String createDashboardConfig(@QueryParam("name") String name, @QueryParam("fabricGroup") String fabricGroup, @QueryParam("active") boolean active, @QueryParam("bootstrap") boolean bootstrap, @QueryParam("fromIngraphDashboard") boolean fromIngraphDashboard, @QueryParam("startTime") String bootstrapStartTime, @QueryParam("endTime") String bootstrapEndTime, @QueryParam("fetchIntervalPeriod") String fetchIntervalPeriod, @QueryParam("mergeNumAvroRecords") String mergeNumAvroRecords, @QueryParam("granularitySize") String granularitySize, @QueryParam("granularityUnit") String granularityUnit) {
    try {
        IngraphDashboardConfigDTO ingraphDashboardConfigDTO = new IngraphDashboardConfigDTO();
        ingraphDashboardConfigDTO.setName(name);
        ingraphDashboardConfigDTO.setFabricGroup(fabricGroup);
        if (StringUtils.isNotBlank(fetchIntervalPeriod)) {
            ingraphDashboardConfigDTO.setFetchIntervalPeriod(Long.valueOf(fetchIntervalPeriod));
        }
        if (StringUtils.isNotBlank(mergeNumAvroRecords)) {
            ingraphDashboardConfigDTO.setMergeNumAvroRecords(Integer.valueOf(mergeNumAvroRecords));
        }
        if (StringUtils.isNotBlank(granularitySize)) {
            ingraphDashboardConfigDTO.setGranularitySize(Integer.valueOf(granularitySize));
        }
        if (StringUtils.isNotBlank(granularityUnit)) {
            ingraphDashboardConfigDTO.setGranularityUnit(TimeUnit.valueOf(granularityUnit));
        }
        Boolean isActive = Boolean.valueOf(active);
        ingraphDashboardConfigDTO.setActive(isActive);
        Boolean isFromIngraphDashboard = Boolean.valueOf(fromIngraphDashboard);
        ingraphDashboardConfigDTO.setFromIngraphDashboard(isFromIngraphDashboard);
        Boolean needBootstrap = Boolean.valueOf(bootstrap);
        ingraphDashboardConfigDTO.setBootstrap(needBootstrap);
        if (needBootstrap) {
            long startTimeInMs = sdf.parse(bootstrapStartTime).getTime();
            long endTimeInMs = sdf.parse(bootstrapEndTime).getTime();
            ingraphDashboardConfigDTO.setBootstrapStartTime(startTimeInMs);
            ingraphDashboardConfigDTO.setBootstrapEndTime(endTimeInMs);
        }
        Long id = ingraphDashboardConfigDAO.save(ingraphDashboardConfigDTO);
        ingraphDashboardConfigDTO.setId(id);
        return JsonResponseUtil.buildResponseJSON(ingraphDashboardConfigDTO).toString();
    } catch (Exception e) {
        LOG.error("Failed to create dashboard:{}", name, e);
        return JsonResponseUtil.buildErrorResponseJSON("Failed to create dashboard:" + name).toString();
    }
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

IngraphDashboardConfigDTO (com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO)9 Test (org.testng.annotations.Test)4 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 IngraphDashboardConfigBean (com.linkedin.thirdeye.datalayer.pojo.IngraphDashboardConfigBean)1 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)1 Produces (javax.ws.rs.Produces)1 ObjectNode (org.codehaus.jackson.node.ObjectNode)1 DateTime (org.joda.time.DateTime)1