vhost_traffic_status_average_method

The `vhost_traffic_status_average_method` directive specifies the method for calculating average traffic statistics in the NGINX virtual host traffic status module.

Syntaxvhost_traffic_status_average_method method [time interval];
Defaultnone
Contexthttp, server, location
Arguments1-2

Description

The vhost_traffic_status_average_method directive allows users to define the calculation strategy for average traffic statistics collected by the NGINX virtual host traffic status module. It can take one or two arguments, which specify the method of averaging (such as 'none', 'mean', or 'median') and, optionally, the time interval over which the average should be computed. By default, this directive enables more granular control over how one might interpret traffic metrics, moving beyond just raw totals to more nuanced insights about traffic behaviors.

The directive's placement can be at the http, server, or location context, enabling flexible configuration depending on how detailed you want traffic reporting to be for various segments of an application. For example, specifying a different average method at the location level can allow you to monitor specific endpoints with distinct traffic behaviors, while a broader setting might govern the whole server or upstreams.

When this directive is utilized, the collected statistics reflect the selected averaging methodology, which can then feed into various monitoring and alerting setups. This versatility makes it a valuable tool, especially in environments where traffic patterns fluctuate significantly and understanding average usage is crucial for performance optimization and capacity planning.

Config Example

vhost_traffic_status_average_method mean 1m;

Ensure to define both parameters if you are specifying a time interval; otherwise, the default method will be used.

Using an unsupported averaging method can lead to unexpected behavior or errors in traffic reporting.

← Back to all directives