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

refactor liklus scaler #6433

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

omerap12
Copy link
Contributor

Provide a description of what has been changed

Checklist

Fixes #

Relates to #5797

@omerap12 omerap12 requested a review from a team as a code owner December 20, 2024 09:00
Signed-off-by: Omer Aplatony <[email protected]>
@omerap12 omerap12 force-pushed the refactor_liklus_scaler branch from cfe52d7 to 56f8d4a Compare December 20, 2024 11:11
Copy link
Member

@wozniakjan wozniakjan left a comment

Choose a reason for hiding this comment

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

great work! just a few minor details below

Comment on lines 165 to 172
switch {
case config.TriggerMetadata["topic"] == "":
case meta.Topic == "":
return nil, ErrLiiklusNoTopic
case config.TriggerMetadata["address"] == "":
case meta.Address == "":
return nil, ErrLiiklusNoAddress
case config.TriggerMetadata["group"] == "":
case meta.Group == "":
return nil, ErrLiiklusNoGroup
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be safe to remove because Topic, Address, and Group are not marked as optional in the field tags so the TypedConfig parsing will throw an error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. fixed in: 4934fd0

if err != nil {
t.Fatal("Could not parse metadata:", err)
}
meta.triggerIndex = testData.triggerIndex
Copy link
Member

Choose a reason for hiding this comment

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

tests shouldn't modify the meta from parseLiiklusMetadata

activationLagThreshold: activationLagThreshold,
triggerIndex: config.TriggerIndex,
}, nil
return meta, nil
Copy link
Member

Choose a reason for hiding this comment

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

I think this is the place that should populate meta.triggerIndex

Suggested change
return meta, nil
meta.triggerIndex = config.TriggerIndex
return meta, nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in: 4934fd0

Signed-off-by: Omer Aplatony <[email protected]>
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Are these const still required?

const (
	defaultLiiklusLagThreshold           int64 = 10
	defaultLiiklusActivationLagThreshold int64 = 0
)
const (
	liiklusLagThresholdMetricName           = "lagThreshold"
	liiklusActivationLagThresholdMetricName = "activationLagThreshold"
)

@omerap12
Copy link
Contributor Author

Are these const still required?

const (
	defaultLiiklusLagThreshold           int64 = 10
	defaultLiiklusActivationLagThreshold int64 = 0
)
const (
	liiklusLagThresholdMetricName           = "lagThreshold"
	liiklusActivationLagThresholdMetricName = "activationLagThreshold"
)

I only use them in _test.go, so I believe they can be removed.

Signed-off-by: Omer Aplatony <[email protected]>
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.

3 participants