[
https://issues.apache.org/jira/browse/BEAM-11207?focusedWorklogId=510911&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-510911
]
ASF GitHub Bot logged work on BEAM-11207:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Nov/20 17:18
Start Date: 12/Nov/20 17:18
Worklog Time Spent: 10m
Work Description: kamilwu commented on a change in pull request #13272:
URL: https://github.com/apache/beam/pull/13272#discussion_r522276853
##########
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
+}
+
+// Results represents all metrics gathered during the job's execution.
+// It allows for querying metrics using a provided filter.
+type Results struct {
+ counters []CounterResult
+ distributions []DistributionResult
+ gauges []GaugeResult
+}
+
+// AllMetrics returns all metrics from a Results instance.
+func (mr Results) AllMetrics() QueryResults {
+ return QueryResults{mr.counters, mr.distributions, mr.gauges}
+}
+
+// TODO(BEAM-11217): Implement Query(Filter) and metrics filtering
+
+// QueryResults is the result of a query. Allows accessing all of the
+// metrics that matched the filter.
+type QueryResults struct {
+ counters []CounterResult
+ distributions []DistributionResult
+ gauges []GaugeResult
+}
+
+// GetCounters returns an array of counter metrics.
+func (qr QueryResults) GetCounters() []CounterResult {
Review comment:
Let's keep these methods, but remove the Get* prefix.
Regarding the results, a safer option is probably to return their copies
instead. The structs don't have any underlying pointers, so it's not a problem
to use built-in `copy` function.
----------------------------------------------------------------
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: 510911)
Time Spent: 3h 20m (was: 3h 10m)
> [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: 3h 20m
> 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)