-
Notifications
You must be signed in to change notification settings - Fork 16
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
chore: delete triggeredAt for AutoOps #1179
Conversation
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.
Thanks! left comments. ptal.
proto/event/domain/event.proto
Outdated
@@ -789,7 +789,7 @@ message AutoOpsRuleCreatedEvent { | |||
string feature_id = 1; | |||
bucketeer.autoops.OpsType ops_type = 2; | |||
repeated bucketeer.autoops.Clause clauses = 3; | |||
int64 triggered_at = 4 [deprecated = true]; | |||
reserved 4; |
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.
reserved 4; | |
reserved 4; // int64 triggered_at = 4 [deprecated = true]; |
@@ -85,8 +85,7 @@ message UpdateAutoOpsRuleResponse {} | |||
message ExecuteAutoOpsRequest { | |||
string environment_namespace = 1; | |||
string id = 2; | |||
ChangeAutoOpsRuleTriggeredAtCommand | |||
change_auto_ops_rule_triggered_at_command = 3 [deprecated = true]; | |||
reserved 3; |
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.
reserved 3; | |
reserved 3; // ChangeAutoOpsRuleTriggeredAtCommand | |
change_auto_ops_rule_triggered_at_command = 3 [deprecated = true]; |
proto/autoops/auto_ops_rule.proto
Outdated
@@ -24,7 +24,7 @@ message AutoOpsRule { | |||
string feature_id = 2; | |||
OpsType ops_type = 3; | |||
repeated Clause clauses = 4; | |||
int64 triggered_at = 6 [deprecated = true]; | |||
reserved 6; |
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.
reserved 6; | |
reserved 6; // int64 triggered_at = 6 [deprecated = true]; |
@@ -706,7 +706,7 @@ func (s *AutoOpsService) UpdateAutoOpsRule( | |||
return err | |||
} | |||
|
|||
if autoOpsRule.AlreadyTriggered() || autoOpsRule.IsFinished() || autoOpsRule.IsStopped() { | |||
if autoOpsRule.IsFinished() || autoOpsRule.IsStopped() { |
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.
How about adding a new method IsCompleted()
to the domain?
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.
The isCompleted
will be confusing IMHO.
Because the complete and finish have the same meaning in this case.
It will be easier to understand and leave it as it is. WDYT?
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.
It may be confusing how to use it.
Add deleted to the condition,
How about changing it to IsInactive()
?
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.
@kakcy, the issue is not the function name. By creating IsInactive
or isCompleted
, we are creating a new state that doesn't exist in the auto_ops_rule domain layer, which is confusing because completed
and finished
words have the same meaning in this case.
So, my suggestion is to leave it as it is.
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.
@cre8ivejp @kentakozuka
Since there were multiple locations that made the same judgment, we decided that it would be better to add a new one to improve the readability of the code.
However, as you pointed out, IsCompleted()
does not exist in AutoOpsStatus, and having a function that determines a similar status causes confusion when used, so I will discontinue it.
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 reverted IsCompleted()
.
1aae01c
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 corrected the points pointed out.
Please check it when you have time.
pkg/autoops/domain/auto_ops_rule.go
Outdated
@@ -135,20 +120,19 @@ func (a *AutoOpsRule) IsStopped() bool { | |||
return a.AutoOpsStatus == proto.AutoOpsStatus_STOPPED | |||
} | |||
|
|||
func (a *AutoOpsRule) IsCompleted() bool { |
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.
add IsCompleted()
@@ -179,7 +182,7 @@ func (s *autoOpsRuleStorage) ListAutoOpsRules( | |||
&autoOpsRule.FeatureId, | |||
&opsType, | |||
&mysql.JSONObject{Val: &autoOpsRule.Clauses}, | |||
&autoOpsRule.TriggeredAt, | |||
&tmpTriggeredAt, // ToDo: TriggeredAt is deprecated. Remove this line after migration. |
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.
By removing this line, we don't need to wait for the migration.
@@ -139,7 +141,7 @@ func (s *autoOpsRuleStorage) GetAutoOpsRule( | |||
&autoOpsRule.FeatureId, | |||
&opsType, | |||
&mysql.JSONObject{Val: &autoOpsRule.Clauses}, | |||
&autoOpsRule.TriggeredAt, | |||
&tmpTriggeredAt, // ToDo: TriggeredAt is deprecated. Remove this line after migration. |
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.
By removing this line, we don't need to wait for the migration.
@@ -102,7 +102,7 @@ func (s *autoOpsRuleStorage) UpdateAutoOpsRule( | |||
e.FeatureId, | |||
int32(e.OpsType), | |||
mysql.JSONObject{Val: e.Clauses}, | |||
e.TriggeredAt, | |||
0, // ToDo: TriggeredAt is deprecated. Remove this line after migration. |
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.
By removing this line, we don't need to wait for the migration.
@@ -75,7 +75,7 @@ func (s *autoOpsRuleStorage) CreateAutoOpsRule( | |||
e.FeatureId, | |||
int32(e.OpsType), | |||
mysql.JSONObject{Val: e.Clauses}, | |||
e.TriggeredAt, | |||
0, // ToDo: TriggeredAt is deprecated. Remove this line after migration. |
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.
It will be safer if you alter the triggered_at
column and set a default value to zero. Then, you can remove this line without waiting for the migration.
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.
@cre8ivejp
Thank you!
I tried to respond with this commit, please check if there is any problem with the response method.
@@ -4,7 +4,7 @@ SET | |||
feature_id = ?, | |||
ops_type = ?, | |||
clauses = ?, | |||
triggered_at = ?, | |||
triggered_at = 0, |
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.
There is no need to set this to zero.
You can remove this line from the query because the field is not required when updating.
df69d39
to
1aae01c
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.
I have corrected the points pointed out.
Please check it when you have time.
@@ -706,7 +706,7 @@ func (s *AutoOpsService) UpdateAutoOpsRule( | |||
return err | |||
} | |||
|
|||
if autoOpsRule.AlreadyTriggered() || autoOpsRule.IsFinished() || autoOpsRule.IsStopped() { | |||
if autoOpsRule.IsFinished() || autoOpsRule.IsStopped() { |
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 reverted IsCompleted()
.
1aae01c
@@ -4,7 +4,6 @@ SET | |||
feature_id = ?, | |||
ops_type = ?, | |||
clauses = ?, | |||
triggered_at = ?, |
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 deleted it.
1aae01c
to
7eb8ba5
Compare
7eb8ba5
to
ab36dfa
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.
Thank you!
No description provided.