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

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

                Author: ASF GitHub Bot
            Created on: 13/Oct/18 14:07
            Start Date: 13/Oct/18 14:07
    Worklog Time Spent: 10m 
      Work Description: stale[bot] closed pull request #6157: [BEAM-5097][WIP] 
Add counter to combine example in go sdk
URL: https://github.com/apache/beam/pull/6157
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/go/examples/cookbook/combine/combine.go 
b/sdks/go/examples/cookbook/combine/combine.go
index 7e24aa1fb30..1950a687d24 100644
--- a/sdks/go/examples/cookbook/combine/combine.go
+++ b/sdks/go/examples/cookbook/combine/combine.go
@@ -63,11 +63,16 @@ type extractFn struct {
        MinLength int `json:"min_length"`
 }
 
+// A global context for simplicity.
+var ctx = context.Background()
+
 func (f *extractFn) ProcessElement(row WordRow, emit func(string, string)) {
+       small_words := beam.NewCounter("example.namespace", "small_words")
        if len(row.Word) >= f.MinLength {
                emit(row.Word, row.Corpus)
+       } else {
+               small_words.Inc(ctx, 1)
        }
-       // TODO(herohde) 7/14/2017: increment counter for "small words"
 }
 
 // TODO(herohde) 7/14/2017: the choice of a string (instead of []string) for 
the


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 154100)
    Time Spent: 1h 40m  (was: 1.5h)

> Increment counter for "small words" in go SDK example
> -----------------------------------------------------
>
>                 Key: BEAM-5097
>                 URL: https://issues.apache.org/jira/browse/BEAM-5097
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: holdenk
>            Assignee: holdenk
>            Priority: Trivial
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Increment counter for "small words" in go SDK example



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to