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

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

                Author: ASF GitHub Bot
            Created on: 19/Oct/21 15:31
            Start Date: 19/Oct/21 15:31
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #15657:
URL: https://github.com/apache/beam/pull/15657#discussion_r731994073



##########
File path: sdks/go/pkg/beam/core/metrics/sampler.go
##########
@@ -30,60 +30,24 @@ func NewSampler(ctx context.Context, store *Store) 
StateSampler {
        return StateSampler{store: store}
 }
 
-func initialize() [4]*ExecutionState {
-       var v [4]*ExecutionState
-       for i := 0; i < 4; i++ {
-               v[i] = &ExecutionState{}
-       }
-       return v
-}
-
 func (s *StateSampler) Sample(ctx context.Context, t time.Duration) {
-       ps := loadPTransformState(ctx)
-       pid := PTransformLabels(ps.pid)
-
+       ps := loadCurrentState(ctx)
        s.store.mu.Lock()
        defer s.store.mu.Unlock()
 
-       if _, ok := s.store.stateRegistry[pid]; !ok {
-               s.store.stateRegistry[pid] = initialize()
-       }
-       if v, ok := s.store.stateRegistry[pid]; ok {
+       if v, ok := s.store.stateRegistry[ps.pid]; ok {
                v[ps.state].TotalTime += t
                v[TotalBundle].TotalTime += t
-       }
 
-       if _, ok := s.store.executionStore[pid]; !ok {
-               s.store.executionStore[pid] = &executionTracker{}
-       }
-       if v, ok := s.store.executionStore[pid]; ok {
+               e := s.store.executionStore
 
-               if v.transitionsAtLastSample != ps.transitions {
-                       // state change
-                       v.millisSinceLastTransition = 0
-                       v.numberOfTransitions = ps.transitions
-                       v.transitionsAtLastSample = ps.transitions
+               if e.transitionsAtLastSample != ps.transitions {
+                       // state change detected
+                       e.millisSinceLastTransition = 0
+                       e.numberOfTransitions = ps.transitions

Review comment:
       To be clear, sampler should have `transitionsAtLastSample` while 
`numberOfTransitions` should go away. My original comment wasn't specific 
enough.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 667084)
    Time Spent: 3h 40m  (was: 3.5h)

> DoFn Execution time metrics (msecs) for Go SDK
> ----------------------------------------------
>
>                 Key: BEAM-13001
>                 URL: https://issues.apache.org/jira/browse/BEAM-13001
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Ritesh Ghorse
>            Assignee: Ritesh Ghorse
>            Priority: P2
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> Implement DoFn execution time metrics for Go SDK. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to