Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Usage statistics(Client side UI component usage statistics)
Usage statistics [message #1228621] Tue, 07 January 2014 16:39 Go to next message
Kathlyn Heilman is currently offline Kathlyn HeilmanFriend
Messages: 2
Registered: November 2013
Junior Member
We need to get our program to gather usage statistics on the client side. We want to know what pages/forms a user is using. We were looking into AOP for this, but it doesn't seem to be quite the right technology. Is there a scout way of doing this?

Thanks,
Kathlyn
Re: Usage statistics [message #1228640 is a reply to message #1228621] Tue, 07 January 2014 17:30 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I have already seen such a requirement... It was a long time ago, and I do not remember very well. I will try to have a look at this old conversation.


Another approach could be to do the evaluation server side... Because in Scout you have: "a form == a specific service call" [e.g load() or prepareCreate()]. I think you can profile this... Again it is a fact that some projects have some interesting profiling approach... Not sure if this is something that is in the Scout framework (yet).


I will try to come back to you with more information.

Re: Usage statistics [message #1229445 is a reply to message #1228640] Thu, 09 January 2014 13:09 Go to previous message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
Hi Kathlyn,
thanks for your question.

Unfortunately Scout has no such built in feature. Not yet Smile

I agree with Jérémie's proposal to do the profiling on the Server side. This is how I would do it:

1) Create a new Service on the server: 'ProfileService'
My implementation looks as follows:
public class ProfileService extends AbstractService implements IProfileService {
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(ProfileService.class);

  private static Map<String, Integer> numberOfUses = new HashMap<String, Integer>();

  @Override
  public void log(String name) throws ProcessingException {
    LOG.info("Log the following element: " + name);
    if (numberOfUses.containsKey(name)) {
      int number = numberOfUses.get(name);
      number++;
      numberOfUses.put(name, number);
      LOG.info("The element " + name + " has been used " + number + " times.");
    }
    else {
      LOG.info("The element " + name + " has been used the first time");
      numberOfUses.put(name, 1);
    }
  }
}

It is simply a method which count's how often a certain string has been passed. In a real world scenario I would log it into a database.

2) In order to log pages, I override the page's 'execPageActivated()' method:
  @Override
  protected void execPageActivated() throws ProcessingException {
    super.execPageActivated();
    SERVICES.getService(IProfileService.class).log(MyTablePage.class.getSimpleName());
  }

Every time the page is activated, it will profile it.

3) In order to log forms, I override the form's 'execFormActivated()' method:
  @Override
  protected void execFormActivated() throws ProcessingException {
    super.execFormActivated();
    SERVICES.getService(IProfileService.class).log(MyForm.class.getSimpleName());
  }


And here is some sample output from the Server:
...
Log the following element: MyTablePage
The element MyTablePage has been used 2 times.
Log the following element: MyTablePage
The element MyTablePage has been used 3 times.
Log the following element: MyForm
The element MyForm has been used the first time
Log the following element: MyForm
The element MyForm has been used 3 times.



Note: If you have a lot of pages and forms it is cumbersome to always add the logging to the execPageActivated method (dry - don't repeat yourself). Therefore I would suggest to move the code to the super class and then extend your forms/pages from those class, e.g. instead of
public class MyForm extends AbstractForm

use
public class MyForm extends ProfilingAbstractForm

and then in ProfilingAbstractForm implement the logging.

I hope this helps and meets your requirements. If you have any further questions, let us know. Smile

Best regards,
Matthias
Previous Topic:Trying to get scout-rt and scout-sdk to build...
Next Topic:How to,,,,
Goto Forum:
  


Current Time: Sun Nov 17 18:00:19 GMT 2019

Powered by FUDForum. Page generated in 0.01917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top