Re: Java client stats question

2013-07-25 Thread Guido Medina

Hi Brian,

We have a custom (and very small) admin page that shows Riak KV version, 
connected nodes and ring members, here is how it looks:


riak_kv_version 1.4.0
connected_nodes riak@node2
riak@node3
riak@node4
riak@node5
ring_membersriak@node1
riak@node2
riak@node3
riak@node4
riak@node5
sys_system_architecture x86_64-unknown-linux-gnu


That also tell us where the running app is working against, if dev or 
prod cluster cause nodes will be different. We also show some buckets 
information but that is currently on PBC.


Guido.


On 25/07/13 16:18, Brian Roach wrote:

Guido -

Right now, no.

We've been having some internal discussions around that topic and
whether it's really a "client library" operation or not.

How are you using stats? Is it for a monitoring app or ... ?

Thanks,
Brian Roach

On Thu, Jul 25, 2013 at 4:25 AM, Guido Medina  wrote:

Hi,

Is there a way to get the JSON stats via PBC? This is how we are doing it
now, we would like to get rid of any HTTP call, currently, this is the only
call being made to HTTP:

   private void collectNodeInfo(final PBClientConfig clientConfig)
   {
 ...
 RiakClusterStats stats=null;
 try{
   stats=new RiakClusterStats();
   HttpClient client=new DefaultHttpClient();
   HttpGet g=new HttpGet("http://"; + clientConfig.getHost() +
":8098/stats");
   HttpResponse resonse=client.execute(g);
   JSONObject statsMap;
   InputStream contentStream=null;
   try{
 contentStream=resonse.getEntity().getContent();
 JSONTokener tok=new JSONTokener(contentStream);
 statsMap=new JSONObject(tok);
 stats.addNode(clientConfig.getHost(),statsMap);
   } finally{
 if(contentStream != null){
   contentStream.close();
 }
   }
 } catch(Exception e){
   log.error("Huh? Exception when ",e);
 }
 lastClusterStats=stats;
   }


Kind regards,

Guido.

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Java client stats question

2013-07-25 Thread Brian Roach
Guido -

Right now, no.

We've been having some internal discussions around that topic and
whether it's really a "client library" operation or not.

How are you using stats? Is it for a monitoring app or ... ?

Thanks,
Brian Roach

On Thu, Jul 25, 2013 at 4:25 AM, Guido Medina  wrote:
> Hi,
>
> Is there a way to get the JSON stats via PBC? This is how we are doing it
> now, we would like to get rid of any HTTP call, currently, this is the only
> call being made to HTTP:
>
>   private void collectNodeInfo(final PBClientConfig clientConfig)
>   {
> ...
> RiakClusterStats stats=null;
> try{
>   stats=new RiakClusterStats();
>   HttpClient client=new DefaultHttpClient();
>   HttpGet g=new HttpGet("http://"; + clientConfig.getHost() +
> ":8098/stats");
>   HttpResponse resonse=client.execute(g);
>   JSONObject statsMap;
>   InputStream contentStream=null;
>   try{
> contentStream=resonse.getEntity().getContent();
> JSONTokener tok=new JSONTokener(contentStream);
> statsMap=new JSONObject(tok);
> stats.addNode(clientConfig.getHost(),statsMap);
>   } finally{
> if(contentStream != null){
>   contentStream.close();
> }
>   }
> } catch(Exception e){
>   log.error("Huh? Exception when ",e);
> }
> lastClusterStats=stats;
>   }
>
>
> Kind regards,
>
> Guido.
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Java client stats question

2013-07-25 Thread Guido Medina

Hi,

Is there a way to get the JSON stats via PBC? This is how we are doing 
it now, we would like to get rid of any HTTP call, currently, this is 
the only call being made to HTTP:


/private void collectNodeInfo(final PBClientConfig clientConfig)//
//  {//
//...//
//RiakClusterStats stats=null;//
//try{//
//  stats=new RiakClusterStats();//
//  HttpClient client=new DefaultHttpClient();//
*HttpGet g=new HttpGet("http://"; + clientConfig.getHost() + 
":8098/stats");*//

//  HttpResponse resonse=client.execute(g);//
//  JSONObject statsMap;//
//  InputStream contentStream=null;//
//  try{//
//contentStream=resonse.getEntity().getContent();//
//JSONTokener tok=new JSONTokener(contentStream);//
//statsMap=new JSONObject(tok);//
//stats.addNode(clientConfig.getHost(),statsMap);//
//  } finally{//
//if(contentStream != null){//
//  contentStream.close();//
//}//
//  }//
//} catch(Exception e){//
//  log.error("Huh? Exception when ",e);//
//}//
//lastClusterStats=stats;//
//  }/


Kind regards,

Guido.
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com