Metrics Implementations¶
ffwd¶
Gordon ships with a simple ffwd metrics implementation, which can be enabled via configuration. This module contains the SimpleFfwdRelay, and all required classes that it uses to send messsages to the ffwd daemon via UDP.
The SimpleFfwdRelay requires no configuration, but can be customized. The defaults that may be overridden are shown below.
[ffwd]
# to identify the service creating metrics
key = 'gordon-service'
# the address of the ffwd daemon (see: UDPClient)
ip = "127.0.0.9"
port = 19000
# a scaling factor for timing (see: FfwdTimer)
time_unit = 1E9
-
class
gordon.metrics.ffwd.
SimpleFfwdRelay
(config)[source]¶ Metrics relay which sends to FFWD immediately.
The relay does no client-side aggregation and metrics are emitted immediately. The relay uses a combination of the key and attributes fields to semantically identify metrics in ffwd.
Parameters: config (dict) – Configuration with optional keys described above. -
incr
(metric_name, value=1, context=None, **kwargs)[source]¶ Increase a metric by 1 or a given amount.
Parameters:
-
-
class
gordon.metrics.ffwd.
FfwdTimer
(metric, udp_client, time_unit=None)[source]¶ Timer which sends UDP messages to FFWD on completion.
Parameters:
-
class
gordon.metrics.ffwd.
UDPClient
(ip=None, port=None, loop=None)[source]¶ Client for sending UDP datagrams.
Parameters:
-
class
gordon.metrics.ffwd.
UDPClientProtocol
(message)[source]¶ Protocol for sending one-off messages via UDP.
Parameters: message (bytes) – Message for ffwd agent. -
connection_made
(transport)[source]¶ Create connection, use to send message and close.
Parameters: transport (asyncio.DatagramTransport) – Transport used for sending.
-