[
https://issues.apache.org/jira/browse/BEAM-11018?focusedWorklogId=501279&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-501279
]
ASF GitHub Bot logged work on BEAM-11018:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 15/Oct/20 20:04
Start Date: 15/Oct/20 20:04
Worklog Time Spent: 10m
Work Description: ihji commented on a change in pull request #13017:
URL: https://github.com/apache/beam/pull/13017#discussion_r505806435
##########
File path: sdks/python/apache_beam/metrics/cells.py
##########
@@ -238,6 +250,57 @@ def to_runner_api_monitoring_info(self, name,
transform_id):
ptransform=transform_id)
+class HistogramCell(MetricCell):
+ """For internal use only; no backwards-compatibility guarantees.
+
+ Tracks the current value and delta for a histogram metric.
+
+ Each cell tracks the state of a metric independently per context per bundle.
+ Therefore, each metric has a different cell in each bundle, that is later
+ aggregated.
+
+ This class is thread safe since underlying histogram object is thread safe.
+ """
+ def __init__(self, bucket_type):
+ self._bucket_type = bucket_type
+ self.data = HistogramAggregator(bucket_type).identity_element()
+
+ def reset(self):
+ self.data = HistogramAggregator(self._bucket_type).identity_element()
+
+ def combine(self, other):
+ # type: (HistogramCell) -> HistogramCell
+ result = HistogramCell(self._bucket_type)
+ result.data = self.data.combine(other.data)
+ return result
+
+ def update(self, value):
+ self.data.histogram.record(value)
+
+ def get_cumulative(self):
+ # type: () -> HistogramData
+ return self.data.get_cumulative()
+
+ def to_runner_api_monitoring_info(self, name, transform_id):
+ return None
+
+
+class HistogramCellFactory(MetricCellFactory):
Review comment:
`MetricCellFactory` creates a customized factory instance for creating
`MetricCell`. Currently, `MetricCell` is created from `Type[MetricCell]` and
cannot be parameterized. `HistogramCell` needs to support multiple bucket types
with their own parameters so creating from singleton type objects didn't work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 501279)
Time Spent: 5h (was: 4h 50m)
> Use metric for Python BigQuery streaming insert API latency logging
> -------------------------------------------------------------------
>
> Key: BEAM-11018
> URL: https://issues.apache.org/jira/browse/BEAM-11018
> Project: Beam
> Issue Type: Improvement
> Components: io-py-gcp
> Reporter: Heejong Lee
> Assignee: Heejong Lee
> Priority: P2
> Time Spent: 5h
> Remaining Estimate: 0h
>
> Use metric for Python BigQuery streaming insert API latency logging
--
This message was sent by Atlassian Jira
(v8.3.4#803005)