[−][src]Function metrical::from_env
pub fn from_env(prefix: Option<&str>) -> Result<(), MetricalError>
Configure metrical by looking up environment variables.
Variables:
The following environment variables are used:
- METRICAL_FLUSH_INTERVAL: Specifies the interval (in milliseconds) to flush records to server. If unspecified, the library will not flush based on time since the last flush (Default: None).
- METRICAL_FLUSH_AMOUNT: Specifies the amount of records to buffer before flushing records. If unspecified, the library will not limit the size of its buffer. (Default: None)
If both METRICAL_FLUSH_INTERVAL and METRICAL_FLUSH_AMOUNT are unspecified, only manual flushing will send data to the server.
-
METRICAL_NAMESPACE: Specifies the namespace to place the metrics under.
-
METRICAL_NETWORK_PROTOCOL: Specifies the protocol [UDP|TCP] to send the data as.
-
METRICAL_SEND_METHOD: Specifies which method to send the data with. This can take on one of three values: Statsd, Graphite, Graphite_Pickle
-
METRICAL_NETWORK_DESTINATION: Specifies the destination to send the metrics to. For now, this is limited to an ip_address:port, or just an ip_address. If port is unspecified, a sane default is chosen, given the send method.
Arguments
- prefix - Specifies a prefix for the environment variables to look for.
Example
If the prefix was "MY_PROJECT", the environment variable for "METRICAL_FLUSH_INTERVAL" would be "MY_PROJECT_METRICAL_FLUSH_INTERVAL".