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

Implement Logging Solution #217

Closed
JayThomason opened this issue May 24, 2014 · 6 comments
Closed

Implement Logging Solution #217

JayThomason opened this issue May 24, 2014 · 6 comments
Labels

Comments

@JayThomason
Copy link
Owner

One of our deliverables requires that we record key metrics about app usage. These metrics might include usage time, number of songs per jam, and number of users per jam.

The design that I am considering right now looks like this:

  • The phone maintains a local database to log key metrics.
  • We attach timers, counters, and/or handlers to buttons in the app that record data in the database.
    • We probably just want to log data on the master phone for now, but it could be interesting to also log info from the clients.
  • Our server also has a database which logs metrics for all users.
  • At a random time, once per day, the phone logs any information in the local db to the server db.
  • The phone then clears out the local database.
@JayThomason
Copy link
Owner Author

So far I have added the log table to the SQLite database and I have methods to manipulate the fields in it (db3656b).

Next I need to add some code to keep track of the number of songs in the jam (I'm just going to track the maximum for now, ie. the max number of songs that are in the jam at any one time), and then I need to insert calls to do the logging throughout the codebase.

@JayThomason
Copy link
Owner Author

With these two commits (JayThomason/tutti-server@783a69d and JayThomason/tutti-server@3799edf) I have updated the server code to remove the old server endpoints. I added the /log endpoint which takes a JSON list of jams encoded as JSON objects with four fields: the start_time (unix time client side when the jam was created), length (approx. length of jam in seconds), num_users, and num_songs).

@JayThomason
Copy link
Owner Author

As of here (56dab52), all that is left to do for the logger is test it more and add an Alarm that runs every so often to dump the jams in the database to the server.

@JayThomason
Copy link
Owner Author

Status update: I've started building the alarm system that will active about once per day and try to log the data in the local sqlite db to the log server (273ea64). I'm going off of this sample application to implement this functionality.

@JayThomason
Copy link
Owner Author

It seems that there is no way to reliably check whether you have already set a specific alarm in the Android AlarmManager, so I've had to rely on using a shared preferences bool.

As of (2bb8f78) the logger alarm will fire every ~6 hours. I changed the time down from about 1 day because I want more resolution when watching metrics over the next two weeks or so. I think that the only optimization left to be made is to ensure that the alarm is reset when the phone is turned off and back on again.

@JayThomason
Copy link
Owner Author

Logger alarm is being set on reboot (ef11bc7). Gonna close this issue for now because it seems to be working. We can test tomorrow and prepare to submit to the play store.

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

No branches or pull requests

1 participant