Configuration

Fully control how metrics are grouped

Server Zone

Luameter use a concept called server zone to group related requests under a single metrics group. Server zone is just a key you can configure to logically group requests. With it, you can easily separated the data of static files serving from your highly important API calls, or compare the performance of your /user API with /product API.

The default configuration in our Get Started guide use two grouping key, the request host name and the first level of its request path.

http {
    ...

    lua_shared_dict luameter 1m;
    lua_package_path "{CHANGE_ME}?.luac";
    init_by_lua "luameter = require 'luameter'";
    log_by_lua "luameter.mark_by_host(); luameter.mark_by_path(1)";

    ...
}            

With this zone configuration, a single request to https://luameter.com/api/foo will be recorded in two groups: luameter.com and /api.

Generic Server Zone

Luameter provides a generic luameter.mark(<zone_key>) function that can be used to use any Nginx variable as your server zone.

For example, if you use the Nginx geoip module, you can use the $geoip_contry_code key to group Luameter's metrics based on client country.

log_by_lua "luameter.mark(ngx.var.geoip_country_code);";
Now it's much easier to tell how much out-going bandwidth each country is using from your Nginx server.