Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Dev issues #32

Open
JuanBarriosPiaggio opened this issue May 9, 2015 · 4 comments
Open

Android Dev issues #32

JuanBarriosPiaggio opened this issue May 9, 2015 · 4 comments

Comments

@JuanBarriosPiaggio
Copy link

Hello,

Has this been tested against Android studio and has anyone successfuly integrated this client into an Android native app ?

Thanks

@JuanBarriosPiaggio
Copy link
Author

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.

@scarytom
Copy link
Contributor

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);

@JuanBarriosPiaggio
Copy link
Author

Thanks for getting back to me, i will try again this evening and post the results back here.

@red61wjt
Copy link

red61wjt commented Oct 7, 2015

How did you get on with your testing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants