This is an automated email from the ASF dual-hosted git repository.
lostluck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new a17cd06 [BEAM-13001] fixes Golint issues (#15859)
a17cd06 is described below
commit a17cd065bae25fb6742e60c4b0419b7262405157
Author: Ritesh Ghorse <[email protected]>
AuthorDate: Mon Nov 1 19:38:14 2021 -0400
[BEAM-13001] fixes Golint issues (#15859)
---
sdks/go/pkg/beam/core/metrics/sampler.go | 4 +++-
sdks/go/pkg/beam/core/metrics/store.go | 10 +++++++---
sdks/go/pkg/beam/core/runtime/metricsx/urns.go | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/sdks/go/pkg/beam/core/metrics/sampler.go
b/sdks/go/pkg/beam/core/metrics/sampler.go
index 106788d..6396869 100644
--- a/sdks/go/pkg/beam/core/metrics/sampler.go
+++ b/sdks/go/pkg/beam/core/metrics/sampler.go
@@ -81,10 +81,12 @@ func loadCurrentState(s *StateSampler) currentStateVal {
return currentStateVal{pid: bs.pid, state: bs.currentState,
transitions: atomic.LoadInt64(s.store.transitions)}
}
+// PTransformState stores the state of PTransform for DoFn metrics.
type PTransformState struct {
states [3]BundleState
}
+// NewPTransformState creates a new PTransformState.
func NewPTransformState(pid string) *PTransformState {
return &PTransformState{
states: [3]BundleState{
@@ -95,7 +97,7 @@ func NewPTransformState(pid string) *PTransformState {
}
}
-// SetPTransformState stores the state of PTransform in its bundle.
+// Set stores the state of PTransform in its bundle.
func (s *PTransformState) Set(ctx context.Context, state bundleProcState) {
if bctx, ok := ctx.(*beamCtx); ok {
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&bctx.store.bundleState)),
unsafe.Pointer(&s.states[state]))
diff --git a/sdks/go/pkg/beam/core/metrics/store.go
b/sdks/go/pkg/beam/core/metrics/store.go
index bfbace3..79c5ab8 100644
--- a/sdks/go/pkg/beam/core/metrics/store.go
+++ b/sdks/go/pkg/beam/core/metrics/store.go
@@ -155,10 +155,14 @@ type ptCounterSet struct {
type bundleProcState int
const (
- StartBundle bundleProcState = 0
+ // StartBundle indicates starting state of a bundle
+ StartBundle bundleProcState = 0
+ // ProcessBundle indicates processing state of a bundle
ProcessBundle bundleProcState = 1
- FinishBundle bundleProcState = 2
- TotalBundle bundleProcState = 3
+ // FinishBundle indicates finishing state of a bundle
+ FinishBundle bundleProcState = 2
+ // TotalBundle (not a state) used for aggregating above states of a
bundle
+ TotalBundle bundleProcState = 3
)
// ExecutionState stores the information about a bundle in a particular state.
diff --git a/sdks/go/pkg/beam/core/runtime/metricsx/urns.go
b/sdks/go/pkg/beam/core/runtime/metricsx/urns.go
index 1b16405..8586b0a 100644
--- a/sdks/go/pkg/beam/core/runtime/metricsx/urns.go
+++ b/sdks/go/pkg/beam/core/runtime/metricsx/urns.go
@@ -170,6 +170,7 @@ func Int64Distribution(count, sum, min, max int64) ([]byte,
error) {
return buf.Bytes(), nil
}
+// ExecutionMsecUrn returns the Urn for the bundle state
func ExecutionMsecUrn(i int) Urn {
switch i {
case 0: