Java client stats question

Brian Roach roach at basho.com
Thu Jul 25 11:18:27 EDT 2013


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 <guido.medina at temetra.com> 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 at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list