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

feat: resource monitor sdk v2 #1892

Merged
merged 32 commits into from
Jul 19, 2023
Merged

feat: resource monitor sdk v2 #1892

merged 32 commits into from
Jul 19, 2023

Conversation

sfc-gh-pbosak
Copy link
Contributor

  • refactored resource monitor to sdk v2
  • added unit and integration tests
  • minor fix in masking policy tests

Test Plan

  • unit tests
  • acceptance tests

pkg/sdk/resource_monitors_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_test.go Outdated Show resolved Hide resolved
pkg/resources/resource_monitor.go Outdated Show resolved Hide resolved
pkg/resources/resource_monitor.go Outdated Show resolved Hide resolved
@github-actions
Copy link

Integration tests failure for 5af4bbb4f6d945109074a9c4cb23eb13e1418a13

@github-actions
Copy link

Integration tests failure for ae7c85ac9a3d5f319d6c3f47a106681cd4d0ebc0

@github-actions
Copy link

Integration tests failure for e0a8eb44c8733b19af6ab2194994261600c200c3

@github-actions
Copy link

Integration tests failure for ea081ce3fc1e8c196f7b3c1c66a1f4fb553fbe7b

1 similar comment
@github-actions
Copy link

Integration tests failure for ea081ce3fc1e8c196f7b3c1c66a1f4fb553fbe7b

@github-actions
Copy link

Integration tests failure for 774b4ed3319bfaddcbda4362d2a00447f0e68281

@github-actions
Copy link

Integration tests failure for 5bd0028e7675502b79a4613ca5716db566889838

@github-actions
Copy link

Integration tests failure for d0c41146c9eb226393f6159721cce130ec1a1163

@github-actions
Copy link

Integration tests failure for 361e3827b5c71a571f31a9ec9c26ff82b2754f28

@github-actions
Copy link

Integration tests failure for 47724ae0a0b3e1820b1a0d49beda8dd8fb3d961a

@github-actions
Copy link

Integration tests failure for c2d0525e3380a7169484500ad832e9308f6d1ab7

@github-actions
Copy link

Integration tests failure for f6f2f3c00b61f6967fc3978d31c75b3144a8e49e

@github-actions
Copy link

Integration tests success for e80d0297c334ae1000d88c0c2874525a1b01aaaa

Copy link
Collaborator

@sfc-gh-swinkler sfc-gh-swinkler left a comment

Choose a reason for hiding this comment

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

mostly good, just a few minor things

pkg/resources/resource_monitor.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
Frequency Frequency
StartTime string
EndTime string
SuspendTriggers []TriggerDefinition
Copy link
Collaborator

Choose a reason for hiding this comment

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

unlike notify, you cannot have more than one suspend trigger. suspend trigger is at a given percent, and if that threshold is reached the warehouse is suspended. so it doesn't make sense to have two triggers as only the lower value will result in anything. I also verified this in Snowflake just now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it may make sense to have this just be an int. i.e. SuspendAt *int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I guess I didn't want to change the behaviour. I thought suspend_triggers still might be used under some circumstances.
So what should we do about the suspend_triggers argument then?
I think we can:

  1. just get rid of it
  2. ignore it and just take the value from suspend_trigger
  3. use the trigger with the lowest threshold from suspendTrigger and suspend_triggers

I think we should either remove it or at least explain the changed semantics. Otherwise it might be confusing for the users.

Copy link
Collaborator

Choose a reason for hiding this comment

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

suspend_triggers is a deprecated attribute since it never makes sense to have more than one suspend trigger. We have to continue to support it until the next major provider release (1.0). What i would do is just choose the lowest value in the list and use that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

StartTime string
EndTime string
SuspendTriggers []TriggerDefinition
SuspendImmediateTriggers []TriggerDefinition
Copy link
Collaborator

Choose a reason for hiding this comment

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

same thing as for suspend, you cannot have a list of triggers. perhaps this should be SuspendImmediateAt *int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above, waiting until we agree on the solution

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah just use the lowest value, thats the only thing that makes sense anyways

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

resourceMonitor bool `ddl:"static" sql:"RESOURCE MONITOR"` //lint:ignore U1000 This is used in the ddl tag
name AccountObjectIdentifier `ddl:"identifier"`
With *bool `ddl:"keyword" sql:"WITH"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

With is a static value, i think. Its not a required or optional parameter, its just there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, if we create empty resource monitor, then the query won't compile(create resource monitor 'foo' with is not ok)

Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case would it make sense to have With be a separate type?

for example:

With *ResourceMonitorWith `ddl:"keyword" sql:"WITH"`

and then later have the ResourceMonitorWith type declared which has all the parameters in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors.go Outdated Show resolved Hide resolved
pkg/sdk/resource_monitors_test.go Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Integration tests success for 231ee39a27a20790403d49a918466d96161b486b

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

Integration tests failure for b97fbe7100848a3ef9f7881be26df3af863de22c

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

Integration tests failure for 42143e9aebda46d78d39c4dc581ca962f4a07cb2

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

Integration tests failure for e0f197f91aa28cee5c540cf8414b4dc12df1a969

@github-actions
Copy link

Integration tests failure for e13f68899261c1d191e38455cbbd5e9fd82b26d9

@github-actions
Copy link

Integration tests failure for 532be5f22f26b9703249f07501a7c31c8a400cc3

1 similar comment
@github-actions
Copy link

Integration tests failure for 532be5f22f26b9703249f07501a7c31c8a400cc3

@github-actions
Copy link

Integration tests failure for 9cf8d4533ae60c07cb1f80f9ecf7c77958683ab5

@github-actions
Copy link

Integration tests success for 2c66d83d0edec551bbe7fd618f00825061898287

@sfc-gh-pbosak sfc-gh-pbosak merged commit 707d723 into main Jul 19, 2023
9 checks passed
@sfc-gh-pbosak sfc-gh-pbosak deleted the resource-monitor-sdk-v2 branch July 19, 2023 05:07
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.

None yet

2 participants