Each time a session is added or updated in the User repository it is re-analyzed. During this process built-in evaluations are performed (like recalculating the operating system version information and recording the errors and warnings in the data). You can create your own analyzers to extend this process. When you do, your custom analyzer be presented with all of the information in the session as well as the results of the built-in analysis. Because this is all done on a background thread on the Server no user interface can be displayed.
To extend the Session Analysis pipeline, you need to create a class that:
For more information on how classes are evaluated and loaded see Loupe Extensions - Deploying Extensions.
When a new or updated session is being analyzed, the following steps happen:
The order that custom analyzers are called is not deterministic.
If your extension throws an exception it will be logged in the Loupe Server Service log and execution will continue. This means the session will still be marked as analyzed. You can view the exception using Loupe Desktop on the server.
If it's useful to cache information to improve performance the best place to do this is in your Repository Controller. This allows the cache to be shared between all of the extensions that make up your Extension. Your session analyzer can cache information however it's important to do so in a thread safe manner because the Process method must be threadsafe and re-entrant.
It's often useful to allow users to invoke your session analyzer directly outside of the session analysis sequence. To do this, implement the ISessionCommand interface on the same object. It will be loaded separately for each use, so any information that should be shared between them should be pushed into the Repository Controller.
While your session analyzer is running it's a good idea to log information about what it's finding using the ILog object provided by the Repository Context provided during initialization. This is particularly useful in session analyzers since they can't display a user interface.
A session analyzer is associated with exactly one repository. Since a server is capable of loading multiple repositories that can all support analysis it's important that they are designed to support being loaded multiple times in the same process space. They will be uniquely associated with a single Repository Context during initialization which can be used to share state.