klio.metrics.stackdriver
Klio ships with a Stackdriver Log-based Metrics relay client. The client creates metrics objects in Stackdriver Monitoring based off of filters in Stackdriver Logging. For more information on Stackdriver’s Log-based Metrics, see related documentation.
When running on Dataflow, the client is on by default with no additional configuration needed. This must be actively turned off in klio-job.yaml if not wanted (see below).
klio-job.yaml
The log-based metrics client is not available for direct runner.
To explicitly turn off log-based metrics, in klio-job.yaml:
job_config: metrics: stackdriver_logger: false
klio.metrics.stackdriver.
StackdriverLogMetricsClient
Stackdriver client for transform metrics.
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.
counter
Create a StackdriverLogMetricsCounter object.
StackdriverLogMetricsCounter
Note
Stackdriver counts log lines so initializing a counter value is not supported .
name (str) – name of counter
transform (str) – transform the counter is associated with
tags (dict) – any tags of additional contextual information to associate with the counter
a log-based counter
gauge
Create a StackdriverLogMetricsGauge object.
StackdriverLogMetricsGauge
Warning
Gauges for Stackdriver are not yet supported. This will default to standard logging.
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 log-based gauge
timer
Create a StackdriverLogMetricsTimer object.
StackdriverLogMetricsTimer
Timers for Stackdriver are not yet supported. This will default to standard logging.
a log-based timer
Stackdriver log-based counter metric.
job_name (str) – name of Dataflow job
project (str) – name of GCP project associated with Dataflow job
transform (str) – Name of transform associated with counter, if any.
tags (dict) – Tags to associate with counter. Note: {"metric_type": "counter"} will always be an included tag.
{"metric_type": "counter"}
Pass-thru object for naming only. Stackdriver log-based metrics does not support gauges.
Pass-thru object for naming only. Stackdriver log-based metrics does not support timers.