-
Notifications
You must be signed in to change notification settings - Fork 103
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
Optimized API call, query timing for the table aws_ec2_instance_type and added support to accept the wildcard pattern(t2*
) for instance type. Closes #2292
#2301
base: main
Are you sure you want to change the base?
Conversation
…nd added support to accept the wildcard pattern for instance type. Closes #2292
t2*
) for instance type. Closes #2292t2*
) for instance type. Closes #2292
Changes Overview:API Call Optimization:
Performance Comparison:Earlier (73.8s): > select count(*) from aws_ec2_instance_type;
+-------+
| count |
+-------+
| 11403 |
+-------+
Time: 73.8s. Rows returned: 1. Rows fetched: 11,380. Hydrate calls: 11,403. Now (12.2s): > select count(*) from aws_ec2_instance_type;
+-------+
| count |
+-------+
| 11403 |
+-------+
Time: 12.2s. Rows returned: 1. Rows fetched: 11,403. Hydrate calls: 0. Wildcard Search Support:
Example Query:> select instance_type, instance_type_pattern from aws_ec2_instance_type where instance_type_pattern = 'c7i.*';
+----------------+-----------------------+
| instance_type | instance_type_pattern |
+----------------+-----------------------+
| c7i.16xlarge | c7i.* |
| c7i.xlarge | c7i.* |
| c7i.large | c7i.* |
| c7i.metal-48xl | c7i.* |
| c7i.4xlarge | c7i.* |
| c7i.2xlarge | c7i.* |
| c7i.metal-24xl | c7i.* |
| c7i.8xlarge | c7i.* |
| c7i.12xlarge | c7i.* |
Time: 1.3s. Rows returned: 176. Rows fetched: 176. Hydrate calls: 0.
Scans:
1) aws_ec2_instance_type.aws: Time: 1.2s. Fetched: 176. Hydrates: 0. Quals: instance_type_pattern = 'c7i.*'. The above query fetched and displayed 176 rows in just 1.3 seconds. @e-gineer / @misraved, your feedback on the table design and suggestions regarding the column naming for Thank you! |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
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.
@ParthaI what happens if we pass limit 15
to the query? In an ideal case scenario, I wouldn't want to make a batch API call, that passes in 100 instance types.
Please take a look at the minor review comments, thanks!!
aws/table_aws_ec2_instance_type.go
Outdated
} | ||
// Helper function to filter instance types by a pattern like t2-*, m5-*, etc. | ||
func filterInstanceTypesByPattern(ctx context.Context, instanceTypes []types.InstanceType, pattern string) []types.InstanceType { | ||
plugin.Logger(ctx).Error("Pattern =>>>", pattern) |
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.
plugin.Logger(ctx).Error("Pattern =>>>", pattern) |
aws/table_aws_ec2_instance_type.go
Outdated
for _, instanceType := range instanceTypes { | ||
|
||
if re.MatchString(string(instanceType)) { | ||
plugin.Logger(ctx).Error("Pattern matched with =>>>", instanceType) |
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.
plugin.Logger(ctx).Error("Pattern matched with =>>>", instanceType) |
@misraved, thank you for the suggestion! I’ve updated the logic to optimize the API call using the |
Integration test logs
Logs
Example query results
Results