-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Export expvar metrics of badger to the metricsFactory #1704
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7522e22
Export expvar metrics of badger to the metricsFactory
burmanm 38595bb
Add test for metrics collector. Fix the maintenance interval, it shou…
burmanm c9544d3
Address comments, add test for map existence, channel closing and use…
burmanm 8a71919
Merge branch 'master' into badger_metrics
yurishkuro ac096cd
Merge branch 'master' into badger_metrics
yurishkuro 680e1e6
Remove directory tag from the metric name
burmanm 2e05a8e
Merge branch 'badger_metrics' of github.com:burmanm/jaeger into badge…
burmanm 40438c1
Merge branch 'master' into badger_metrics
yurishkuro 7fc7581
Merge branch 'master' into badger_metrics
yurishkuro b23abb3
Merge branch 'master' into badger_metrics
yurishkuro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,3 +144,33 @@ func TestMaintenanceCodecov(t *testing.T) { | |
_ = f.store.Close() | ||
waiter() // This should trigger the logging of error | ||
} | ||
|
||
func TestBadgerMetrics(t *testing.T) { | ||
f := NewFactory() | ||
v, command := config.Viperize(f.AddFlags) | ||
command.ParseFlags([]string{ | ||
"--badger.metrics-update-interval=10ms", | ||
}) | ||
f.InitFromViper(v) | ||
mFactory := metricstest.NewFactory(0) | ||
f.Initialize(mFactory, zap.NewNop()) | ||
assert.NotNil(t, f.metrics.badgerMetrics) | ||
_, found := f.metrics.badgerMetrics["badger_memtable_gets_total"] | ||
assert.True(t, found) | ||
|
||
waiter := func(previousValue int64) int64 { | ||
sleeps := 0 | ||
_, gs := mFactory.Snapshot() | ||
for gs["adger_memtable_gets_total"] == previousValue && sleeps < 8 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why "adger"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo. It always sleeps the maximum with that typo, so the test functions correctly - but might take too long. I'll fix that. |
||
// Wait for the scheduler | ||
time.Sleep(time.Duration(50) * time.Millisecond) | ||
sleeps++ | ||
_, gs = mFactory.Snapshot() | ||
} | ||
assert.True(t, gs["badger_memtable_gets_total"] > previousValue) | ||
return gs["badger_memtable_gets_total"] | ||
} | ||
|
||
vlogSize := waiter(0) | ||
assert.True(t, vlogSize > 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to see a test for the expvar.Map metrics as well.