apache_beam.metrics.monitoring_infos module¶
-
apache_beam.metrics.monitoring_infos.
to_timestamp_proto
(timestamp_secs)[source]¶ Converts seconds since epoch to a google.protobuf.Timestamp.
Parameters: timestamp_secs – The timestamp in seconds since epoch.
-
apache_beam.metrics.monitoring_infos.
to_timestamp_secs
(timestamp_proto)[source]¶ Converts a google.protobuf.Timestamp to seconds since epoch.
Parameters: timestamp_proto – The google.protobuf.Timestamp.
-
apache_beam.metrics.monitoring_infos.
extract_counter_value
(monitoring_info_proto)[source]¶ Returns the int coutner value of the monitoring info.
-
apache_beam.metrics.monitoring_infos.
extract_distribution
(monitoring_info_proto)[source]¶ Returns the relevant DistributionInt64 or DistributionDouble.
Parameters: monitoring_info_proto – The monitoring infor for the distribution.
-
apache_beam.metrics.monitoring_infos.
create_labels
(ptransform=None, tag=None, namespace=None, name=None)[source]¶ Create the label dictionary based on the provided tags.
Parameters: - ptransform – The ptransform/step name.
- tag – he output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_user_counter
(namespace, name, metric, ptransform=None, tag=None)[source]¶ Return the counter monitoring info for the specifed URN, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- metric – The metric proto field to use in the monitoring info. Or an int value.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_counter
(urn, metric, ptransform=None, tag=None)[source]¶ Return the counter monitoring info for the specifed URN, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- metric – The metric proto field to use in the monitoring info. Or an int value.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_user_distribution
(namespace, name, metric, ptransform=None, tag=None)[source]¶ Return the distribution monitoring info for the URN, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- metric – The metric proto field to use in the monitoring info. Or an int value.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_distribution
(urn, metric, ptransform=None, tag=None)[source]¶ Return a distribution monitoring info for the URN, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- metric – The metric proto field to use in the monitoring info.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_user_gauge
(namespace, name, metric, ptransform=None, tag=None)[source]¶ Return the gauge monitoring info for the URN, metric and labels.
Parameters: - namespace – User-defined namespace of counter.
- name – Name of counter.
- metric – The metric proto field to use in the monitoring info. Or an int value.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
int64_gauge
(urn, metric, ptransform=None, tag=None)[source]¶ Return the gauge monitoring info for the URN, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- metric – The metric proto field to use in the monitoring info.
- ptransform – The ptransform/step name used as a label.
- tag – The output tag name, used as a label.
-
apache_beam.metrics.monitoring_infos.
create_monitoring_info
(urn, type_urn, metric_proto, labels=None)[source]¶ Return the gauge monitoring info for the URN, type, metric and labels.
Parameters: - urn – The URN of the monitoring info/metric.
- type_urn – The URN of the type of the monitoring info/metric. i.e. beam:metrics:sum_int_64, beam:metrics:latest_int_64.
- metric_proto – The metric proto field to use in the monitoring info. Or an int value.
- labels – The label dictionary to use in the MonitoringInfo.
-
apache_beam.metrics.monitoring_infos.
is_counter
(monitoring_info_proto)[source]¶ Returns true if the monitoring info is a coutner metric.
-
apache_beam.metrics.monitoring_infos.
is_distribution
(monitoring_info_proto)[source]¶ Returns true if the monitoring info is a distrbution metric.
-
apache_beam.metrics.monitoring_infos.
is_gauge
(monitoring_info_proto)[source]¶ Returns true if the monitoring info is a gauge metric.
-
apache_beam.metrics.monitoring_infos.
is_user_monitoring_info
(monitoring_info_proto)[source]¶ Returns true if the monitoring info is a user metric.
-
apache_beam.metrics.monitoring_infos.
extract_metric_result_map_value
(monitoring_info_proto)[source]¶ Returns the relevant GaugeResult, DistributionResult or int value.
These are the proper format for use in the MetricResult.query() result.
-
apache_beam.metrics.monitoring_infos.
parse_namespace_and_name
(monitoring_info_proto)[source]¶ Returns the (namespace, name) tuple of the URN in the monitoring info.
-
apache_beam.metrics.monitoring_infos.
get_step_name
(monitoring_info_proto)[source]¶ Returns a step name for the given monitoring info or None if step name cannot be specified.