Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky client metrics test #2170

Merged
merged 3 commits into from
Apr 6, 2020
Merged

Conversation

yurishkuro
Copy link
Member

Resolves #2108

Supersedes #2168

Signed-off-by: Yuri Shkuro <ys@uber.com>
@yurishkuro yurishkuro requested a review from a team as a code owner April 6, 2020 16:47
Yuri Shkuro added 2 commits April 6, 2020 12:49
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
@codecov
Copy link

codecov bot commented Apr 6, 2020

Codecov Report

Merging #2170 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2170      +/-   ##
==========================================
+ Coverage   96.14%   96.16%   +0.01%     
==========================================
  Files         219      219              
  Lines       10585    10585              
==========================================
+ Hits        10177    10179       +2     
+ Misses        353      351       -2     
  Partials       55       55              
Impacted Files Coverage Δ
...lugin/sampling/strategystore/adaptive/processor.go 100.00% <0.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ee7073...13b8786. Read the comment docs.

time.Sleep(500 * time.Microsecond)

t.Run("detect new client", func(t *testing.T) {
assert.EqualValues(t, 0, getGauge(), "start with gauge=0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? What else could set the gauge to a non zero value earlier?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a sanity check

params := ClientMetricsReporterParams{
ExpireFrequency: 100 * time.Microsecond,
ExpireTTL: 5 * time.Millisecond,
ExpireFrequency: 1 * time.Millisecond,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can simply be time.Millisecond

require.EqualValues(t, 1, gauge)
})

t.Run("detect stale client", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it difficult to start with gauges at a specific value instead of relying on EmitBatch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, it would probably require some backdoor. This way we're testing cleanly via the official APIs.

@yurishkuro yurishkuro merged commit 381cb97 into jaegertracing:master Apr 6, 2020
@yurishkuro yurishkuro deleted the fix-2108 branch April 6, 2020 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix flaky test TestClientMetricsReporter_Expire
2 participants