awslimitchecker.metrics.base module¶
-
class
awslimitchecker.metrics.base.
MetricsProvider
(region_name)[source]¶ Bases:
object
Initialize a MetricsProvider class. This MUST be overridden by subclasses. All configuration must be passed as keyword arguments to the class constructor (these come from
--metrics-config
CLI arguments). Any dependency imports must be made in the constructor. The constructor should do as much as possible to validate configuration.Parameters: region_name (str) – the name of the region we’re connected to -
__dict__
= mappingproxy({'__module__': 'awslimitchecker.metrics.base', '__metaclass__': <class 'abc.ABCMeta'>, '__init__': <function MetricsProvider.__init__>, 'set_run_duration': <function MetricsProvider.set_run_duration>, 'add_limit': <function MetricsProvider.add_limit>, 'flush': <function MetricsProvider.flush>, 'providers_by_name': <staticmethod object>, 'get_provider_by_name': <staticmethod object>, '__dict__': <attribute '__dict__' of 'MetricsProvider' objects>, '__weakref__': <attribute '__weakref__' of 'MetricsProvider' objects>, '__doc__': None})¶
-
__init__
(region_name)[source]¶ Initialize a MetricsProvider class. This MUST be overridden by subclasses. All configuration must be passed as keyword arguments to the class constructor (these come from
--metrics-config
CLI arguments). Any dependency imports must be made in the constructor. The constructor should do as much as possible to validate configuration.Parameters: region_name (str) – the name of the region we’re connected to
-
__metaclass__
¶ alias of
abc.ABCMeta
-
__module__
= 'awslimitchecker.metrics.base'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_limit
(limit)[source]¶ Cache a given limit for later sending to the metrics store.
Parameters: limit (AwsLimit) – a limit to cache
-
flush
()[source]¶ Flush all metrics to the provider. This is the method that actually sends data to your metrics provider/store. It should iterate over
self._limits
and send metrics for them, as well as forself._duration
.
-
static
get_provider_by_name
(name)[source]¶ Get a reference to the provider class with the specified name.
Parameters: name (str) – name of the MetricsProvider subclass Returns: MetricsProvider subclass Return type: class
Raises: RuntimeError
-