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

0.4.x #189

Merged
merged 2 commits into from
Jan 5, 2017
Merged

0.4.x #189

merged 2 commits into from
Jan 5, 2017

Conversation

kailuowang
Copy link
Collaborator

No description provided.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling fd40fc3 on kailuowang:0.4.x into ** on iheartradio:0.4.x**.

@kailuowang
Copy link
Collaborator Author

@nsauro @lvauthrin @joprice anyone interested in reviewing this simple PR?

@@ -118,14 +118,20 @@ object Regulator {
weightOfLatestMetric: Double = 0.5
)

private val MaximumEstimatedDelayRatio = 100000

Choose a reason for hiding this comment

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

This is called ratio but isn't a fraction or ratio. Should this be a factor?

): Option[FiniteDuration] = {
val totalMillis = queueLength.value.toDouble / speed.value
//avoid creating too long an estimated delay, which is meaningless anyway
if (speed.value == 0 || totalMillis > (referenceDelay.toMillis * MaximumEstimatedDelayRatio)) None else Some(totalMillis.milliseconds)

Choose a reason for hiding this comment

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

Can we add a test for this? Also, do we just want to set an upper bound for the value or return None here? Not sure if one makes more sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the None value is indicating that delay is too long to estimate (note it's None when the speed is zero) . I thought about caping it at the max, but that might give some false impression on grafana chart.
I am adding a test.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f68fa52 on kailuowang:0.4.x into ** on iheartradio:0.4.x**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d5c85a1 on kailuowang:0.4.x into ** on iheartradio:0.4.x**.

@@ -118,14 +118,20 @@ object Regulator {
weightOfLatestMetric: Double = 0.5
)

private val MaximumEstimatedDelayFactor = 100000
Copy link
Contributor

Choose a reason for hiding this comment

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

I would jus prefix this with MS or something to denote the time unit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a factor, not bound to a time unit. If the referenceDelay is 1 second the maximumEstimatedDelay would be referenceDelay * MaximumEstimatedDelayFactor = 1000000 second.

@@ -52,7 +52,7 @@ class Regulator(settings: Settings, metricsCollector: ActorRef, regulatee: Actor
def receive: Receive = {
case s: Sample ⇒
context become regulating(Status(
delay = estimateDelay(s, s.speed),
delay = estimateDelay(s, s.speed, settings.referenceDelay),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there no reference.conf update needed for this new value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not a new value, it's an existing configuration value.

@kailuowang kailuowang merged commit 9554e53 into iheartradio:0.4.x Jan 5, 2017
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.

4 participants