klio.metrics.shumway
Klio supports emitting metrics for sending metrics to a FFWD agent via the shumway library.
This client is enabled by default when running with Klio’s DirectGKERunner. This must be actively turned off in klio-job.yaml if not wanted:
klio-job.yaml
job_config: metrics: shumway: False
Configuration is supported for the key used to report metrics, as well as unit of measure for timers objects in klio-job.yaml:
job_config: metrics: shumway: # The default value for `key` is the job's name. key: my-job-key # Default timer unit is ns/nanoseconds; available # options include `s` or `seconds`, `ms` or `milliseconds`, # `us` or `microseconds`, and `ns` or `nanoseconds`. timer_unit: seconds
To configure a different unit of measure than the default for specific timers, pass in the desired unit when instantiating. For example:
class MyTransform(KlioBaseTransform): def __init__(self): self.my_timer = self._klio.metrics.timer( name="my-timer", timer_unit="ns" )
klio.metrics.shumway.
TIMER_UNIT_MAP
Map of supported measurement units to shorthand for ShumwayTimer.
ShumwayTimer
ShumwayMetricsClient
Metrics client for FFWD metrics reporting via the shumway library.
Intended to be instantiated by klio.metrics.client.MetricsRegistry and not by itself.
klio.metrics.client.MetricsRegistry
klio_config (klio_core.config.KlioConfig) – the job’s configuration.
DEFAULT_FFWD_ADDR
Default unit of measurement for timer metrics.
unmarshal
Return a dict-representation of a given metric.
metric (BaseShumwayMetric) – logger-specific metrics object
metric data
dict(str, str)
emit
Emit a metric to the FFWD agent.
counter
Create a ShumwayCounter object.
ShumwayCounter
name (str) – name of counter
value (int) – starting value of counter; defaults to 0
transform (str) – transform the counter is associated with
tags (dict) – any tags of additional contextual information to associate with the counter
a shumway-based counter
gauge
Create a ShumwayGauge object.
ShumwayGauge
name (str) – name of gauge
value (int) – starting value of gauge; defaults to 0
transform (str) – transform the gauge is associated with
tags (dict) – any tags of additional contextual information to associate with the gauge
a shumway-based gauge
timer
Create a ShumwayTimer object.
name (str) – name of timer
value (int) – starting value of timer; defaults to 0
transform (str) – transform the timer is associated with
tags (dict) – any tags of additional contextual information to associate with the timer
timer_unit (str) – timer unit; defaults to configured value in klio-job.yaml, or “ns”. Options: TIMER_UNIT_MAP.
a shumway-based timer
BaseShumwayMetric
Base metric type for shumway.
value (int) – initial value. Default: 0.
0
transform (str) – Name of transform associated with metric, if any.
tags (dict) – Tags to associate with metric.
Shumway counter metric.
transform (str) – Name of transform associated with counter, if any.
tags (dict) – Tags to associate with counter.
Shumway gauge metric.
Shumway timer metric.
timer_unit (str) – Unit of measurement. Options: TIMER_UNIT_MAP. Default: ns (nanoseconds).
ns
tags (list) – Tags to associate with counter.