Azure WADPerformanceCountertable query returning all records while querying for specific interval -


how records specific interval azure wadperformancecounters table using java api?

tried following code, giving records in table. seems timestamp based filters not working. tried partitionkey, timestamp, eventtick , timestamp column filtering same all.

public static void main(string arg[]){         try         {              cloudstorageaccount storageaccount =   cloudstorageaccount.parse(storageconnectionstring);              cloudtableclient tableclient = storageaccount.createcloudtableclient();               cloudtable cloudtable = tableclient.gettablereference("wadperformancecounterstable");             long currtime = system.currenttimemillis();          date currentdate = new date(currtime);               date endtime = getformattedtimestamp(currentdate);             system.out.println("endtime:" + endtime);              // calculation of start time db format in utc             long offsetinmilliseconds = 1000 * 60 * 2;             date starttime = getformattedtimestamp(new date(currentdate                     .gettime()                     - offsetinmilliseconds));              system.out.println("starttime:" + starttime);              long startpartitionkey = 621355968000000000l + starttime                     .gettime() * 10000;             long endpartitionkey = 621355968000000000l + endtime.gettime() * 10000;            //query using partitionkey         tablequery< perftableentity > sql = tablequery.from(perftableentity.class).where(                 "partitionkey ge '0" + startpartitionkey + "'").where(                 "partitionkey le '0" + endpartitionkey + "'").where(                 "deploymentid eq '<deplymentid>'").where(                 "roleinstance eq 'webrole1_in_0'").where(                 "countername eq '\\memory\\page faults/sec' or countername eq '\\memory\\page reads/sec'");            (perftableentity pd : cloudtable.execute(sql)) {              system.out.println("\ncountername = " +pd.getcountername() + "= " + pd.getcountervalue() + "||" + pd.gettimestamp());          }            }catch (exception e){                 // output stack trace.                 e.printstacktrace();         }  }//main  private static date getformattedtimestamp(date date) {     try {          simpledateformat df = new simpledateformat(                 "yyyy-mm-dd't'hh:mm:ss.sss'z'");         df.settimezone(timezone.gettimezone("utc"));         string datestr = df.format(date);         return df.parse(datestr);     } catch (exception e) {         return null;     }  } 

using stringbuilder append 0 partitionkey resolved issue.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -