locked
How to get the storage details during 5 min interval RRS feed

  • Question

  • Hi,

    I used below java code to collect the storage details. But i didn't get any output. Without filter condition it display all the records available in table. How to get the last five min data. Based on this how to change the tablequery.? I used partition key too. that also didnt work.

    1) How to use the tick count in this example.

    CloudStorageAccount httpAcc = CloudStorageAccount.parse(storageConnectionString);
    CloudTableClient tableClient = httpAcc.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("$MetricsHourPrimaryTransactionsTable");

    Date date = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
    TimeZone utc = TimeZone.getTimeZone("UTC");
    sdf.setTimeZone(utc);

    String upperBound = TableQuery.generateFilterCondition("TIMESTAMP",QueryComparisons.LESS_THAN,sdf.parse("2015-02-04")); // // sdf.format(cal.getTime())
    System.out.println("call lowertime ->"+upperBound);
    String lowerBound = TableQuery.generateFilterCondition("TIMESTAMP",QueryComparisons.GREATER_THAN,sdf.parse("2015-02-01"));
    System.out.println("call uppertime ->"+lowerBound);
    String filter = TableQuery.combineFilters(upperBound, Operators.AND, lowerBound);

    //String startTick = TableQuery.generateFilterCondition("TIMESTAMP",QueryComparisons.GREATER_THAN,sdf.parse("2015-09-03"));
    //System.out.println("the startTick==="+startTick);
    //String tick = TableQuery.generateFilterCondition("PartitionKey",QueryComparisons.GREATER_THAN,startTick);

    TableQuery<DynamicTableEntity> query = TableQuery.from(DynamicTableEntity.class).where(filter).select(new String[] {"Availability","TotalRequests","PercentSuccess"});
    for (DynamicTableEntity ent : table.execute(query))
    {
    EntityProperty countProp = ent.getProperties().get("Availability");
    if (countProp == null) 
    {
    throw new IllegalArgumentException("Invalid entity, Count property not found!");
    }
    System.out.println(countProp.getValueAsString());
    EntityProperty countProp1 = ent.getProperties().get("TotalRequests");
    System.out.println(countProp1.getValueAsString());

    EntityProperty countProp2 = ent.getProperties().get("PercentSuccess");
    System.out.println(countProp2.getValueAsString());
    }

    Regards,

    Rathidevi


    rathidevi

    Thursday, March 12, 2015 6:51 AM