Skip to content

Commit

Permalink
fix: calculate processing rate for sink vertices (#1025)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
KeranYang authored and whynowy committed Sep 14, 2023
1 parent 6408137 commit 7119ed9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions pkg/daemon/server/service/rater/pod_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (pt *PodTracker) Start(ctx context.Context) error {
vType = "reduce"
} else if v.IsASource() {
vType = "source"
} else if v.IsASink() {
vType = "sink"
} else {
vType = "other"
}
Expand Down
19 changes: 13 additions & 6 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,20 @@ func (s *FunctionalSuite) TestCreateSimplePipeline() {
waitInterval := 10 * time.Second
succeedChan := make(chan struct{})
go func() {
vertexNames := []string{"input", "p1", "output"}
for {
m, err := client.GetVertexMetrics(context.Background(), pipelineName, "p1")
assert.NoError(s.T(), err)
assert.Equal(s.T(), pipelineName, *m[0].Pipeline)
oneMinRate := m[0].ProcessingRates["1m"]
// the rate should be around 5
if oneMinRate < 4 || oneMinRate > 6 {
accurateCount := 0
for _, vertexName := range vertexNames {
m, err := client.GetVertexMetrics(context.Background(), pipelineName, vertexName)
assert.NoError(s.T(), err)
assert.Equal(s.T(), pipelineName, *m[0].Pipeline)
oneMinRate := m[0].ProcessingRates["1m"]
// the rate should be around 5
if oneMinRate > 4 || oneMinRate < 6 {
accurateCount++
}
}
if accurateCount != len(vertexNames) {
time.Sleep(waitInterval)
} else {
succeedChan <- struct{}{}
Expand Down

0 comments on commit 7119ed9

Please sign in to comment.