8000 GitHub - jerily/treqmon: Request monitoring middleware for twebserver
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jerily/treqmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

treqmon

Request Monitoring for twebserver.

Prerequisites

Installation

# It installs to /usr/local/lib
# To install elsewhere, change the prefix
# e.g. make install PREFIX=/path/to/install
make install

Usage

We split configuration in two parts: main and middleware. The main part is needed for some stores and loggers to be initialized in the main thread. For example, if you are using the memstore store or the console logger, they create the worker thread in the main thread and then pass it to the middleware (twebserver) threads.

In main thread of your application:

package require treqmon
set middleware_config [::treqmon::init_main $main_config]

In middleware threads of your application:

package require treqmon

::treqmon::init_middleware $middleware_config

::twebserver::add_middleware \
    -enter_proc ::treqmon::middleware::enter \
    -leave_proc ::treqmon::middleware::leave \
    $router

Configuration

The following are supported configuration options:

  • store - The store to use and its configuration. For example:
valkeystore {
    host localhost
    port 6379
}
  • logger - The logger to use and its configuration. For example:
logger {
    console {
        threshold 100
    }
    logfile {
        threshold 100
        path /var/log/treqmon.log
    }
}

where threshold is the number of events that have to be exceeded before the logger logs the events in bulk.

Charts

The following are supported thtml components:

You can import them in your application after you install thtml, chart.js, and purecss like this:

<import name="Stats" src="@treqmon/stats.thtml" />

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <bundle_css url_prefix="$bundle_css_url_prefix" />
    </head>
    <body>
        <Stats />
        <bundle_js url_prefix="$bundle_js_url_prefix">
            <!--
                ...
            -->
        </bundle_js>
    </body>
</html>

Examples

See full example here.

Screenshots

Stats

About

Request monitoring middleware for twebserver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0