Open JuanBarriosPiaggio opened 9 years ago
Hello,
I have got it to compile with an android app but i'm not getting the packets to send. Here is the code so far.
@Override protected void onCreate(Bundle savedInstanceState) {
new Connection().execute();
}
private class Connection extends AsyncTask <Void, Void, Void>{
@Override
protected Void doInBackground(Void... arg0) {
connect();
return null;
}
}
private void connect() {
final NonBlockingStatsDClient statsd = new NonBlockingStatsDClient("test.test", "192.168.0.3", 8125);
try{
statsd.incrementCounter("bar");
statsd.recordGaugeValue("baz", 100);
statsd.recordExecutionTime("bag", 25);
statsd.recordSetEvent("qux", "one");
statsd.incrementCounter("bar");
}catch(Exception e){
e.printStackTrace();
}
}
Is there anything i'm doing wrong ? If i use a packet sender app i can see the packets reaching my statsd server but with the above code, i get no errors and the packets don't show up on my server.
This library has not been tested on android, so I do not know if it will work. You might try passing an error handler to the statsd client that logs any errors:
StatsDClientErrorHandler handler = new StatsDClientErrorHandler() {
@Override public void handle(Exception ex) {
android.util.Log.e(ex.getMessage());
}
}
NonBlockingStatsDClient statsd = new NonBlockingStatsDClient("test.test", "192.168.0.3", 8125, handler);
Thanks for getting back to me, i will try again this evening and post the results back here.
How did you get on with your testing?
Hello,
Has this been tested against Android studio and has anyone successfuly integrated this client into an Android native app ?
Thanks