lostluck commented on a change in pull request #15657:
URL: https://github.com/apache/beam/pull/15657#discussion_r739375972
##########
File path: sdks/go/pkg/beam/core/metrics/sampler.go
##########
@@ -55,24 +56,31 @@ func (s *StateSampler) Sample(ctx context.Context, t
time.Duration) {
// state change detected
s.millisSinceLastTransition = 0
s.transitionsAtLastSample = ps.transitions
+ s.nextLogTime = s.logInterval
} else {
s.millisSinceLastTransition += t
}
if s.millisSinceLastTransition > s.nextLogTime {
- log.Info(ctx, "...standard long running operation log
...", ps.pid, ps.state, s.millisSinceLastTransition)
+ log.Info(ctx, "Operation ongoing in transform "+ps.pid+
+ " for at least
"+fmt.Sprint(s.millisSinceLastTransition)+
+ " without outputting or completing in state
"+getState(ps.state))
Review comment:
In Go, don't concat messages, use formatting directives. In this case
use Infof.
```suggestion
log.Infof(ctx, "Operation ongoing in transform %v for
at least %v without outputting or completing in state %v",
ps.pid, s.millisSinceLastTransition, getState(ps.state))
```
##########
File path: sdks/go/pkg/beam/core/metrics/sampler.go
##########
@@ -96,3 +104,16 @@ func (s *PTransformState) Set(ctx context.Context, state
bundleProcState) {
atomic.AddInt64(bctx.store.transitions, 1)
}
}
+
+func getState(s bundleProcState) string {
+ switch s {
+ case 0:
+ return "START_BUNDLE"
+ case 1:
+ return "PROCESS_BUNDLE"
+ case 2:
+ return "FINISH BUNDLE"
Review comment:
```suggestion
return "FINISH_BUNDLE"
```
--
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]