-
Notifications
You must be signed in to change notification settings - Fork 104
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
Dynamic series adjustment #64
Dynamic series adjustment #64
Conversation
7e5e09e
to
519f6be
Compare
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.
Looking good! Just a few minor implementation comments.
Looks like the tests are failing, there's a make target make test
which should run them the same way as Circle CI is where they're failing.
cmd/avalanche.go
Outdated
labelInterval = kingpin.Flag("series-interval", "Change series_id label values every {interval} seconds.").Default("60").Int() | ||
metricInterval = kingpin.Flag("metric-interval", "Change __name__ label values every {interval} seconds.").Default("120").Int() | ||
seriesChangeInterval = kingpin.Flag("series-change-interval", "Change the number of series every {interval} seconds.").Default("10").Int() | ||
operationMode = kingpin.Flag("operation-mode", "Mode of operation: 'gradual-change', 'series-spike', 'double-halve'").Default("default").String() |
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.
series-spike
doesn't look like it exists yet?
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.
I will add spike mode in next PR! So, I deleted this part of text in this PR.
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.
👍 sounds good
metrics/serve.go
Outdated
case "gradual-change": | ||
go func() { | ||
for tick := range changeSeriesTick.C { | ||
fmt.Printf("%v: Adjusting series count. New count: %d\n", tick, seriesCount) | ||
metricsMux.Lock() | ||
seriesCount += seriesChangeRate | ||
if seriesCount < 1 { | ||
seriesCount = 1 | ||
} | ||
unregisterMetrics() | ||
registerMetrics(metricCount, metricLength, metricCycle, labelKeys) | ||
cycleValues(labelKeys, labelValues, seriesCount, seriesCycle) | ||
metricsMux.Unlock() | ||
|
||
select { | ||
case updateNotify <- struct{}{}: | ||
default: | ||
} | ||
} | ||
}() |
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.
one change I'd like to see to this functionality; it would be nice if we gradually increased up to some maximum, and then gradually decreased back down to the starting value (and repeat)
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.
I have made the changes!
metrics/serve.go
Outdated
default: | ||
} |
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.
I think the above go routines, before your switch statement, should maybe be the default case?
Otherwise we have both those AND the operation mode we've decided on both modifying the # of metrics and series.
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.
I fixed🙆♀️
cmd/avalanche.go
Outdated
metricCount = kingpin.Flag("metric-count", "Number of metrics to serve.").Default("500").Int() | ||
labelCount = kingpin.Flag("label-count", "Number of labels per-metric.").Default("10").Int() | ||
seriesCount = kingpin.Flag("series-count", "Number of series per-metric.").Default("10").Int() | ||
seriesChangeRate = kingpin.Flag("series-change-rate", "The rate at which the number of active series changes over time. Positive value increases the series, negative value decreases the series.").Default("10").Int() |
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.
for the flags that only apply to specific operation modes, can we specify which they work for in the help text?
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.
8acfd37
to
aaf4804
Compare
Additionally, I made the following changes:
Please review the updated PR and let me know if you have any further suggestions or concerns. |
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.
we could have another PR to move the new operation modes to a separate sub command: https://pkg.go.dev/github.com/alecthomas/kingpin#readme-sub-commands
a few more comments about organization/structure of the code
1c44292
to
28678fb
Compare
If you rebase or merge in master it looks like Ben updated the build dependencies recently, so we don't need the change to upgrade to |
3cc0f5b
to
55c0c4a
Compare
marged and I signed |
692db74
to
8d7c0c5
Compare
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
… logic Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
∙ fix InvalidSeriesCount logic, add test Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
8d7c0c5
to
fddb408
Compare
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
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.
I left a few comments for code change suggestions; these simplify the code a bit and also make sure that the two new operation modes have metrics available for scraping immediately. We either need this change or to set currentSeriesCount = seriesCount
in each of the two new modes as you've done in the default case.
Signed-off-by: yomek33 <[email protected]>
Signed-off-by: yomek33 <[email protected]>
77cb088
to
bddbb3b
Compare
Signed-off-by: yomek33 <[email protected]>
56328e0
to
a41aecf
Compare
@yomek33 good work! |
Add two new operation modes to the RunMetrics function:
gradual-change
anddouble-halve
:double-halve
usage
./avalanche --operation-mode=double-halve --series-change-interval=30 --series-count=20
This mode alternately doubles and halves the series count at regular intervals.
The series count is doubled on one tick and halved on the next, ensuring it never drops below 1.
gradual-change
usage
./avalanche --operation-mode=gradual-change --series-change-interval=30 --series-change-rate=10 series-count=20
This mode gradually changes the series count by a fixed rate at regular intervals
The series count is incremented by seriesChangeRate on each tick, ensuring it never drops below 1.
Tests