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

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

                Author: ASF GitHub Bot
            Created on: 28/Sep/21 18:53
            Start Date: 28/Sep/21 18:53
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #15482:
URL: https://github.com/apache/beam/pull/15482#discussion_r717872892



##########
File path: sdks/go/test/integration/wordcount/wordcount_test.go
##########
@@ -30,16 +31,26 @@ import (
 
 func TestWordCount(t *testing.T) {
        tests := []struct {
-               lines []string
-               words int
-               hash  string
+               lines                                                           
  []string
+               words                                                           
  int
+               hash                                                            
  string
+               smallWords                                                      
  string
+               lineLen                                                         
  string

Review comment:
       Remove the constants here and use them down in the test. We don't need 
per-test case repetitions of the same thing. The goal is for things to be as 
configurable as necessary, but not further, so we can *reduce* repetition.

##########
File path: sdks/go/test/integration/wordcount/wordcount.go
##########
@@ -30,9 +30,10 @@ import (
 )
 
 var (
-       wordRE  = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
-       empty   = beam.NewCounter("extract", "emptyLines")
-       lineLen = beam.NewDistribution("extract", "lineLenDistro")
+       wordRE      = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
+       empty       = beam.NewCounter("extract", "emptyLines")
+       lineLen     = beam.NewDistribution("extract", "lineLenDistro")
+       small_words = beam.NewCounter("extract", "smallWords")

Review comment:
       ```suggestion
        smallWords = beam.NewCounter("extract", "smallWords")
   ```
   
   And the use beow.

##########
File path: sdks/go/test/integration/wordcount/wordcount_test.go
##########
@@ -30,16 +31,26 @@ import (
 
 func TestWordCount(t *testing.T) {
        tests := []struct {
-               lines []string
-               words int
-               hash  string
+               lines                                                           
  []string
+               words                                                           
  int
+               hash                                                            
  string
+               smallWords                                                      
  string
+               lineLen                                                         
  string
+               smallWordsCount, lineLenCount, lineLenSum, lineLenMin, 
lineLenMax int64

Review comment:
       I was mistaken earlier. We can do something simpler for the Distribution 
metric, by using a metrics.DistributionValue.
   
   So `lineLen metricsDistributionValue`
   
   then we can configure things with `metrics.DistributionValue{1,1,3,3},`  etc
   
   And just do a straight equality check on the value
   
   `distributonValue != test.lineLen`




-- 
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: 656349)
    Time Spent: 5h 40m  (was: 5.5h)

> Implement metrics filtering
> ---------------------------
>
>                 Key: BEAM-11217
>                 URL: https://issues.apache.org/jira/browse/BEAM-11217
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Kamil Wasilewski
>            Assignee: Ritesh Ghorse
>            Priority: P3
>          Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> `metrics.Results` misses a method for querying metrics using a provided 
> filter. The method should take a filter object as an argument and return 
> `metrics.QueryResults` object containing metrics that matched the filter.



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

Reply via email to