locked
How to collect azure storage performance data using azure JAVA SDK RRS feed

  • Question

  • Hi ,

    I want to monitor the storage account in our cloud service. We have enabled the monitoring services in storage account. In our cloud service we have enabled the table service based on the screen shot attached. The below links says that the data's are stored in $MetricsHourPrimaryTransactionsBlob,$MetricsHourPrimaryTransactionsTable

    $MetricsHourPrimaryTransactionsQueue,$MetricsMinutePrimaryTransactionsBlob

    $MetricsMinutePrimaryTransactionsTable,$MetricsMinutePrimaryTransactionsQueue$MetricsCapacityBlob

    http://azure.microsoft.com/en-us/documentation/articles/storage-monitoring-diagnosing-troubleshooting/

    So i used the Azure JAVA SDK to collect the data's from the above table. For this i used "TableQuery" class for table "$MetricsHourPrimaryTransactionsTable"

    TableQuery<DynamicTableEntity> query = TableQuery.from(DynamicTableEntity.class)where(filter).take(25).select(new String[] { "Availability","TotalRequests","PercentSuccess"}));

    Filter - i set 5 min interval

    But this query gives all the output. It does not provide last 5 min data or last 25 records which is mentioned in take(25). is it necessary to provide any other information in query?

    I need only the last five min data or one hour data of Capacity, Availability and performance data's of storage account.

    Regards

    Rathidevi


    rathidevi


    Tuesday, March 10, 2015 7:32 AM

Answers

  • Hi Rathi,

    Please go through the link provided above, it will provide better understanding on getting the latest 25 records.

    Also, you may refer the below query(C#) which is querying the data for one day older and take top 5 record.

     TableQuery<WADPerf> query = new TableQuery<WADPerf>().Where(TableQuery.GenerateFilterConditionForDate("PreciseTimeStamp", QueryComparisons.GreaterThanOrEqual, DateTimeOffset.Now.AddDays(-1).Date)).Take(5);

    This should help you.

    However, if you want further assistance with Java code sample, I suggest you to open a support ticket with Azure.

    Regards,

    Manu Rekhar


    Thursday, March 12, 2015 6:58 PM

All replies

  • Hi RathiDevi,

    Please refer this following link and make sure you have provided all the required parameters that match the requirement of "where" clauses, so that only the first 25 records are pulled out.

    http://dl.windowsazure.com/storage/javadoc/com/microsoft/azure/storage/table/TableQuery.html

    Regards,

    Manu Rekhar

    Tuesday, March 10, 2015 4:24 PM
  • Hi ,

    Thanks for your reply. I used below java code to collect the storage details. But i didn't get any output. Without filter condition it display all the record available in table. How to get the last five min data. Based on this how to change the query.? 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

    Wednesday, March 11, 2015 7:33 AM
  • Hi Rathi,

    Please go through the link provided above, it will provide better understanding on getting the latest 25 records.

    Also, you may refer the below query(C#) which is querying the data for one day older and take top 5 record.

     TableQuery<WADPerf> query = new TableQuery<WADPerf>().Where(TableQuery.GenerateFilterConditionForDate("PreciseTimeStamp", QueryComparisons.GreaterThanOrEqual, DateTimeOffset.Now.AddDays(-1).Date)).Take(5);

    This should help you.

    However, if you want further assistance with Java code sample, I suggest you to open a support ticket with Azure.

    Regards,

    Manu Rekhar


    Thursday, March 12, 2015 6:58 PM
  • Hi,

    Thanks for your reply.


    rathidevi

    Friday, March 13, 2015 4:21 AM