[ 
https://issues.apache.org/jira/browse/BEAM-11207?focusedWorklogId=509752&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-509752
 ]

ASF GitHub Bot logged work on BEAM-11207:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Nov/20 15:06
            Start Date: 10/Nov/20 15:06
    Worklog Time Spent: 10m 
      Work Description: kamilwu commented on a change in pull request #13272:
URL: https://github.com/apache/beam/pull/13272#discussion_r520633641



##########
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:
       Perhaps we could skip these getters and expose QueryResults's fields 
directly. We don't need to follow Java API that much. @lostluck What do you 
think?




----------------------------------------------------------------
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: 509752)
    Time Spent: 2.5h  (was: 2h 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: 2.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)

Reply via email to