none
Data with azure WAD counter table

    Question

  • Hi,

    We have used the java API to collect azure storage information from WAD performance counter table. For this we used below code.

    try
    {
    CloudStorageAccount httpAcc = CloudStorageAccount.parse(storageConnectionString);
    CloudTableClient tableClient = httpAcc.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("WADPerformanceCountersTable");

    String upperBound = TableQuery.generateFilterCondition("PartitionKey",QueryComparisons.LESS_THAN,"0635671962057500000");
    String lowerBound = TableQuery.generateFilterCondition("PartitionKey",QueryComparisons.GREATER_THAN,"0635671959057540000");
    String filter = TableQuery.combineFilters(upperBound, Operators.AND, lowerBound);

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

    EntityProperty countProp2 = ent.getProperties().get("RoleInstance");
    System.out.println(countProp2.getValueAsString());
    }
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }

    We got the output for the above code. But we set take(1) parameter in TableQuery class.  But we got all the records available between the partition key. Please give me solution to take one record.

    Thanks in advance.

    Rathidevi


    rathidevi


    Thursday, May 14, 2015 12:51 PM

Answers

  • If you cannot use the row key and partition key to get the required record one a time, and has to use the Take(1) which seems to not be working in the Java API, you can have a work around for this issue via the IEnumerables Take or tilize an EntityResolver which will correctly honor the take count.

    var result = cloudTable.ExecuteQuery(tableQuery).Take(1).ToList();

    Also, it looks like a bug with JAVA SDK. I will check on that and report it to concerned team. Meanwhile, please use the workaround suggested above. However, .Net SDK do not have this issue.(Just for your information)

    Regards,
    Manu


     

    Thursday, May 21, 2015 3:52 PM
    Moderator

All replies

  • I'll check on this and update you earliest.

    -Manu

    Thursday, May 14, 2015 7:25 PM
    Moderator
  • Hi,

    Please check if you have provide the "where" clauses correctly and also, mention the "take" clauses after it so that the first record is taken after filtering.

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

    Regards,
    Manu

    Friday, May 15, 2015 6:52 PM
    Moderator
  • Hi,

    Thanks for your reply on this.

    I have enabled the eight performance counters.Every 3 min its polling data to the storage. i used the below query to collect one set of record data.

    TableQuery<DynamicTableEntity> query = TableQuery.from(DynamicTableEntity.class).where("(PartitionKey lt '0635599080000000000') and (PartitionKey ge '0635599076400000000')").take(1).select(new String[] {"CounterName","CounterValue","RoleInstance"});

    in the above query, two set of records available in storage. 
    example : 
    1) 0635599078200000000  --- having one set of record
    2) 0635599076400000000  --- having one set of record

    But i want only one set records if the query met the condition. So that i put take(1). But the the above query display two set records. Please help to resolve this.

    Regards

    Rathidevi


    rathidevi


    Monday, May 18, 2015 6:46 AM
  • I'm checking on this & will update you at earliest. Your patience is greatly appreciated.

    -Manu

    Monday, May 18, 2015 7:48 PM
    Moderator
  • If you cannot use the row key and partition key to get the required record one a time, and has to use the Take(1) which seems to not be working in the Java API, you can have a work around for this issue via the IEnumerables Take or tilize an EntityResolver which will correctly honor the take count.

    var result = cloudTable.ExecuteQuery(tableQuery).Take(1).ToList();

    Also, it looks like a bug with JAVA SDK. I will check on that and report it to concerned team. Meanwhile, please use the workaround suggested above. However, .Net SDK do not have this issue.(Just for your information)

    Regards,
    Manu


     

    Thursday, May 21, 2015 3:52 PM
    Moderator