[
https://issues.apache.org/jira/browse/BEAM-11207?focusedWorklogId=509735&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-509735
]
ASF GitHub Bot logged work on BEAM-11207:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 10/Nov/20 14:38
Start Date: 10/Nov/20 14:38
Worklog Time Spent: 10m
Work Description: kamilwu commented on a change in pull request #13272:
URL: https://github.com/apache/beam/pull/13272#discussion_r520611568
##########
File path: sdks/go/pkg/beam/core/metrics/metrics.go
##########
@@ -448,3 +453,73 @@ func (m *gauge) get() (int64, time.Time) {
defer m.mu.Unlock()
return m.v, m.t
}
+
+// GaugeValue is the value of a Gauge metric.
+type GaugeValue struct {
+ Value int64
+ Timestamp time.Time
+}
+
+// MetricResults queries for all metric values that match a given filter.
+type MetricResults struct {
+ Counters []CounterResult
+ Distributions []DistributionResult
+ Gauges []GaugeResult
+}
+
+// AllMetrics returns all metrics from a MetricResults instance.
+func (mr MetricResults) AllMetrics() MetricQueryResults {
+ return MetricQueryResults{mr.Counters, mr.Distributions, mr.Gauges}
+}
+
+// TODO: Implement Query(MetricsFilter) and metrics filtering
+
+// MetricQueryResults is the results of a query. Allows accessing all of the
+// metrics that matched the filter.
+type MetricQueryResults struct {
+ counters []CounterResult
+ distributions []DistributionResult
+ gauges []GaugeResult
+}
+
+// GetCounters returns an array of counter metrics.
+func (qr MetricQueryResults) GetCounters() []CounterResult {
+ return qr.counters
+}
+
+// GetDistributions returns an array of distribution metrics.
+func (qr MetricQueryResults) GetDistributions() []DistributionResult {
+ return qr.distributions
+}
+
+// GetGauges returns an array of gauges metrics.
+func (qr MetricQueryResults) GetGauges() []GaugeResult {
+ return qr.gauges
+}
+
+// CounterResult is an attempted and a commited value of a Counter metric plus
+// key.
+type CounterResult struct {
+ Attempted, Committed int64
+ Key MetricKey
+}
+
+// DistributionResult is an attempted and a commited value of a Distribution
+// metric plus key.
+type DistributionResult struct {
+ Attempted, Committed DistributionValue
+ Key MetricKey
+}
+
+// GaugeResult is an attempted and a commited value of a Gauge metric plus
+// key.
+type GaugeResult struct {
+ Attempted, Committed GaugeValue
+ Key MetricKey
+}
+
+// MetricKey includes the namespace and the name of the metric, as well as
+// the step that reported the metric.
+type MetricKey struct {
Review comment:
`StepKey` sounds good. Thanks for suggestion.
----------------------------------------------------------------
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: 509735)
Time Spent: 1.5h (was: 1h 20m)
> [Go SDK] Support metrics querying
> ---------------------------------
>
> Key: BEAM-11207
> URL: https://issues.apache.org/jira/browse/BEAM-11207
> Project: Beam
> Issue Type: New Feature
> Components: sdk-go
> Reporter: Kamil Wasilewski
> Assignee: Kamil Wasilewski
> Priority: P2
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> Design doc: [https://s.apache.org/get-metrics-api]
> Go SDK does not offer a way to query a pipeline's metrics. Go SDK needs to
> implement a code that would call the GetJobMetrics RPC and let users query
> the result by using an API similar to existing APIs in Python and Java SDKs.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)