Chat Support
Loupe - Log - Monitor - Resolve
Loupe / Getting Started / Getting Started - Concepts - What is a Session?
In This Topic
    Getting Started - Concepts - What is a Session?
    In This Topic

    Within Loupe a Session corresponds to a process lifespan (in .NET Framework it's slightly narrower - an Application Domain's lifespan).  This means once the Loupe Agent is started the session will continue until the process shuts down.  Each session is assigned a unique Id when it starts which is used to track that session through its full lifecycle between the Agent, Server, and other clients.

    Since a session equates to an application domain this means multiple application domains in the same process will be completely independent sessions from a Loupe standpoint.  For example, ASP.NET web sites hosted in the same application pool get their own application domains.  Likewise, individual runs of unit tests will usually be isolated into their own application domains.

    How Loupe Records Session Data

    As long as the session is running it records data into a session data file with the extension .glf.  These are highly compressed binary files which contain metadata about the application as well as the log, metric, and other runtime data recorded by your application.  These files are automatically managed by the agent with each file being closed when it reaches a maximum size or age (which are configurable).  These files are stored in a child folder of the Common Application Data folder on each computer where the session runs. 

    Starting a Session

    A session is started when the Loupe Agent initializes.  It will initialize when:

    Initialization can be canceled by subscribing to the Log.Initializing event and setting the Cancel event property to true. 

    Once it's initialize the Agent will be active until the application domain exits.

    Ending a Session

    Due to certain internal details of the Loupe Agent (in particular the goal of ensuring no log messages are lost, even when a process is exiting) it will keep an application domain running unless it's told to end the session. 

    To do this, call Log.EndSession.  When you do this, the Agent changes its behavior in several ways:

    1. The agent switching to synchronous logging (meaning it blocks for each message that is written to ensure it's written to disk)
    2. Performance counters are no longer gathered
    3. If SendSessionsOnExit is enabled the Packager utility is started which will wait for the process to exit.
    Despite what the names imply, Calling EndSession doesn't end the session immediately (just prepares it to end) so you can't cause a new session to start by calling EndSession then StartSession.  EndSession just prepares the Agent for the application domain to exit.
    See Also